0 Prolog
↳1 PrologToPiTRSProof (⇐)
↳2 PiTRS
↳3 DependencyPairsProof (⇔)
↳4 PiDP
↳5 DependencyGraphProof (⇔)
↳6 AND
↳7 PiDP
↳8 UsableRulesProof (⇔)
↳9 PiDP
↳10 PiDPToQDPProof (⇔)
↳11 QDP
↳12 QDPSizeChangeProof (⇔)
↳13 TRUE
↳14 PiDP
↳15 UsableRulesProof (⇔)
↳16 PiDP
↳17 PiDPToQDPProof (⇐)
↳18 QDP
↳19 QDPSizeChangeProof (⇔)
↳20 TRUE
↳21 PiDP
↳22 UsableRulesProof (⇔)
↳23 PiDP
↳24 PiDPToQDPProof (⇐)
↳25 QDP
↳26 QDPSizeChangeProof (⇔)
↳27 TRUE
↳28 PiDP
↳29 UsableRulesProof (⇔)
↳30 PiDP
↳31 PiDPToQDPProof (⇐)
↳32 QDP
↳33 QDPSizeChangeProof (⇔)
↳34 TRUE
↳35 PiDP
↳36 UsableRulesProof (⇔)
↳37 PiDP
↳38 PiDPToQDPProof (⇐)
↳39 QDP
↳40 PrologToPiTRSProof (⇐)
↳41 PiTRS
↳42 DependencyPairsProof (⇔)
↳43 PiDP
↳44 DependencyGraphProof (⇔)
↳45 AND
↳46 PiDP
↳47 UsableRulesProof (⇔)
↳48 PiDP
↳49 PiDPToQDPProof (⇔)
↳50 QDP
↳51 QDPSizeChangeProof (⇔)
↳52 TRUE
↳53 PiDP
↳54 UsableRulesProof (⇔)
↳55 PiDP
↳56 PiDPToQDPProof (⇐)
↳57 QDP
↳58 QDPSizeChangeProof (⇔)
↳59 TRUE
↳60 PiDP
↳61 UsableRulesProof (⇔)
↳62 PiDP
↳63 PiDPToQDPProof (⇐)
↳64 QDP
↳65 QDPSizeChangeProof (⇔)
↳66 TRUE
↳67 PiDP
↳68 UsableRulesProof (⇔)
↳69 PiDP
↳70 PiDPToQDPProof (⇐)
↳71 QDP
↳72 QDPSizeChangeProof (⇔)
↳73 TRUE
↳74 PiDP
↳75 UsableRulesProof (⇔)
↳76 PiDP
↳77 PiDPToQDPProof (⇐)
↳78 QDP
↳79 QDPOrderProof (⇔)
↳80 QDP
↳81 DependencyGraphProof (⇔)
↳82 TRUE
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
PRIME_IN_G(s(s(X))) → U4_G(X, pr_in_gg(s(s(X)), s(X)))
PRIME_IN_G(s(s(X))) → PR_IN_GG(s(s(X)), s(X))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
PR_IN_GG(X, s(s(Y))) → NOT_DIVIDES_IN_GG(s(s(Y)), X)
NOT_DIVIDES_IN_GG(Y, X) → U7_GG(Y, X, div_in_gga(X, Y, U))
NOT_DIVIDES_IN_GG(Y, X) → DIV_IN_GGA(X, Y, U)
DIV_IN_GGA(X, Y, Z) → U1_GGA(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
DIV_IN_GGA(X, Y, Z) → QUOT_IN_GGGA(X, Y, Y, Z)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → U2_GGGA(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → U3_GGGA(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
U7_GG(Y, X, div_out_gga(X, Y, U)) → U8_GG(Y, X, times_in_gga(U, Y, Z))
U7_GG(Y, X, div_out_gga(X, Y, U)) → TIMES_IN_GGA(U, Y, Z)
TIMES_IN_GGA(s(X), Y, Z) → U11_GGA(X, Y, Z, times_in_gga(X, Y, U))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → U12_GGA(X, Y, Z, add_in_gga(U, Y, Z))
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → ADD_IN_GGA(U, Y, Z)
ADD_IN_GGA(s(X), Y, s(Z)) → U13_GGA(X, Y, Z, add_in_gga(X, Y, Z))
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
U8_GG(Y, X, times_out_gga(U, Y, Z)) → U9_GG(Y, X, neq_in_gg(X, Z))
U8_GG(Y, X, times_out_gga(U, Y, Z)) → NEQ_IN_GG(X, Z)
NEQ_IN_GG(s(X), s(Y)) → U10_GG(X, Y, neq_in_gg(X, Y))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_GG(X, Y, pr_in_gg(X, s(Y)))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
PRIME_IN_G(s(s(X))) → U4_G(X, pr_in_gg(s(s(X)), s(X)))
PRIME_IN_G(s(s(X))) → PR_IN_GG(s(s(X)), s(X))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
PR_IN_GG(X, s(s(Y))) → NOT_DIVIDES_IN_GG(s(s(Y)), X)
NOT_DIVIDES_IN_GG(Y, X) → U7_GG(Y, X, div_in_gga(X, Y, U))
NOT_DIVIDES_IN_GG(Y, X) → DIV_IN_GGA(X, Y, U)
DIV_IN_GGA(X, Y, Z) → U1_GGA(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
DIV_IN_GGA(X, Y, Z) → QUOT_IN_GGGA(X, Y, Y, Z)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → U2_GGGA(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → U3_GGGA(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
U7_GG(Y, X, div_out_gga(X, Y, U)) → U8_GG(Y, X, times_in_gga(U, Y, Z))
U7_GG(Y, X, div_out_gga(X, Y, U)) → TIMES_IN_GGA(U, Y, Z)
TIMES_IN_GGA(s(X), Y, Z) → U11_GGA(X, Y, Z, times_in_gga(X, Y, U))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → U12_GGA(X, Y, Z, add_in_gga(U, Y, Z))
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → ADD_IN_GGA(U, Y, Z)
ADD_IN_GGA(s(X), Y, s(Z)) → U13_GGA(X, Y, Z, add_in_gga(X, Y, Z))
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
U8_GG(Y, X, times_out_gga(U, Y, Z)) → U9_GG(Y, X, neq_in_gg(X, Z))
U8_GG(Y, X, times_out_gga(U, Y, Z)) → NEQ_IN_GG(X, Z)
NEQ_IN_GG(s(X), s(Y)) → U10_GG(X, Y, neq_in_gg(X, Y))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_GG(X, Y, pr_in_gg(X, s(Y)))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
From the DPs we obtained the following set of size-change graphs:
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
ADD_IN_GGA(s(X), Y) → ADD_IN_GGA(X, Y)
From the DPs we obtained the following set of size-change graphs:
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
TIMES_IN_GGA(s(X), Y) → TIMES_IN_GGA(X, Y)
From the DPs we obtained the following set of size-change graphs:
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
QUOT_IN_GGGA(X, 0, s(Z)) → QUOT_IN_GGGA(X, s(Z), s(Z))
QUOT_IN_GGGA(s(X), s(Y), Z) → QUOT_IN_GGGA(X, Y, Z)
From the DPs we obtained the following set of size-change graphs:
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y))
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y))
div_in_gga(X, Y) → U1_gga(X, Y, quot_in_ggga(X, Y, Y))
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
U1_gga(X, Y, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
times_in_gga(0, Y) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y) → U11_gga(X, Y, times_in_gga(X, Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
quot_in_ggga(0, s(Y), s(Z)) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z) → U2_ggga(X, Y, Z, quot_in_ggga(X, Y, Z))
quot_in_ggga(X, 0, s(Z)) → U3_ggga(X, Z, quot_in_ggga(X, s(Z), s(Z)))
U11_gga(X, Y, times_out_gga(X, Y, U)) → U12_gga(X, Y, add_in_gga(U, Y))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U2_ggga(X, Y, Z, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U3_ggga(X, Z, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U12_gga(X, Y, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
add_in_gga(X, 0) → add_out_gga(X, 0, X)
add_in_gga(0, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y) → U13_gga(X, Y, add_in_gga(X, Y))
U13_gga(X, Y, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
not_divides_in_gg(x0, x1)
U7_gg(x0, x1, x2)
div_in_gga(x0, x1)
U8_gg(x0, x1, x2)
U1_gga(x0, x1, x2)
times_in_gga(x0, x1)
U9_gg(x0, x1, x2)
quot_in_ggga(x0, x1, x2)
U11_gga(x0, x1, x2)
neq_in_gg(x0, x1)
U2_ggga(x0, x1, x2, x3)
U3_ggga(x0, x1, x2)
U12_gga(x0, x1, x2)
U10_gg(x0, x1, x2)
add_in_gga(x0, x1)
U13_gga(x0, x1, x2)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
PRIME_IN_G(s(s(X))) → U4_G(X, pr_in_gg(s(s(X)), s(X)))
PRIME_IN_G(s(s(X))) → PR_IN_GG(s(s(X)), s(X))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
PR_IN_GG(X, s(s(Y))) → NOT_DIVIDES_IN_GG(s(s(Y)), X)
NOT_DIVIDES_IN_GG(Y, X) → U7_GG(Y, X, div_in_gga(X, Y, U))
NOT_DIVIDES_IN_GG(Y, X) → DIV_IN_GGA(X, Y, U)
DIV_IN_GGA(X, Y, Z) → U1_GGA(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
DIV_IN_GGA(X, Y, Z) → QUOT_IN_GGGA(X, Y, Y, Z)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → U2_GGGA(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → U3_GGGA(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
U7_GG(Y, X, div_out_gga(X, Y, U)) → U8_GG(Y, X, times_in_gga(U, Y, Z))
U7_GG(Y, X, div_out_gga(X, Y, U)) → TIMES_IN_GGA(U, Y, Z)
TIMES_IN_GGA(s(X), Y, Z) → U11_GGA(X, Y, Z, times_in_gga(X, Y, U))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → U12_GGA(X, Y, Z, add_in_gga(U, Y, Z))
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → ADD_IN_GGA(U, Y, Z)
ADD_IN_GGA(s(X), Y, s(Z)) → U13_GGA(X, Y, Z, add_in_gga(X, Y, Z))
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
U8_GG(Y, X, times_out_gga(U, Y, Z)) → U9_GG(Y, X, neq_in_gg(X, Z))
U8_GG(Y, X, times_out_gga(U, Y, Z)) → NEQ_IN_GG(X, Z)
NEQ_IN_GG(s(X), s(Y)) → U10_GG(X, Y, neq_in_gg(X, Y))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_GG(X, Y, pr_in_gg(X, s(Y)))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
PRIME_IN_G(s(s(X))) → U4_G(X, pr_in_gg(s(s(X)), s(X)))
PRIME_IN_G(s(s(X))) → PR_IN_GG(s(s(X)), s(X))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
PR_IN_GG(X, s(s(Y))) → NOT_DIVIDES_IN_GG(s(s(Y)), X)
NOT_DIVIDES_IN_GG(Y, X) → U7_GG(Y, X, div_in_gga(X, Y, U))
NOT_DIVIDES_IN_GG(Y, X) → DIV_IN_GGA(X, Y, U)
DIV_IN_GGA(X, Y, Z) → U1_GGA(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
DIV_IN_GGA(X, Y, Z) → QUOT_IN_GGGA(X, Y, Y, Z)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → U2_GGGA(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → U3_GGGA(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
U7_GG(Y, X, div_out_gga(X, Y, U)) → U8_GG(Y, X, times_in_gga(U, Y, Z))
U7_GG(Y, X, div_out_gga(X, Y, U)) → TIMES_IN_GGA(U, Y, Z)
TIMES_IN_GGA(s(X), Y, Z) → U11_GGA(X, Y, Z, times_in_gga(X, Y, U))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → U12_GGA(X, Y, Z, add_in_gga(U, Y, Z))
U11_GGA(X, Y, Z, times_out_gga(X, Y, U)) → ADD_IN_GGA(U, Y, Z)
ADD_IN_GGA(s(X), Y, s(Z)) → U13_GGA(X, Y, Z, add_in_gga(X, Y, Z))
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
U8_GG(Y, X, times_out_gga(U, Y, Z)) → U9_GG(Y, X, neq_in_gg(X, Z))
U8_GG(Y, X, times_out_gga(U, Y, Z)) → NEQ_IN_GG(X, Z)
NEQ_IN_GG(s(X), s(Y)) → U10_GG(X, Y, neq_in_gg(X, Y))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_GG(X, Y, pr_in_gg(X, s(Y)))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
NEQ_IN_GG(s(X), s(Y)) → NEQ_IN_GG(X, Y)
From the DPs we obtained the following set of size-change graphs:
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
ADD_IN_GGA(s(X), Y, s(Z)) → ADD_IN_GGA(X, Y, Z)
ADD_IN_GGA(s(X), Y) → ADD_IN_GGA(X, Y)
From the DPs we obtained the following set of size-change graphs:
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, U)
TIMES_IN_GGA(s(X), Y) → TIMES_IN_GGA(X, Y)
From the DPs we obtained the following set of size-change graphs:
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
QUOT_IN_GGGA(X, 0, s(Z), s(U)) → QUOT_IN_GGGA(X, s(Z), s(Z), U)
QUOT_IN_GGGA(s(X), s(Y), Z, U) → QUOT_IN_GGGA(X, Y, Z, U)
QUOT_IN_GGGA(X, 0, s(Z)) → QUOT_IN_GGGA(X, s(Z), s(Z))
QUOT_IN_GGGA(s(X), s(Y), Z) → QUOT_IN_GGGA(X, Y, Z)
From the DPs we obtained the following set of size-change graphs:
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
prime_in_g(s(s(X))) → U4_g(X, pr_in_gg(s(s(X)), s(X)))
pr_in_gg(X, s(0)) → pr_out_gg(X, s(0))
pr_in_gg(X, s(s(Y))) → U5_gg(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
U5_gg(X, Y, not_divides_out_gg(s(s(Y)), X)) → U6_gg(X, Y, pr_in_gg(X, s(Y)))
U6_gg(X, Y, pr_out_gg(X, s(Y))) → pr_out_gg(X, s(s(Y)))
U4_g(X, pr_out_gg(s(s(X)), s(X))) → prime_out_g(s(s(X)))
U5_GG(X, Y, not_divides_out_gg(s(s(Y)), X)) → PR_IN_GG(X, s(Y))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y, U))
U7_gg(Y, X, div_out_gga(X, Y, U)) → U8_gg(Y, X, times_in_gga(U, Y, Z))
div_in_gga(X, Y, Z) → U1_gga(X, Y, Z, quot_in_ggga(X, Y, Y, Z))
U8_gg(Y, X, times_out_gga(U, Y, Z)) → U9_gg(Y, X, neq_in_gg(X, Z))
U1_gga(X, Y, Z, quot_out_ggga(X, Y, Y, Z)) → div_out_gga(X, Y, Z)
times_in_gga(0, Y, 0) → times_out_gga(0, Y, 0)
times_in_gga(s(X), Y, Z) → U11_gga(X, Y, Z, times_in_gga(X, Y, U))
U9_gg(Y, X, neq_out_gg(X, Z)) → not_divides_out_gg(Y, X)
quot_in_ggga(0, s(Y), s(Z), 0) → quot_out_ggga(0, s(Y), s(Z), 0)
quot_in_ggga(s(X), s(Y), Z, U) → U2_ggga(X, Y, Z, U, quot_in_ggga(X, Y, Z, U))
quot_in_ggga(X, 0, s(Z), s(U)) → U3_ggga(X, Z, U, quot_in_ggga(X, s(Z), s(Z), U))
U11_gga(X, Y, Z, times_out_gga(X, Y, U)) → U12_gga(X, Y, Z, add_in_gga(U, Y, Z))
neq_in_gg(s(X), 0) → neq_out_gg(s(X), 0)
neq_in_gg(0, s(X)) → neq_out_gg(0, s(X))
neq_in_gg(s(X), s(Y)) → U10_gg(X, Y, neq_in_gg(X, Y))
U2_ggga(X, Y, Z, U, quot_out_ggga(X, Y, Z, U)) → quot_out_ggga(s(X), s(Y), Z, U)
U3_ggga(X, Z, U, quot_out_ggga(X, s(Z), s(Z), U)) → quot_out_ggga(X, 0, s(Z), s(U))
U12_gga(X, Y, Z, add_out_gga(U, Y, Z)) → times_out_gga(s(X), Y, Z)
U10_gg(X, Y, neq_out_gg(X, Y)) → neq_out_gg(s(X), s(Y))
add_in_gga(X, 0, X) → add_out_gga(X, 0, X)
add_in_gga(0, X, X) → add_out_gga(0, X, X)
add_in_gga(s(X), Y, s(Z)) → U13_gga(X, Y, Z, add_in_gga(X, Y, Z))
U13_gga(X, Y, Z, add_out_gga(X, Y, Z)) → add_out_gga(s(X), Y, s(Z))
U5_GG(X, Y, not_divides_out_gg) → PR_IN_GG(X, s(Y))
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y))
U7_gg(Y, X, div_out_gga(U)) → U8_gg(X, times_in_gga(U, Y))
div_in_gga(X, Y) → U1_gga(quot_in_ggga(X, Y, Y))
U8_gg(X, times_out_gga(Z)) → U9_gg(neq_in_gg(X, Z))
U1_gga(quot_out_ggga(Z)) → div_out_gga(Z)
times_in_gga(0, Y) → times_out_gga(0)
times_in_gga(s(X), Y) → U11_gga(Y, times_in_gga(X, Y))
U9_gg(neq_out_gg) → not_divides_out_gg
quot_in_ggga(0, s(Y), s(Z)) → quot_out_ggga(0)
quot_in_ggga(s(X), s(Y), Z) → U2_ggga(quot_in_ggga(X, Y, Z))
quot_in_ggga(X, 0, s(Z)) → U3_ggga(quot_in_ggga(X, s(Z), s(Z)))
U11_gga(Y, times_out_gga(U)) → U12_gga(add_in_gga(U, Y))
neq_in_gg(s(X), 0) → neq_out_gg
neq_in_gg(0, s(X)) → neq_out_gg
neq_in_gg(s(X), s(Y)) → U10_gg(neq_in_gg(X, Y))
U2_ggga(quot_out_ggga(U)) → quot_out_ggga(U)
U3_ggga(quot_out_ggga(U)) → quot_out_ggga(s(U))
U12_gga(add_out_gga(Z)) → times_out_gga(Z)
U10_gg(neq_out_gg) → neq_out_gg
add_in_gga(X, 0) → add_out_gga(X)
add_in_gga(0, X) → add_out_gga(X)
add_in_gga(s(X), Y) → U13_gga(add_in_gga(X, Y))
U13_gga(add_out_gga(Z)) → add_out_gga(s(Z))
not_divides_in_gg(x0, x1)
U7_gg(x0, x1, x2)
div_in_gga(x0, x1)
U8_gg(x0, x1)
U1_gga(x0)
times_in_gga(x0, x1)
U9_gg(x0)
quot_in_ggga(x0, x1, x2)
U11_gga(x0, x1)
neq_in_gg(x0, x1)
U2_ggga(x0)
U3_ggga(x0)
U12_gga(x0)
U10_gg(x0)
add_in_gga(x0, x1)
U13_gga(x0)
The following pairs can be oriented strictly and are deleted.
The remaining pairs can at least be oriented weakly.
PR_IN_GG(X, s(s(Y))) → U5_GG(X, Y, not_divides_in_gg(s(s(Y)), X))
POL(0) = 1
POL(PR_IN_GG(x1, x2)) = x1 + x2
POL(U10_gg(x1)) = 1 + x1
POL(U11_gga(x1, x2)) = x1
POL(U12_gga(x1)) = 0
POL(U13_gga(x1)) = 0
POL(U1_gga(x1)) = 0
POL(U2_ggga(x1)) = 0
POL(U3_ggga(x1)) = 1
POL(U5_GG(x1, x2, x3)) = 1 + x1 + x2
POL(U7_gg(x1, x2, x3)) = 0
POL(U8_gg(x1, x2)) = 0
POL(U9_gg(x1)) = 0
POL(add_in_gga(x1, x2)) = 0
POL(add_out_gga(x1)) = 0
POL(div_in_gga(x1, x2)) = 1
POL(div_out_gga(x1)) = 0
POL(neq_in_gg(x1, x2)) = x2
POL(neq_out_gg) = 1
POL(not_divides_in_gg(x1, x2)) = 0
POL(not_divides_out_gg) = 0
POL(quot_in_ggga(x1, x2, x3)) = x1 + x2 + x3
POL(quot_out_ggga(x1)) = 0
POL(s(x1)) = 1 + x1
POL(times_in_gga(x1, x2)) = x2
POL(times_out_gga(x1)) = 0
U5_GG(X, Y, not_divides_out_gg) → PR_IN_GG(X, s(Y))
not_divides_in_gg(Y, X) → U7_gg(Y, X, div_in_gga(X, Y))
U7_gg(Y, X, div_out_gga(U)) → U8_gg(X, times_in_gga(U, Y))
div_in_gga(X, Y) → U1_gga(quot_in_ggga(X, Y, Y))
U8_gg(X, times_out_gga(Z)) → U9_gg(neq_in_gg(X, Z))
U1_gga(quot_out_ggga(Z)) → div_out_gga(Z)
times_in_gga(0, Y) → times_out_gga(0)
times_in_gga(s(X), Y) → U11_gga(Y, times_in_gga(X, Y))
U9_gg(neq_out_gg) → not_divides_out_gg
quot_in_ggga(0, s(Y), s(Z)) → quot_out_ggga(0)
quot_in_ggga(s(X), s(Y), Z) → U2_ggga(quot_in_ggga(X, Y, Z))
quot_in_ggga(X, 0, s(Z)) → U3_ggga(quot_in_ggga(X, s(Z), s(Z)))
U11_gga(Y, times_out_gga(U)) → U12_gga(add_in_gga(U, Y))
neq_in_gg(s(X), 0) → neq_out_gg
neq_in_gg(0, s(X)) → neq_out_gg
neq_in_gg(s(X), s(Y)) → U10_gg(neq_in_gg(X, Y))
U2_ggga(quot_out_ggga(U)) → quot_out_ggga(U)
U3_ggga(quot_out_ggga(U)) → quot_out_ggga(s(U))
U12_gga(add_out_gga(Z)) → times_out_gga(Z)
U10_gg(neq_out_gg) → neq_out_gg
add_in_gga(X, 0) → add_out_gga(X)
add_in_gga(0, X) → add_out_gga(X)
add_in_gga(s(X), Y) → U13_gga(add_in_gga(X, Y))
U13_gga(add_out_gga(Z)) → add_out_gga(s(Z))
not_divides_in_gg(x0, x1)
U7_gg(x0, x1, x2)
div_in_gga(x0, x1)
U8_gg(x0, x1)
U1_gga(x0)
times_in_gga(x0, x1)
U9_gg(x0)
quot_in_ggga(x0, x1, x2)
U11_gga(x0, x1)
neq_in_gg(x0, x1)
U2_ggga(x0)
U3_ggga(x0)
U12_gga(x0)
U10_gg(x0)
add_in_gga(x0, x1)
U13_gga(x0)