(0) Obligation:

Clauses:

countstack(empty, X) :- ','(!, eq(X, 0)).
countstack(S, X) :- ','(pop(S, nil), ','(!, ','(popped(S, Pd), countstack(Pd, X)))).
countstack(S, s(X)) :- ','(pop(S, P), ','(head(P, H), ','(tail(P, T), ','(popped(S, Pd), countstack(push(H, push(T, Pd)), X))))).
pop(empty, X1).
pop(push(P, X2), P).
popped(empty, empty).
popped(push(X3, Pd), Pd).
head(nil, X4).
head(cons(H, X5), H).
tail(nil, nil).
tail(cons(X6, T), T).
eq(X, X).

Queries:

countstack(g,a).

(1) CutEliminatorProof (SOUND transformation)

Eliminated all cuts by simply ignoring them[PROLOG].

(2) Obligation:

Clauses:

countstack(empty, X) :- eq(X, 0).
countstack(S, X) :- ','(pop(S, nil), ','(popped(S, Pd), countstack(Pd, X))).
countstack(S, s(X)) :- ','(pop(S, P), ','(head(P, H), ','(tail(P, T), ','(popped(S, Pd), countstack(push(H, push(T, Pd)), X))))).
pop(empty, X1).
pop(push(P, X2), P).
popped(empty, empty).
popped(push(X3, Pd), Pd).
head(nil, X4).
head(cons(H, X5), H).
tail(nil, nil).
tail(cons(X6, T), T).
eq(X, X).

Queries:

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

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x6)
U9_ga(x1, x2, x3)  =  U9_ga(x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

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

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x6)
U9_ga(x1, x2, x3)  =  U9_ga(x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)

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

COUNTSTACK_IN_GA(empty, X) → U1_GA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_GA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
COUNTSTACK_IN_GA(S, X) → POP_IN_GG(S, nil)
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U2_GA(S, X, pop_out_gg(S, nil)) → POPPED_IN_GA(S, Pd)
U3_GA(S, X, popped_out_ga(S, Pd)) → U4_GA(S, X, countstack_in_ga(Pd, X))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)
COUNTSTACK_IN_GA(S, s(X)) → U5_GA(S, X, pop_in_ga(S, P))
COUNTSTACK_IN_GA(S, s(X)) → POP_IN_GA(S, P)
U5_GA(S, X, pop_out_ga(S, P)) → U6_GA(S, X, P, head_in_aa(P, H))
U5_GA(S, X, pop_out_ga(S, P)) → HEAD_IN_AA(P, H)
U6_GA(S, X, P, head_out_aa(P, H)) → U7_GA(S, X, P, H, tail_in_aa(P, T))
U6_GA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_GA(S, X, P, H, tail_out_aa(P, T)) → U8_GA(S, X, P, H, T, popped_in_ga(S, Pd))
U7_GA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_GA(S, Pd)
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_GA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)
COUNTSTACK_IN_AA(empty, X) → U1_AA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_AA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
COUNTSTACK_IN_AA(S, X) → POP_IN_AG(S, nil)
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U2_AA(S, X, pop_out_ag(S, nil)) → POPPED_IN_AA(S, Pd)
U3_AA(S, X, popped_out_aa(S, Pd)) → U4_AA(S, X, countstack_in_aa(Pd, X))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
COUNTSTACK_IN_AA(S, s(X)) → POP_IN_AA(S, P)
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U5_AA(S, X, pop_out_aa(S, P)) → HEAD_IN_AA(P, H)
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U6_AA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_AA(S, Pd)
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_AA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x6)
U9_ga(x1, x2, x3)  =  U9_ga(x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U1_GA(x1, x2)  =  U1_GA(x2)
EQ_IN_AG(x1, x2)  =  EQ_IN_AG(x2)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
POP_IN_GG(x1, x2)  =  POP_IN_GG(x1, x2)
U3_GA(x1, x2, x3)  =  U3_GA(x3)
POPPED_IN_GA(x1, x2)  =  POPPED_IN_GA(x1)
U4_GA(x1, x2, x3)  =  U4_GA(x3)
U5_GA(x1, x2, x3)  =  U5_GA(x1, x3)
POP_IN_GA(x1, x2)  =  POP_IN_GA(x1)
U6_GA(x1, x2, x3, x4)  =  U6_GA(x1, x4)
HEAD_IN_AA(x1, x2)  =  HEAD_IN_AA
U7_GA(x1, x2, x3, x4, x5)  =  U7_GA(x1, x5)
TAIL_IN_AA(x1, x2)  =  TAIL_IN_AA
U8_GA(x1, x2, x3, x4, x5, x6)  =  U8_GA(x6)
U9_GA(x1, x2, x3)  =  U9_GA(x3)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U1_AA(x1, x2)  =  U1_AA(x2)
U2_AA(x1, x2, x3)  =  U2_AA(x3)
POP_IN_AG(x1, x2)  =  POP_IN_AG(x2)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
POPPED_IN_AA(x1, x2)  =  POPPED_IN_AA
U4_AA(x1, x2, x3)  =  U4_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
POP_IN_AA(x1, x2)  =  POP_IN_AA
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)
U9_AA(x1, x2, x3)  =  U9_AA(x3)

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

(6) Obligation:

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

COUNTSTACK_IN_GA(empty, X) → U1_GA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_GA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
COUNTSTACK_IN_GA(S, X) → POP_IN_GG(S, nil)
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U2_GA(S, X, pop_out_gg(S, nil)) → POPPED_IN_GA(S, Pd)
U3_GA(S, X, popped_out_ga(S, Pd)) → U4_GA(S, X, countstack_in_ga(Pd, X))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)
COUNTSTACK_IN_GA(S, s(X)) → U5_GA(S, X, pop_in_ga(S, P))
COUNTSTACK_IN_GA(S, s(X)) → POP_IN_GA(S, P)
U5_GA(S, X, pop_out_ga(S, P)) → U6_GA(S, X, P, head_in_aa(P, H))
U5_GA(S, X, pop_out_ga(S, P)) → HEAD_IN_AA(P, H)
U6_GA(S, X, P, head_out_aa(P, H)) → U7_GA(S, X, P, H, tail_in_aa(P, T))
U6_GA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_GA(S, X, P, H, tail_out_aa(P, T)) → U8_GA(S, X, P, H, T, popped_in_ga(S, Pd))
U7_GA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_GA(S, Pd)
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_GA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)
COUNTSTACK_IN_AA(empty, X) → U1_AA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_AA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
COUNTSTACK_IN_AA(S, X) → POP_IN_AG(S, nil)
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U2_AA(S, X, pop_out_ag(S, nil)) → POPPED_IN_AA(S, Pd)
U3_AA(S, X, popped_out_aa(S, Pd)) → U4_AA(S, X, countstack_in_aa(Pd, X))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
COUNTSTACK_IN_AA(S, s(X)) → POP_IN_AA(S, P)
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U5_AA(S, X, pop_out_aa(S, P)) → HEAD_IN_AA(P, H)
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U6_AA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_AA(S, Pd)
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_AA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x6)
U9_ga(x1, x2, x3)  =  U9_ga(x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U1_GA(x1, x2)  =  U1_GA(x2)
EQ_IN_AG(x1, x2)  =  EQ_IN_AG(x2)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
POP_IN_GG(x1, x2)  =  POP_IN_GG(x1, x2)
U3_GA(x1, x2, x3)  =  U3_GA(x3)
POPPED_IN_GA(x1, x2)  =  POPPED_IN_GA(x1)
U4_GA(x1, x2, x3)  =  U4_GA(x3)
U5_GA(x1, x2, x3)  =  U5_GA(x1, x3)
POP_IN_GA(x1, x2)  =  POP_IN_GA(x1)
U6_GA(x1, x2, x3, x4)  =  U6_GA(x1, x4)
HEAD_IN_AA(x1, x2)  =  HEAD_IN_AA
U7_GA(x1, x2, x3, x4, x5)  =  U7_GA(x1, x5)
TAIL_IN_AA(x1, x2)  =  TAIL_IN_AA
U8_GA(x1, x2, x3, x4, x5, x6)  =  U8_GA(x6)
U9_GA(x1, x2, x3)  =  U9_GA(x3)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U1_AA(x1, x2)  =  U1_AA(x2)
U2_AA(x1, x2, x3)  =  U2_AA(x3)
POP_IN_AG(x1, x2)  =  POP_IN_AG(x2)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
POPPED_IN_AA(x1, x2)  =  POPPED_IN_AA
U4_AA(x1, x2, x3)  =  U4_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
POP_IN_AA(x1, x2)  =  POP_IN_AA
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)
U9_AA(x1, x2, x3)  =  U9_AA(x3)

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

(7) DependencyGraphProof (EQUIVALENT transformation)

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

(8) Complex Obligation (AND)

(9) Obligation:

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

COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x6)
U9_ga(x1, x2, x3)  =  U9_ga(x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U2_AA(x1, x2, x3)  =  U2_AA(x3)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)

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

(10) UsableRulesProof (EQUIVALENT transformation)

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

(11) Obligation:

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

COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)

The argument filtering Pi contains the following mapping:
empty  =  empty
push(x1, x2)  =  push(x1, x2)
nil  =  nil
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
s(x1)  =  s(x1)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U2_AA(x1, x2, x3)  =  U2_AA(x3)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)

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

(12) PiDPToQDPProof (SOUND transformation)

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

(13) Obligation:

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

COUNTSTACK_IN_AAU2_AA(pop_in_ag(nil))
U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA

The TRS R consists of the following rules:

pop_in_ag(X1) → pop_out_ag
popped_in_aapopped_out_aa
pop_in_aapop_out_aa
head_in_aahead_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(14) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule COUNTSTACK_IN_AAU2_AA(pop_in_ag(nil)) at position [0] we obtained the following new rules [LPAR04]:

COUNTSTACK_IN_AAU2_AA(pop_out_ag)

(15) Obligation:

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

U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)

The TRS R consists of the following rules:

pop_in_ag(X1) → pop_out_ag
popped_in_aapopped_out_aa
pop_in_aapop_out_aa
head_in_aahead_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(16) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(17) Obligation:

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

U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(18) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

pop_in_ag(x0)

(19) Obligation:

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

U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(20) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U2_AA(pop_out_ag) → U3_AA(popped_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U2_AA(pop_out_ag) → U3_AA(popped_out_aa)

(21) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(22) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule COUNTSTACK_IN_AAU5_AA(pop_in_aa) at position [0] we obtained the following new rules [LPAR04]:

COUNTSTACK_IN_AAU5_AA(pop_out_aa)

(23) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(24) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(25) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(26) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

pop_in_aa

(27) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa

The set Q consists of the following terms:

popped_in_aa
head_in_aa
tail_in_aa

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

(28) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U5_AA(pop_out_aa) → U6_AA(head_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U5_AA(pop_out_aa) → U6_AA(head_out_aa)

(29) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa

The set Q consists of the following terms:

popped_in_aa
head_in_aa
tail_in_aa

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

(30) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(31) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

popped_in_aa
head_in_aa
tail_in_aa

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

(32) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

head_in_aa

(33) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

popped_in_aa
tail_in_aa

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

(34) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U6_AA(head_out_aa) → U7_AA(tail_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U6_AA(head_out_aa) → U7_AA(tail_out_aa)

(35) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

popped_in_aa
tail_in_aa

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

(36) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(37) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa

The set Q consists of the following terms:

popped_in_aa
tail_in_aa

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

(38) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

tail_in_aa

(39) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa

The set Q consists of the following terms:

popped_in_aa

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

(40) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U7_AA(tail_out_aa) → U8_AA(popped_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

(41) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa

The set Q consists of the following terms:

popped_in_aa

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

(42) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(43) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

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

popped_in_aa

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

(44) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

popped_in_aa

(45) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

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

(46) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

s = COUNTSTACK_IN_AA evaluates to t =COUNTSTACK_IN_AA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Matcher: [ ]
  • Semiunifier: [ ]




Rewriting sequence

COUNTSTACK_IN_AAU2_AA(pop_out_ag)
with rule COUNTSTACK_IN_AAU2_AA(pop_out_ag) at position [] and matcher [ ]

U2_AA(pop_out_ag)U3_AA(popped_out_aa)
with rule U2_AA(pop_out_ag) → U3_AA(popped_out_aa) at position [] and matcher [ ]

U3_AA(popped_out_aa)COUNTSTACK_IN_AA
with rule U3_AA(popped_out_aa) → COUNTSTACK_IN_AA

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.



(47) FALSE

(48) Obligation:

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

COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
U4_ga(x1, x2, x3)  =  U4_ga(x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x6)
U9_ga(x1, x2, x3)  =  U9_ga(x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
U3_GA(x1, x2, x3)  =  U3_GA(x3)

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

(49) UsableRulesProof (EQUIVALENT transformation)

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

(50) Obligation:

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

COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)

The TRS R consists of the following rules:

pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)

The argument filtering Pi contains the following mapping:
empty  =  empty
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg
push(x1, x2)  =  push(x1, x2)
nil  =  nil
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x2)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
U3_GA(x1, x2, x3)  =  U3_GA(x3)

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

(51) PiDPToQDPProof (SOUND transformation)

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

(52) Obligation:

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

COUNTSTACK_IN_GA(S) → U2_GA(S, pop_in_gg(S, nil))
U2_GA(S, pop_out_gg) → U3_GA(popped_in_ga(S))
U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)

The TRS R consists of the following rules:

pop_in_gg(empty, X1) → pop_out_gg
pop_in_gg(push(P, X2), P) → pop_out_gg
popped_in_ga(empty) → popped_out_ga(empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(Pd)

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

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

popped_in_ga(push(X3, Pd)) → popped_out_ga(Pd)
pop_in_gg(push(P, X2), P) → pop_out_gg
Used ordering: POLO with Polynomial interpretation [POLO]:

POL(COUNTSTACK_IN_GA(x1)) = 2·x1   
POL(U2_GA(x1, x2)) = x1 + x2   
POL(U3_GA(x1)) = x1   
POL(empty) = 0   
POL(nil) = 0   
POL(pop_in_gg(x1, x2)) = x1 + 2·x2   
POL(pop_out_gg) = 0   
POL(popped_in_ga(x1)) = x1   
POL(popped_out_ga(x1)) = 2·x1   
POL(push(x1, x2)) = x1 + 2·x2   

(54) Obligation:

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

COUNTSTACK_IN_GA(S) → U2_GA(S, pop_in_gg(S, nil))
U2_GA(S, pop_out_gg) → U3_GA(popped_in_ga(S))
U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty)
pop_in_gg(empty, X1) → pop_out_gg

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

(55) Narrowing (SOUND transformation)

By narrowing [LPAR04] the rule COUNTSTACK_IN_GA(S) → U2_GA(S, pop_in_gg(S, nil)) at position [1] we obtained the following new rules [LPAR04]:

COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)

(56) Obligation:

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

U2_GA(S, pop_out_gg) → U3_GA(popped_in_ga(S))
U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty)
pop_in_gg(empty, X1) → pop_out_gg

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

(57) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(58) Obligation:

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

U2_GA(S, pop_out_gg) → U3_GA(popped_in_ga(S))
U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty)

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

(59) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

pop_in_gg(x0, x1)

(60) Obligation:

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

U2_GA(S, pop_out_gg) → U3_GA(popped_in_ga(S))
U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty)

The set Q consists of the following terms:

popped_in_ga(x0)

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

(61) Narrowing (SOUND transformation)

By narrowing [LPAR04] the rule U2_GA(S, pop_out_gg) → U3_GA(popped_in_ga(S)) at position [0] we obtained the following new rules [LPAR04]:

U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty))

(62) Obligation:

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

U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)
U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty))

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty)

The set Q consists of the following terms:

popped_in_ga(x0)

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

(63) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(64) Obligation:

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

U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)
U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty))

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

popped_in_ga(x0)

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

(65) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

popped_in_ga(x0)

(66) Obligation:

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

U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)
U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty))

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

(67) Instantiation (EQUIVALENT transformation)

By instantiating [LPAR04] the rule U3_GA(popped_out_ga(Pd)) → COUNTSTACK_IN_GA(Pd) we obtained the following new rules [LPAR04]:

U3_GA(popped_out_ga(empty)) → COUNTSTACK_IN_GA(empty)

(68) Obligation:

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

COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)
U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty))
U3_GA(popped_out_ga(empty)) → COUNTSTACK_IN_GA(empty)

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

(69) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

s = U2_GA(empty, pop_out_gg) evaluates to t =U2_GA(empty, pop_out_gg)

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Matcher: [ ]
  • Semiunifier: [ ]




Rewriting sequence

U2_GA(empty, pop_out_gg)U3_GA(popped_out_ga(empty))
with rule U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty)) at position [] and matcher [ ]

U3_GA(popped_out_ga(empty))COUNTSTACK_IN_GA(empty)
with rule U3_GA(popped_out_ga(empty)) → COUNTSTACK_IN_GA(empty) at position [] and matcher [ ]

COUNTSTACK_IN_GA(empty)U2_GA(empty, pop_out_gg)
with rule COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.



(70) FALSE

(71) PrologToPiTRSProof (SOUND transformation)

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

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1, x2)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x1, x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x1, x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga(x1)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x1, x6)
U9_ga(x1, x2, x3)  =  U9_ga(x1, x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(72) Obligation:

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

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1, x2)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x1, x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x1, x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga(x1)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x1, x6)
U9_ga(x1, x2, x3)  =  U9_ga(x1, x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)

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

COUNTSTACK_IN_GA(empty, X) → U1_GA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_GA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
COUNTSTACK_IN_GA(S, X) → POP_IN_GG(S, nil)
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U2_GA(S, X, pop_out_gg(S, nil)) → POPPED_IN_GA(S, Pd)
U3_GA(S, X, popped_out_ga(S, Pd)) → U4_GA(S, X, countstack_in_ga(Pd, X))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)
COUNTSTACK_IN_GA(S, s(X)) → U5_GA(S, X, pop_in_ga(S, P))
COUNTSTACK_IN_GA(S, s(X)) → POP_IN_GA(S, P)
U5_GA(S, X, pop_out_ga(S, P)) → U6_GA(S, X, P, head_in_aa(P, H))
U5_GA(S, X, pop_out_ga(S, P)) → HEAD_IN_AA(P, H)
U6_GA(S, X, P, head_out_aa(P, H)) → U7_GA(S, X, P, H, tail_in_aa(P, T))
U6_GA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_GA(S, X, P, H, tail_out_aa(P, T)) → U8_GA(S, X, P, H, T, popped_in_ga(S, Pd))
U7_GA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_GA(S, Pd)
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_GA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)
COUNTSTACK_IN_AA(empty, X) → U1_AA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_AA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
COUNTSTACK_IN_AA(S, X) → POP_IN_AG(S, nil)
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U2_AA(S, X, pop_out_ag(S, nil)) → POPPED_IN_AA(S, Pd)
U3_AA(S, X, popped_out_aa(S, Pd)) → U4_AA(S, X, countstack_in_aa(Pd, X))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
COUNTSTACK_IN_AA(S, s(X)) → POP_IN_AA(S, P)
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U5_AA(S, X, pop_out_aa(S, P)) → HEAD_IN_AA(P, H)
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U6_AA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_AA(S, Pd)
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_AA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1, x2)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x1, x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x1, x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga(x1)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x1, x6)
U9_ga(x1, x2, x3)  =  U9_ga(x1, x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U1_GA(x1, x2)  =  U1_GA(x2)
EQ_IN_AG(x1, x2)  =  EQ_IN_AG(x2)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
POP_IN_GG(x1, x2)  =  POP_IN_GG(x1, x2)
U3_GA(x1, x2, x3)  =  U3_GA(x1, x3)
POPPED_IN_GA(x1, x2)  =  POPPED_IN_GA(x1)
U4_GA(x1, x2, x3)  =  U4_GA(x1, x3)
U5_GA(x1, x2, x3)  =  U5_GA(x1, x3)
POP_IN_GA(x1, x2)  =  POP_IN_GA(x1)
U6_GA(x1, x2, x3, x4)  =  U6_GA(x1, x4)
HEAD_IN_AA(x1, x2)  =  HEAD_IN_AA
U7_GA(x1, x2, x3, x4, x5)  =  U7_GA(x1, x5)
TAIL_IN_AA(x1, x2)  =  TAIL_IN_AA
U8_GA(x1, x2, x3, x4, x5, x6)  =  U8_GA(x1, x6)
U9_GA(x1, x2, x3)  =  U9_GA(x1, x3)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U1_AA(x1, x2)  =  U1_AA(x2)
U2_AA(x1, x2, x3)  =  U2_AA(x3)
POP_IN_AG(x1, x2)  =  POP_IN_AG(x2)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
POPPED_IN_AA(x1, x2)  =  POPPED_IN_AA
U4_AA(x1, x2, x3)  =  U4_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
POP_IN_AA(x1, x2)  =  POP_IN_AA
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)
U9_AA(x1, x2, x3)  =  U9_AA(x3)

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

(74) Obligation:

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

COUNTSTACK_IN_GA(empty, X) → U1_GA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_GA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
COUNTSTACK_IN_GA(S, X) → POP_IN_GG(S, nil)
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U2_GA(S, X, pop_out_gg(S, nil)) → POPPED_IN_GA(S, Pd)
U3_GA(S, X, popped_out_ga(S, Pd)) → U4_GA(S, X, countstack_in_ga(Pd, X))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)
COUNTSTACK_IN_GA(S, s(X)) → U5_GA(S, X, pop_in_ga(S, P))
COUNTSTACK_IN_GA(S, s(X)) → POP_IN_GA(S, P)
U5_GA(S, X, pop_out_ga(S, P)) → U6_GA(S, X, P, head_in_aa(P, H))
U5_GA(S, X, pop_out_ga(S, P)) → HEAD_IN_AA(P, H)
U6_GA(S, X, P, head_out_aa(P, H)) → U7_GA(S, X, P, H, tail_in_aa(P, T))
U6_GA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_GA(S, X, P, H, tail_out_aa(P, T)) → U8_GA(S, X, P, H, T, popped_in_ga(S, Pd))
U7_GA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_GA(S, Pd)
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_GA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_GA(S, X, P, H, T, popped_out_ga(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)
COUNTSTACK_IN_AA(empty, X) → U1_AA(X, eq_in_ag(X, 0))
COUNTSTACK_IN_AA(empty, X) → EQ_IN_AG(X, 0)
COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
COUNTSTACK_IN_AA(S, X) → POP_IN_AG(S, nil)
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U2_AA(S, X, pop_out_ag(S, nil)) → POPPED_IN_AA(S, Pd)
U3_AA(S, X, popped_out_aa(S, Pd)) → U4_AA(S, X, countstack_in_aa(Pd, X))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
COUNTSTACK_IN_AA(S, s(X)) → POP_IN_AA(S, P)
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U5_AA(S, X, pop_out_aa(S, P)) → HEAD_IN_AA(P, H)
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U6_AA(S, X, P, head_out_aa(P, H)) → TAIL_IN_AA(P, T)
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → POPPED_IN_AA(S, Pd)
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_AA(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1, x2)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x1, x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x1, x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga(x1)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x1, x6)
U9_ga(x1, x2, x3)  =  U9_ga(x1, x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U1_GA(x1, x2)  =  U1_GA(x2)
EQ_IN_AG(x1, x2)  =  EQ_IN_AG(x2)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
POP_IN_GG(x1, x2)  =  POP_IN_GG(x1, x2)
U3_GA(x1, x2, x3)  =  U3_GA(x1, x3)
POPPED_IN_GA(x1, x2)  =  POPPED_IN_GA(x1)
U4_GA(x1, x2, x3)  =  U4_GA(x1, x3)
U5_GA(x1, x2, x3)  =  U5_GA(x1, x3)
POP_IN_GA(x1, x2)  =  POP_IN_GA(x1)
U6_GA(x1, x2, x3, x4)  =  U6_GA(x1, x4)
HEAD_IN_AA(x1, x2)  =  HEAD_IN_AA
U7_GA(x1, x2, x3, x4, x5)  =  U7_GA(x1, x5)
TAIL_IN_AA(x1, x2)  =  TAIL_IN_AA
U8_GA(x1, x2, x3, x4, x5, x6)  =  U8_GA(x1, x6)
U9_GA(x1, x2, x3)  =  U9_GA(x1, x3)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U1_AA(x1, x2)  =  U1_AA(x2)
U2_AA(x1, x2, x3)  =  U2_AA(x3)
POP_IN_AG(x1, x2)  =  POP_IN_AG(x2)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
POPPED_IN_AA(x1, x2)  =  POPPED_IN_AA
U4_AA(x1, x2, x3)  =  U4_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
POP_IN_AA(x1, x2)  =  POP_IN_AA
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)
U9_AA(x1, x2, x3)  =  U9_AA(x3)

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

(75) DependencyGraphProof (EQUIVALENT transformation)

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

(76) Complex Obligation (AND)

(77) Obligation:

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

COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1, x2)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x1, x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x1, x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga(x1)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x1, x6)
U9_ga(x1, x2, x3)  =  U9_ga(x1, x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U2_AA(x1, x2, x3)  =  U2_AA(x3)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)

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

(78) UsableRulesProof (EQUIVALENT transformation)

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

(79) Obligation:

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

COUNTSTACK_IN_AA(S, X) → U2_AA(S, X, pop_in_ag(S, nil))
U2_AA(S, X, pop_out_ag(S, nil)) → U3_AA(S, X, popped_in_aa(S, Pd))
U3_AA(S, X, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(Pd, X)
COUNTSTACK_IN_AA(S, s(X)) → U5_AA(S, X, pop_in_aa(S, P))
U5_AA(S, X, pop_out_aa(S, P)) → U6_AA(S, X, P, head_in_aa(P, H))
U6_AA(S, X, P, head_out_aa(P, H)) → U7_AA(S, X, P, H, tail_in_aa(P, T))
U7_AA(S, X, P, H, tail_out_aa(P, T)) → U8_AA(S, X, P, H, T, popped_in_aa(S, Pd))
U8_AA(S, X, P, H, T, popped_out_aa(S, Pd)) → COUNTSTACK_IN_AA(push(H, push(T, Pd)), X)

The TRS R consists of the following rules:

pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)

The argument filtering Pi contains the following mapping:
empty  =  empty
push(x1, x2)  =  push(x1, x2)
nil  =  nil
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
s(x1)  =  s(x1)
COUNTSTACK_IN_AA(x1, x2)  =  COUNTSTACK_IN_AA
U2_AA(x1, x2, x3)  =  U2_AA(x3)
U3_AA(x1, x2, x3)  =  U3_AA(x3)
U5_AA(x1, x2, x3)  =  U5_AA(x3)
U6_AA(x1, x2, x3, x4)  =  U6_AA(x4)
U7_AA(x1, x2, x3, x4, x5)  =  U7_AA(x5)
U8_AA(x1, x2, x3, x4, x5, x6)  =  U8_AA(x6)

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

(80) PiDPToQDPProof (SOUND transformation)

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

(81) Obligation:

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

COUNTSTACK_IN_AAU2_AA(pop_in_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA

The TRS R consists of the following rules:

pop_in_ag(X1) → pop_out_ag(X1)
popped_in_aapopped_out_aa
pop_in_aapop_out_aa
head_in_aahead_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(82) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule COUNTSTACK_IN_AAU2_AA(pop_in_ag(nil)) at position [0] we obtained the following new rules [LPAR04]:

COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))

(83) Obligation:

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

U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))

The TRS R consists of the following rules:

pop_in_ag(X1) → pop_out_ag(X1)
popped_in_aapopped_out_aa
pop_in_aapop_out_aa
head_in_aahead_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(84) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(85) Obligation:

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

U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(86) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

pop_in_ag(x0)

(87) Obligation:

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

U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(88) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)

(89) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU5_AA(pop_in_aa)
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(90) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule COUNTSTACK_IN_AAU5_AA(pop_in_aa) at position [0] we obtained the following new rules [LPAR04]:

COUNTSTACK_IN_AAU5_AA(pop_out_aa)

(91) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa
pop_in_aapop_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(92) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(93) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa

The set Q consists of the following terms:

popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa

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

(94) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

pop_in_aa

(95) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U5_AA(pop_out_aa) → U6_AA(head_in_aa)
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa

The set Q consists of the following terms:

popped_in_aa
head_in_aa
tail_in_aa

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

(96) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U5_AA(pop_out_aa) → U6_AA(head_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U5_AA(pop_out_aa) → U6_AA(head_out_aa)

(97) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa
head_in_aahead_out_aa

The set Q consists of the following terms:

popped_in_aa
head_in_aa
tail_in_aa

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

(98) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(99) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

popped_in_aa
head_in_aa
tail_in_aa

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

(100) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

head_in_aa

(101) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U6_AA(head_out_aa) → U7_AA(tail_in_aa)
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

popped_in_aa
tail_in_aa

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

(102) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U6_AA(head_out_aa) → U7_AA(tail_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U6_AA(head_out_aa) → U7_AA(tail_out_aa)

(103) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa
tail_in_aatail_out_aa

The set Q consists of the following terms:

popped_in_aa
tail_in_aa

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

(104) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(105) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa

The set Q consists of the following terms:

popped_in_aa
tail_in_aa

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

(106) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

tail_in_aa

(107) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U7_AA(tail_out_aa) → U8_AA(popped_in_aa)
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa

The set Q consists of the following terms:

popped_in_aa

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

(108) Rewriting (EQUIVALENT transformation)

By rewriting [LPAR04] the rule U7_AA(tail_out_aa) → U8_AA(popped_in_aa) at position [0] we obtained the following new rules [LPAR04]:

U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

(109) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

The TRS R consists of the following rules:

popped_in_aapopped_out_aa

The set Q consists of the following terms:

popped_in_aa

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

(110) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(111) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

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

popped_in_aa

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

(112) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

popped_in_aa

(113) Obligation:

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

U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AAU5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)

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

(114) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

s = COUNTSTACK_IN_AA evaluates to t =COUNTSTACK_IN_AA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Semiunifier: [ ]
  • Matcher: [ ]




Rewriting sequence

COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil))
with rule COUNTSTACK_IN_AAU2_AA(pop_out_ag(nil)) at position [] and matcher [ ]

U2_AA(pop_out_ag(nil))U3_AA(popped_out_aa)
with rule U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa) at position [] and matcher [ ]

U3_AA(popped_out_aa)COUNTSTACK_IN_AA
with rule U3_AA(popped_out_aa) → COUNTSTACK_IN_AA

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.



(115) FALSE

(116) Obligation:

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

COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)

The TRS R consists of the following rules:

countstack_in_ga(empty, X) → U1_ga(X, eq_in_ag(X, 0))
eq_in_ag(X, X) → eq_out_ag(X, X)
U1_ga(X, eq_out_ag(X, 0)) → countstack_out_ga(empty, X)
countstack_in_ga(S, X) → U2_ga(S, X, pop_in_gg(S, nil))
pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
U2_ga(S, X, pop_out_gg(S, nil)) → U3_ga(S, X, popped_in_ga(S, Pd))
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)
U3_ga(S, X, popped_out_ga(S, Pd)) → U4_ga(S, X, countstack_in_ga(Pd, X))
countstack_in_ga(S, s(X)) → U5_ga(S, X, pop_in_ga(S, P))
pop_in_ga(empty, X1) → pop_out_ga(empty, X1)
pop_in_ga(push(P, X2), P) → pop_out_ga(push(P, X2), P)
U5_ga(S, X, pop_out_ga(S, P)) → U6_ga(S, X, P, head_in_aa(P, H))
head_in_aa(nil, X4) → head_out_aa(nil, X4)
head_in_aa(cons(H, X5), H) → head_out_aa(cons(H, X5), H)
U6_ga(S, X, P, head_out_aa(P, H)) → U7_ga(S, X, P, H, tail_in_aa(P, T))
tail_in_aa(nil, nil) → tail_out_aa(nil, nil)
tail_in_aa(cons(X6, T), T) → tail_out_aa(cons(X6, T), T)
U7_ga(S, X, P, H, tail_out_aa(P, T)) → U8_ga(S, X, P, H, T, popped_in_ga(S, Pd))
U8_ga(S, X, P, H, T, popped_out_ga(S, Pd)) → U9_ga(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
countstack_in_aa(empty, X) → U1_aa(X, eq_in_ag(X, 0))
U1_aa(X, eq_out_ag(X, 0)) → countstack_out_aa(empty, X)
countstack_in_aa(S, X) → U2_aa(S, X, pop_in_ag(S, nil))
pop_in_ag(empty, X1) → pop_out_ag(empty, X1)
pop_in_ag(push(P, X2), P) → pop_out_ag(push(P, X2), P)
U2_aa(S, X, pop_out_ag(S, nil)) → U3_aa(S, X, popped_in_aa(S, Pd))
popped_in_aa(empty, empty) → popped_out_aa(empty, empty)
popped_in_aa(push(X3, Pd), Pd) → popped_out_aa(push(X3, Pd), Pd)
U3_aa(S, X, popped_out_aa(S, Pd)) → U4_aa(S, X, countstack_in_aa(Pd, X))
countstack_in_aa(S, s(X)) → U5_aa(S, X, pop_in_aa(S, P))
pop_in_aa(empty, X1) → pop_out_aa(empty, X1)
pop_in_aa(push(P, X2), P) → pop_out_aa(push(P, X2), P)
U5_aa(S, X, pop_out_aa(S, P)) → U6_aa(S, X, P, head_in_aa(P, H))
U6_aa(S, X, P, head_out_aa(P, H)) → U7_aa(S, X, P, H, tail_in_aa(P, T))
U7_aa(S, X, P, H, tail_out_aa(P, T)) → U8_aa(S, X, P, H, T, popped_in_aa(S, Pd))
U8_aa(S, X, P, H, T, popped_out_aa(S, Pd)) → U9_aa(S, X, countstack_in_aa(push(H, push(T, Pd)), X))
U9_aa(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_aa(S, s(X))
U4_aa(S, X, countstack_out_aa(Pd, X)) → countstack_out_aa(S, X)
U9_ga(S, X, countstack_out_aa(push(H, push(T, Pd)), X)) → countstack_out_ga(S, s(X))
U4_ga(S, X, countstack_out_ga(Pd, X)) → countstack_out_ga(S, X)

The argument filtering Pi contains the following mapping:
countstack_in_ga(x1, x2)  =  countstack_in_ga(x1)
empty  =  empty
U1_ga(x1, x2)  =  U1_ga(x2)
eq_in_ag(x1, x2)  =  eq_in_ag(x2)
eq_out_ag(x1, x2)  =  eq_out_ag(x1, x2)
0  =  0
countstack_out_ga(x1, x2)  =  countstack_out_ga(x1, x2)
U2_ga(x1, x2, x3)  =  U2_ga(x1, x3)
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
U3_ga(x1, x2, x3)  =  U3_ga(x1, x3)
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
U4_ga(x1, x2, x3)  =  U4_ga(x1, x3)
U5_ga(x1, x2, x3)  =  U5_ga(x1, x3)
pop_in_ga(x1, x2)  =  pop_in_ga(x1)
pop_out_ga(x1, x2)  =  pop_out_ga(x1)
U6_ga(x1, x2, x3, x4)  =  U6_ga(x1, x4)
head_in_aa(x1, x2)  =  head_in_aa
head_out_aa(x1, x2)  =  head_out_aa
U7_ga(x1, x2, x3, x4, x5)  =  U7_ga(x1, x5)
tail_in_aa(x1, x2)  =  tail_in_aa
tail_out_aa(x1, x2)  =  tail_out_aa
U8_ga(x1, x2, x3, x4, x5, x6)  =  U8_ga(x1, x6)
U9_ga(x1, x2, x3)  =  U9_ga(x1, x3)
countstack_in_aa(x1, x2)  =  countstack_in_aa
U1_aa(x1, x2)  =  U1_aa(x2)
countstack_out_aa(x1, x2)  =  countstack_out_aa(x2)
U2_aa(x1, x2, x3)  =  U2_aa(x3)
pop_in_ag(x1, x2)  =  pop_in_ag(x2)
pop_out_ag(x1, x2)  =  pop_out_ag(x2)
U3_aa(x1, x2, x3)  =  U3_aa(x3)
popped_in_aa(x1, x2)  =  popped_in_aa
popped_out_aa(x1, x2)  =  popped_out_aa
U4_aa(x1, x2, x3)  =  U4_aa(x3)
U5_aa(x1, x2, x3)  =  U5_aa(x3)
pop_in_aa(x1, x2)  =  pop_in_aa
pop_out_aa(x1, x2)  =  pop_out_aa
U6_aa(x1, x2, x3, x4)  =  U6_aa(x4)
U7_aa(x1, x2, x3, x4, x5)  =  U7_aa(x5)
U8_aa(x1, x2, x3, x4, x5, x6)  =  U8_aa(x6)
U9_aa(x1, x2, x3)  =  U9_aa(x3)
s(x1)  =  s(x1)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
U3_GA(x1, x2, x3)  =  U3_GA(x1, x3)

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

(117) UsableRulesProof (EQUIVALENT transformation)

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

(118) Obligation:

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

COUNTSTACK_IN_GA(S, X) → U2_GA(S, X, pop_in_gg(S, nil))
U2_GA(S, X, pop_out_gg(S, nil)) → U3_GA(S, X, popped_in_ga(S, Pd))
U3_GA(S, X, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd, X)

The TRS R consists of the following rules:

pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
popped_in_ga(empty, empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd), Pd) → popped_out_ga(push(X3, Pd), Pd)

The argument filtering Pi contains the following mapping:
empty  =  empty
pop_in_gg(x1, x2)  =  pop_in_gg(x1, x2)
pop_out_gg(x1, x2)  =  pop_out_gg(x1, x2)
push(x1, x2)  =  push(x1, x2)
nil  =  nil
popped_in_ga(x1, x2)  =  popped_in_ga(x1)
popped_out_ga(x1, x2)  =  popped_out_ga(x1, x2)
COUNTSTACK_IN_GA(x1, x2)  =  COUNTSTACK_IN_GA(x1)
U2_GA(x1, x2, x3)  =  U2_GA(x1, x3)
U3_GA(x1, x2, x3)  =  U3_GA(x1, x3)

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

(119) PiDPToQDPProof (SOUND transformation)

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

(120) Obligation:

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

COUNTSTACK_IN_GA(S) → U2_GA(S, pop_in_gg(S, nil))
U2_GA(S, pop_out_gg(S, nil)) → U3_GA(S, popped_in_ga(S))
U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)

The TRS R consists of the following rules:

pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

(121) Narrowing (SOUND transformation)

By narrowing [LPAR04] the rule COUNTSTACK_IN_GA(S) → U2_GA(S, pop_in_gg(S, nil)) at position [1] we obtained the following new rules [LPAR04]:

COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))

(122) Obligation:

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

U2_GA(S, pop_out_gg(S, nil)) → U3_GA(S, popped_in_ga(S))
U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))

The TRS R consists of the following rules:

pop_in_gg(empty, X1) → pop_out_gg(empty, X1)
pop_in_gg(push(P, X2), P) → pop_out_gg(push(P, X2), P)
popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

(123) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(124) Obligation:

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

U2_GA(S, pop_out_gg(S, nil)) → U3_GA(S, popped_in_ga(S))
U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)

The set Q consists of the following terms:

pop_in_gg(x0, x1)
popped_in_ga(x0)

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

(125) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

pop_in_gg(x0, x1)

(126) Obligation:

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

U2_GA(S, pop_out_gg(S, nil)) → U3_GA(S, popped_in_ga(S))
U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)

The set Q consists of the following terms:

popped_in_ga(x0)

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

(127) Narrowing (SOUND transformation)

By narrowing [LPAR04] the rule U2_GA(S, pop_out_gg(S, nil)) → U3_GA(S, popped_in_ga(S)) at position [1] we obtained the following new rules [LPAR04]:

U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U2_GA(push(x0, x1), pop_out_gg(push(x0, x1), nil)) → U3_GA(push(x0, x1), popped_out_ga(push(x0, x1), x1))

(128) Obligation:

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

U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U2_GA(push(x0, x1), pop_out_gg(push(x0, x1), nil)) → U3_GA(push(x0, x1), popped_out_ga(push(x0, x1), x1))

The TRS R consists of the following rules:

popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)

The set Q consists of the following terms:

popped_in_ga(x0)

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

(129) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(130) Obligation:

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

U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U2_GA(push(x0, x1), pop_out_gg(push(x0, x1), nil)) → U3_GA(push(x0, x1), popped_out_ga(push(x0, x1), x1))

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

popped_in_ga(x0)

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

(131) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

popped_in_ga(x0)

(132) Obligation:

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

U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U2_GA(push(x0, x1), pop_out_gg(push(x0, x1), nil)) → U3_GA(push(x0, x1), popped_out_ga(push(x0, x1), x1))

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

(133) Instantiation (EQUIVALENT transformation)

By instantiating [LPAR04] the rule U2_GA(push(x0, x1), pop_out_gg(push(x0, x1), nil)) → U3_GA(push(x0, x1), popped_out_ga(push(x0, x1), x1)) we obtained the following new rules [LPAR04]:

U2_GA(push(nil, z0), pop_out_gg(push(nil, z0), nil)) → U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0))

(134) Obligation:

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

U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U2_GA(push(nil, z0), pop_out_gg(push(nil, z0), nil)) → U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0))

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

(135) Instantiation (EQUIVALENT transformation)

By instantiating [LPAR04] the rule U3_GA(S, popped_out_ga(S, Pd)) → COUNTSTACK_IN_GA(Pd) we obtained the following new rules [LPAR04]:

U3_GA(empty, popped_out_ga(empty, empty)) → COUNTSTACK_IN_GA(empty)
U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0)) → COUNTSTACK_IN_GA(z0)

(136) Obligation:

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

COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))
COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U2_GA(push(nil, z0), pop_out_gg(push(nil, z0), nil)) → U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0))
U3_GA(empty, popped_out_ga(empty, empty)) → COUNTSTACK_IN_GA(empty)
U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0)) → COUNTSTACK_IN_GA(z0)

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

(137) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 2 SCCs.

(138) Complex Obligation (AND)

(139) Obligation:

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

U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))
U3_GA(empty, popped_out_ga(empty, empty)) → COUNTSTACK_IN_GA(empty)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil))

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

(140) NonTerminationProof (EQUIVALENT transformation)

We used the non-termination processor [FROCOS05] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

s = U3_GA(empty, popped_out_ga(empty, empty)) evaluates to t =U3_GA(empty, popped_out_ga(empty, empty))

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:
  • Semiunifier: [ ]
  • Matcher: [ ]




Rewriting sequence

U3_GA(empty, popped_out_ga(empty, empty))COUNTSTACK_IN_GA(empty)
with rule U3_GA(empty, popped_out_ga(empty, empty)) → COUNTSTACK_IN_GA(empty) at position [] and matcher [ ]

COUNTSTACK_IN_GA(empty)U2_GA(empty, pop_out_gg(empty, nil))
with rule COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg(empty, nil)) at position [] and matcher [ ]

U2_GA(empty, pop_out_gg(empty, nil))U3_GA(empty, popped_out_ga(empty, empty))
with rule U2_GA(empty, pop_out_gg(empty, nil)) → U3_GA(empty, popped_out_ga(empty, empty))

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.



(141) FALSE

(142) Obligation:

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

COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
U2_GA(push(nil, z0), pop_out_gg(push(nil, z0), nil)) → U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0))
U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0)) → COUNTSTACK_IN_GA(z0)

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

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

  • U2_GA(push(nil, z0), pop_out_gg(push(nil, z0), nil)) → U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0))
    The graph contains the following edges 1 >= 1, 2 > 1

  • U3_GA(push(nil, z0), popped_out_ga(push(nil, z0), z0)) → COUNTSTACK_IN_GA(z0)
    The graph contains the following edges 1 > 1, 2 > 1

  • COUNTSTACK_IN_GA(push(nil, x1)) → U2_GA(push(nil, x1), pop_out_gg(push(nil, x1), nil))
    The graph contains the following edges 1 >= 1

(144) TRUE