(0) Obligation:

Clauses:

append(nil, XS, XS).
append(cons(X, XS), YS, cons(X, ZS)) :- append(XS, YS, ZS).
reverse(nil, nil).
reverse(cons(X, nil), cons(X, nil)).
reverse(cons(X, XS), YS) :- ','(reverse(XS, ZS), append(ZS, cons(X, nil), YS)).
shuffle(nil, nil).
shuffle(cons(X, XS), cons(X, YS)) :- ','(reverse(XS, ZS), shuffle(ZS, YS)).
query(XS) :- shuffle(cons(X, XS), YS).

Queries:

query(g).

(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:
query_in: (b)
shuffle_in: (b,f)
reverse_in: (b,f)
append_in: (b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(2) Obligation:

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

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g

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

QUERY_IN_G(XS) → U6_G(XS, shuffle_in_ga(cons(X, XS), YS))
QUERY_IN_G(XS) → SHUFFLE_IN_GA(cons(X, XS), YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → REVERSE_IN_GA(XS, ZS)
REVERSE_IN_GA(cons(X, XS), YS) → U2_GA(X, XS, YS, reverse_in_ga(XS, ZS))
REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_GA(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → APPEND_IN_GGA(ZS, cons(X, nil), YS)
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → U1_GGA(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_GA(X, XS, YS, shuffle_in_ga(ZS, YS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
QUERY_IN_G(x1)  =  QUERY_IN_G(x1)
U6_G(x1, x2)  =  U6_G(x2)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x5)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x4)

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

(4) Obligation:

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

QUERY_IN_G(XS) → U6_G(XS, shuffle_in_ga(cons(X, XS), YS))
QUERY_IN_G(XS) → SHUFFLE_IN_GA(cons(X, XS), YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → REVERSE_IN_GA(XS, ZS)
REVERSE_IN_GA(cons(X, XS), YS) → U2_GA(X, XS, YS, reverse_in_ga(XS, ZS))
REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_GA(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → APPEND_IN_GGA(ZS, cons(X, nil), YS)
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → U1_GGA(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_GA(X, XS, YS, shuffle_in_ga(ZS, YS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
QUERY_IN_G(x1)  =  QUERY_IN_G(x1)
U6_G(x1, x2)  =  U6_G(x2)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x5)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x4)

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

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 3 SCCs with 8 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

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

APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)

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

(8) UsableRulesProof (EQUIVALENT transformation)

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

(9) Obligation:

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

APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)

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

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

(10) PiDPToQDPProof (SOUND transformation)

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

(11) Obligation:

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

APPEND_IN_GGA(cons(XS), YS) → APPEND_IN_GGA(XS, YS)

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

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

  • APPEND_IN_GGA(cons(XS), YS) → APPEND_IN_GGA(XS, YS)
    The graph contains the following edges 1 > 1, 2 >= 2

(13) TRUE

(14) Obligation:

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

REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)

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

(15) UsableRulesProof (EQUIVALENT transformation)

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

(16) Obligation:

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

REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)

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

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

(17) PiDPToQDPProof (SOUND transformation)

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

(18) Obligation:

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

REVERSE_IN_GA(cons(XS)) → REVERSE_IN_GA(XS)

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

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

  • REVERSE_IN_GA(cons(XS)) → REVERSE_IN_GA(XS)
    The graph contains the following edges 1 > 1

(20) TRUE

(21) Obligation:

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

U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)

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

(22) UsableRulesProof (EQUIVALENT transformation)

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

(23) Obligation:

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

U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))

The TRS R consists of the following rules:

reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))

The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x2)
nil  =  nil
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)

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

(24) PiDPToQDPProof (SOUND transformation)

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

(25) Obligation:

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

U4_GA(reverse_out_ga(ZS)) → SHUFFLE_IN_GA(ZS)
SHUFFLE_IN_GA(cons(XS)) → U4_GA(reverse_in_ga(XS))

The TRS R consists of the following rules:

reverse_in_ga(nil) → reverse_out_ga(nil)
reverse_in_ga(cons(nil)) → reverse_out_ga(cons(nil))
reverse_in_ga(cons(XS)) → U2_ga(reverse_in_ga(XS))
U2_ga(reverse_out_ga(ZS)) → U3_ga(append_in_gga(ZS, cons(nil)))
U3_ga(append_out_gga(YS)) → reverse_out_ga(YS)
append_in_gga(nil, XS) → append_out_gga(XS)
append_in_gga(cons(XS), YS) → U1_gga(append_in_gga(XS, YS))
U1_gga(append_out_gga(ZS)) → append_out_gga(cons(ZS))

The set Q consists of the following terms:

reverse_in_ga(x0)
U2_ga(x0)
U3_ga(x0)
append_in_gga(x0, x1)
U1_gga(x0)

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

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

U4_GA(reverse_out_ga(ZS)) → SHUFFLE_IN_GA(ZS)
SHUFFLE_IN_GA(cons(XS)) → U4_GA(reverse_in_ga(XS))


Used ordering: Polynomial interpretation [POLO]:

POL(SHUFFLE_IN_GA(x1)) = x1   
POL(U1_gga(x1)) = 2 + x1   
POL(U2_ga(x1)) = 2 + x1   
POL(U3_ga(x1)) = x1   
POL(U4_GA(x1)) = 1 + x1   
POL(append_in_gga(x1, x2)) = x1 + x2   
POL(append_out_gga(x1)) = x1   
POL(cons(x1)) = 2 + x1   
POL(nil) = 0   
POL(reverse_in_ga(x1)) = x1   
POL(reverse_out_ga(x1)) = x1   

(27) Obligation:

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

reverse_in_ga(nil) → reverse_out_ga(nil)
reverse_in_ga(cons(nil)) → reverse_out_ga(cons(nil))
reverse_in_ga(cons(XS)) → U2_ga(reverse_in_ga(XS))
U2_ga(reverse_out_ga(ZS)) → U3_ga(append_in_gga(ZS, cons(nil)))
U3_ga(append_out_gga(YS)) → reverse_out_ga(YS)
append_in_gga(nil, XS) → append_out_gga(XS)
append_in_gga(cons(XS), YS) → U1_gga(append_in_gga(XS, YS))
U1_gga(append_out_gga(ZS)) → append_out_gga(cons(ZS))

The set Q consists of the following terms:

reverse_in_ga(x0)
U2_ga(x0)
U3_ga(x0)
append_in_gga(x0, x1)
U1_gga(x0)

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

(28) PisEmptyProof (EQUIVALENT transformation)

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

(29) TRUE

(30) PrologToPiTRSProof (SOUND transformation)

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

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(31) Obligation:

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

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)

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

QUERY_IN_G(XS) → U6_G(XS, shuffle_in_ga(cons(X, XS), YS))
QUERY_IN_G(XS) → SHUFFLE_IN_GA(cons(X, XS), YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → REVERSE_IN_GA(XS, ZS)
REVERSE_IN_GA(cons(X, XS), YS) → U2_GA(X, XS, YS, reverse_in_ga(XS, ZS))
REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_GA(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → APPEND_IN_GGA(ZS, cons(X, nil), YS)
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → U1_GGA(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_GA(X, XS, YS, shuffle_in_ga(ZS, YS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)
QUERY_IN_G(x1)  =  QUERY_IN_G(x1)
U6_G(x1, x2)  =  U6_G(x1, x2)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x2, x4)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x2, x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x2, x4)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x2, x3, x5)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x2, x4)

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

(33) Obligation:

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

QUERY_IN_G(XS) → U6_G(XS, shuffle_in_ga(cons(X, XS), YS))
QUERY_IN_G(XS) → SHUFFLE_IN_GA(cons(X, XS), YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → REVERSE_IN_GA(XS, ZS)
REVERSE_IN_GA(cons(X, XS), YS) → U2_GA(X, XS, YS, reverse_in_ga(XS, ZS))
REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_GA(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → APPEND_IN_GGA(ZS, cons(X, nil), YS)
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → U1_GGA(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_GA(X, XS, YS, shuffle_in_ga(ZS, YS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)
QUERY_IN_G(x1)  =  QUERY_IN_G(x1)
U6_G(x1, x2)  =  U6_G(x1, x2)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x2, x4)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x2, x4)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x2, x4)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x2, x3, x5)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x2, x4)

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

(34) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 3 SCCs with 8 less nodes.

(35) Complex Obligation (AND)

(36) Obligation:

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

APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)

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

(37) UsableRulesProof (EQUIVALENT transformation)

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

(38) Obligation:

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

APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)

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

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

(39) PiDPToQDPProof (SOUND transformation)

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

(40) Obligation:

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

APPEND_IN_GGA(cons(XS), YS) → APPEND_IN_GGA(XS, YS)

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

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

  • APPEND_IN_GGA(cons(XS), YS) → APPEND_IN_GGA(XS, YS)
    The graph contains the following edges 1 > 1, 2 >= 2

(42) TRUE

(43) Obligation:

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

REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)

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

(44) UsableRulesProof (EQUIVALENT transformation)

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

(45) Obligation:

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

REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)

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

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

(46) PiDPToQDPProof (SOUND transformation)

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

(47) Obligation:

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

REVERSE_IN_GA(cons(XS)) → REVERSE_IN_GA(XS)

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

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

  • REVERSE_IN_GA(cons(XS)) → REVERSE_IN_GA(XS)
    The graph contains the following edges 1 > 1

(49) TRUE

(50) Obligation:

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

U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x1, x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x1, x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x2, x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x2, x4)
query_out_g(x1)  =  query_out_g(x1)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x2, x4)

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

(51) UsableRulesProof (EQUIVALENT transformation)

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

(52) Obligation:

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

U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))

The TRS R consists of the following rules:

reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))

The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x2)
nil  =  nil
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x1, x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x2, x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x2, x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x1, x2, x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x2, x3, x5)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x2, x4)

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

(53) PiDPToQDPProof (SOUND transformation)

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

(54) Obligation:

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

U4_GA(XS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS)
SHUFFLE_IN_GA(cons(XS)) → U4_GA(XS, reverse_in_ga(XS))

The TRS R consists of the following rules:

reverse_in_ga(nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(nil)) → reverse_out_ga(cons(nil), cons(nil))
reverse_in_ga(cons(XS)) → U2_ga(XS, reverse_in_ga(XS))
U2_ga(XS, reverse_out_ga(XS, ZS)) → U3_ga(XS, append_in_gga(ZS, cons(nil)))
U3_ga(XS, append_out_gga(ZS, cons(nil), YS)) → reverse_out_ga(cons(XS), YS)
append_in_gga(nil, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(XS), YS) → U1_gga(XS, YS, append_in_gga(XS, YS))
U1_gga(XS, YS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(XS), YS, cons(ZS))

The set Q consists of the following terms:

reverse_in_ga(x0)
U2_ga(x0, x1)
U3_ga(x0, x1)
append_in_gga(x0, x1)
U1_gga(x0, x1, x2)

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