(0) Obligation:

Clauses:

gopher(nil, nil).
gopher(X, cons(nil, T)) :- ','(no(empty(X)), ','(head(X, nil), tail(X, T))).
gopher(X, Y) :- ','(no(empty(X)), ','(head(X, H), ','(no(empty(H)), ','(head(H, U), ','(tail(H, V), ','(tail(X, W), gopher(cons(U, cons(V, W)), Y))))))).
head([], X1).
head(.(X, X2), X).
tail([], []).
tail(.(X3, X), X).
empty([]).
no(X) :- ','(X, ','(!, failure(a))).
no(X4).
failure(b).

Queries:

gopher(g,a).

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph.

(2) Obligation:

Clauses:

gopher1(nil, nil).
gopher1(.(nil, T10), cons(nil, T10)).
gopher1(.(.(T24, T25), T26), T13) :- gopher1(cons(T24, cons(T25, T26)), T13).

Queries:

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

gopher1_in_ga(nil, nil) → gopher1_out_ga(nil, nil)
gopher1_in_ga(.(nil, T10), cons(nil, T10)) → gopher1_out_ga(.(nil, T10), cons(nil, T10))
gopher1_in_ga(.(.(T24, T25), T26), T13) → U1_ga(T24, T25, T26, T13, gopher1_in_ga(cons(T24, cons(T25, T26)), T13))
U1_ga(T24, T25, T26, T13, gopher1_out_ga(cons(T24, cons(T25, T26)), T13)) → gopher1_out_ga(.(.(T24, T25), T26), T13)

The argument filtering Pi contains the following mapping:
gopher1_in_ga(x1, x2)  =  gopher1_in_ga(x1)
nil  =  nil
gopher1_out_ga(x1, x2)  =  gopher1_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

gopher1_in_ga(nil, nil) → gopher1_out_ga(nil, nil)
gopher1_in_ga(.(nil, T10), cons(nil, T10)) → gopher1_out_ga(.(nil, T10), cons(nil, T10))
gopher1_in_ga(.(.(T24, T25), T26), T13) → U1_ga(T24, T25, T26, T13, gopher1_in_ga(cons(T24, cons(T25, T26)), T13))
U1_ga(T24, T25, T26, T13, gopher1_out_ga(cons(T24, cons(T25, T26)), T13)) → gopher1_out_ga(.(.(T24, T25), T26), T13)

The argument filtering Pi contains the following mapping:
gopher1_in_ga(x1, x2)  =  gopher1_in_ga(x1)
nil  =  nil
gopher1_out_ga(x1, x2)  =  gopher1_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)

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

GOPHER1_IN_GA(.(.(T24, T25), T26), T13) → U1_GA(T24, T25, T26, T13, gopher1_in_ga(cons(T24, cons(T25, T26)), T13))
GOPHER1_IN_GA(.(.(T24, T25), T26), T13) → GOPHER1_IN_GA(cons(T24, cons(T25, T26)), T13)

The TRS R consists of the following rules:

gopher1_in_ga(nil, nil) → gopher1_out_ga(nil, nil)
gopher1_in_ga(.(nil, T10), cons(nil, T10)) → gopher1_out_ga(.(nil, T10), cons(nil, T10))
gopher1_in_ga(.(.(T24, T25), T26), T13) → U1_ga(T24, T25, T26, T13, gopher1_in_ga(cons(T24, cons(T25, T26)), T13))
U1_ga(T24, T25, T26, T13, gopher1_out_ga(cons(T24, cons(T25, T26)), T13)) → gopher1_out_ga(.(.(T24, T25), T26), T13)

The argument filtering Pi contains the following mapping:
gopher1_in_ga(x1, x2)  =  gopher1_in_ga(x1)
nil  =  nil
gopher1_out_ga(x1, x2)  =  gopher1_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)
GOPHER1_IN_GA(x1, x2)  =  GOPHER1_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)

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

(6) Obligation:

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

GOPHER1_IN_GA(.(.(T24, T25), T26), T13) → U1_GA(T24, T25, T26, T13, gopher1_in_ga(cons(T24, cons(T25, T26)), T13))
GOPHER1_IN_GA(.(.(T24, T25), T26), T13) → GOPHER1_IN_GA(cons(T24, cons(T25, T26)), T13)

The TRS R consists of the following rules:

gopher1_in_ga(nil, nil) → gopher1_out_ga(nil, nil)
gopher1_in_ga(.(nil, T10), cons(nil, T10)) → gopher1_out_ga(.(nil, T10), cons(nil, T10))
gopher1_in_ga(.(.(T24, T25), T26), T13) → U1_ga(T24, T25, T26, T13, gopher1_in_ga(cons(T24, cons(T25, T26)), T13))
U1_ga(T24, T25, T26, T13, gopher1_out_ga(cons(T24, cons(T25, T26)), T13)) → gopher1_out_ga(.(.(T24, T25), T26), T13)

The argument filtering Pi contains the following mapping:
gopher1_in_ga(x1, x2)  =  gopher1_in_ga(x1)
nil  =  nil
gopher1_out_ga(x1, x2)  =  gopher1_out_ga(x2)
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)
GOPHER1_IN_GA(x1, x2)  =  GOPHER1_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

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

(8) TRUE