0 Prolog
↳1 CutEliminatorProof (⇐)
↳2 Prolog
↳3 PrologToPiTRSProof (⇐)
↳4 PiTRS
↳5 DependencyPairsProof (⇔)
↳6 PiDP
↳7 DependencyGraphProof (⇔)
↳8 AND
↳9 PiDP
↳10 UsableRulesProof (⇔)
↳11 PiDP
↳12 PiDPToQDPProof (⇐)
↳13 QDP
↳14 Rewriting (⇔)
↳15 QDP
↳16 UsableRulesProof (⇔)
↳17 QDP
↳18 QReductionProof (⇔)
↳19 QDP
↳20 Rewriting (⇔)
↳21 QDP
↳22 Rewriting (⇔)
↳23 QDP
↳24 UsableRulesProof (⇔)
↳25 QDP
↳26 QReductionProof (⇔)
↳27 QDP
↳28 Rewriting (⇔)
↳29 QDP
↳30 UsableRulesProof (⇔)
↳31 QDP
↳32 QReductionProof (⇔)
↳33 QDP
↳34 Rewriting (⇔)
↳35 QDP
↳36 UsableRulesProof (⇔)
↳37 QDP
↳38 QReductionProof (⇔)
↳39 QDP
↳40 Rewriting (⇔)
↳41 QDP
↳42 UsableRulesProof (⇔)
↳43 QDP
↳44 QReductionProof (⇔)
↳45 QDP
↳46 NonTerminationProof (⇔)
↳47 FALSE
↳48 PiDP
↳49 UsableRulesProof (⇔)
↳50 PiDP
↳51 PiDPToQDPProof (⇐)
↳52 QDP
↳53 UsableRulesReductionPairsProof (⇔)
↳54 QDP
↳55 Narrowing (⇐)
↳56 QDP
↳57 UsableRulesProof (⇔)
↳58 QDP
↳59 QReductionProof (⇔)
↳60 QDP
↳61 Narrowing (⇐)
↳62 QDP
↳63 UsableRulesProof (⇔)
↳64 QDP
↳65 QReductionProof (⇔)
↳66 QDP
↳67 Instantiation (⇔)
↳68 QDP
↳69 NonTerminationProof (⇔)
↳70 FALSE
↳71 PrologToPiTRSProof (⇐)
↳72 PiTRS
↳73 DependencyPairsProof (⇔)
↳74 PiDP
↳75 DependencyGraphProof (⇔)
↳76 AND
↳77 PiDP
↳78 UsableRulesProof (⇔)
↳79 PiDP
↳80 PiDPToQDPProof (⇐)
↳81 QDP
↳82 Rewriting (⇔)
↳83 QDP
↳84 UsableRulesProof (⇔)
↳85 QDP
↳86 QReductionProof (⇔)
↳87 QDP
↳88 Rewriting (⇔)
↳89 QDP
↳90 Rewriting (⇔)
↳91 QDP
↳92 UsableRulesProof (⇔)
↳93 QDP
↳94 QReductionProof (⇔)
↳95 QDP
↳96 Rewriting (⇔)
↳97 QDP
↳98 UsableRulesProof (⇔)
↳99 QDP
↳100 QReductionProof (⇔)
↳101 QDP
↳102 Rewriting (⇔)
↳103 QDP
↳104 UsableRulesProof (⇔)
↳105 QDP
↳106 QReductionProof (⇔)
↳107 QDP
↳108 Rewriting (⇔)
↳109 QDP
↳110 UsableRulesProof (⇔)
↳111 QDP
↳112 QReductionProof (⇔)
↳113 QDP
↳114 NonTerminationProof (⇔)
↳115 FALSE
↳116 PiDP
↳117 UsableRulesProof (⇔)
↳118 PiDP
↳119 PiDPToQDPProof (⇐)
↳120 QDP
↳121 Narrowing (⇐)
↳122 QDP
↳123 UsableRulesProof (⇔)
↳124 QDP
↳125 QReductionProof (⇔)
↳126 QDP
↳127 Narrowing (⇐)
↳128 QDP
↳129 UsableRulesProof (⇔)
↳130 QDP
↳131 QReductionProof (⇔)
↳132 QDP
↳133 Instantiation (⇔)
↳134 QDP
↳135 Instantiation (⇔)
↳136 QDP
↳137 DependencyGraphProof (⇔)
↳138 AND
↳139 QDP
↳140 NonTerminationProof (⇔)
↳141 FALSE
↳142 QDP
↳143 QDPSizeChangeProof (⇔)
↳144 TRUE
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)
Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog
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)
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)
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)
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)
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)
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)
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)
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)
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)
COUNTSTACK_IN_AA → U2_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_AA → U5_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
pop_in_ag(X1) → pop_out_ag
popped_in_aa → popped_out_aa
pop_in_aa → pop_out_aa
head_in_aa → head_out_aa
tail_in_aa → tail_out_aa
pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
COUNTSTACK_IN_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag)
pop_in_ag(X1) → pop_out_ag
popped_in_aa → popped_out_aa
pop_in_aa → pop_out_aa
head_in_aa → head_out_aa
tail_in_aa → tail_out_aa
pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
pop_in_ag(x0)
U2_AA(pop_out_ag) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
pop_in_aa
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
popped_in_aa
head_in_aa
tail_in_aa
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
popped_in_aa
head_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
popped_in_aa
head_in_aa
tail_in_aa
head_in_aa
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
popped_in_aa
tail_in_aa
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
popped_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
popped_in_aa → popped_out_aa
popped_in_aa
tail_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
popped_in_aa → popped_out_aa
popped_in_aa
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_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)
popped_in_aa → popped_out_aa
popped_in_aa
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_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)
popped_in_aa
popped_in_aa
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U2_AA(pop_out_ag)
U2_AA(pop_out_ag) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_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)
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)
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)
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)
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)
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)
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)
pop_in_gg(x0, x1)
popped_in_ga(x0)
Used ordering: POLO with Polynomial interpretation [POLO]:
popped_in_ga(push(X3, Pd)) → popped_out_ga(Pd)
pop_in_gg(push(P, X2), P) → pop_out_gg
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
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)
popped_in_ga(empty) → popped_out_ga(empty)
pop_in_gg(empty, X1) → pop_out_gg
pop_in_gg(x0, x1)
popped_in_ga(x0)
COUNTSTACK_IN_GA(empty) → U2_GA(empty, pop_out_gg)
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)
popped_in_ga(empty) → popped_out_ga(empty)
pop_in_gg(empty, X1) → pop_out_gg
pop_in_gg(x0, x1)
popped_in_ga(x0)
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)
popped_in_ga(empty) → popped_out_ga(empty)
pop_in_gg(x0, x1)
popped_in_ga(x0)
pop_in_gg(x0, x1)
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)
popped_in_ga(empty) → popped_out_ga(empty)
popped_in_ga(x0)
U2_GA(empty, pop_out_gg) → U3_GA(popped_out_ga(empty))
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))
popped_in_ga(empty) → popped_out_ga(empty)
popped_in_ga(x0)
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))
popped_in_ga(x0)
popped_in_ga(x0)
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))
U3_GA(popped_out_ga(empty)) → COUNTSTACK_IN_GA(empty)
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)
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)
Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog
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)
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)
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)
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)
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)
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)
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)
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)
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)
COUNTSTACK_IN_AA → U2_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_AA → U5_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
pop_in_ag(X1) → pop_out_ag(X1)
popped_in_aa → popped_out_aa
pop_in_aa → pop_out_aa
head_in_aa → head_out_aa
tail_in_aa → tail_out_aa
pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
COUNTSTACK_IN_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag(nil))
pop_in_ag(X1) → pop_out_ag(X1)
popped_in_aa → popped_out_aa
pop_in_aa → pop_out_aa
head_in_aa → head_out_aa
tail_in_aa → tail_out_aa
pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag(nil))
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
pop_in_ag(x0)
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
pop_in_ag(x0)
U2_AA(pop_out_ag(nil)) → U3_AA(popped_in_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag(nil))
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U5_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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
pop_in_aa → pop_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
popped_in_aa
pop_in_aa
head_in_aa
tail_in_aa
pop_in_aa
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
popped_in_aa
head_in_aa
tail_in_aa
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
head_in_aa → head_out_aa
popped_in_aa
head_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
popped_in_aa
head_in_aa
tail_in_aa
head_in_aa
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
popped_in_aa
tail_in_aa
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
popped_in_aa → popped_out_aa
tail_in_aa → tail_out_aa
popped_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
popped_in_aa → popped_out_aa
popped_in_aa
tail_in_aa
tail_in_aa
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_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_AA(pop_out_aa)
U5_AA(pop_out_aa) → U6_AA(head_out_aa)
U6_AA(head_out_aa) → U7_AA(tail_out_aa)
popped_in_aa → popped_out_aa
popped_in_aa
U7_AA(tail_out_aa) → U8_AA(popped_out_aa)
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_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)
popped_in_aa → popped_out_aa
popped_in_aa
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_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)
popped_in_aa
popped_in_aa
U3_AA(popped_out_aa) → COUNTSTACK_IN_AA
U8_AA(popped_out_aa) → COUNTSTACK_IN_AA
COUNTSTACK_IN_AA → U2_AA(pop_out_ag(nil))
U2_AA(pop_out_ag(nil)) → U3_AA(popped_out_aa)
COUNTSTACK_IN_AA → U5_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)
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)
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)
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)
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)
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)
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)
pop_in_gg(x0, x1)
popped_in_ga(x0)
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(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))
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)
pop_in_gg(x0, x1)
popped_in_ga(x0)
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))
popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)
pop_in_gg(x0, x1)
popped_in_ga(x0)
pop_in_gg(x0, x1)
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))
popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)
popped_in_ga(x0)
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))
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))
popped_in_ga(empty) → popped_out_ga(empty, empty)
popped_in_ga(push(X3, Pd)) → popped_out_ga(push(X3, Pd), Pd)
popped_in_ga(x0)
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))
popped_in_ga(x0)
popped_in_ga(x0)
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))
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(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))
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)
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)
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))
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)
From the DPs we obtained the following set of size-change graphs: