### Pre-processing the ITS problem ### Initial linear ITS problem Start location: f0 0: f0 -> f1 : y'=0, [], cost: 1 1: f1 -> f1 : x'=-1+x, y'=x+y, [ x>0 ], cost: 1 2: f1 -> f2 : z'=y, [ x<=0 ], cost: 1 3: f2 -> f3 : u'=-1+z, [ z>0 ], cost: 1 4: f3 -> f3 : u'=-free+u, [ u>0 && free>0 ], cost: 1 5: f3 -> f2 : z'=-1+z, [ u<=0 ], cost: 1 Checking for constant complexity: The following rule is satisfiable with cost >= 1, yielding constant complexity: 0: f0 -> f1 : y'=0, [], cost: 1 ### Simplification by acceleration and chaining ### Accelerating simple loops of location 1. Accelerating the following rules: 1: f1 -> f1 : x'=-1+x, y'=x+y, [ x>0 ], cost: 1 Accelerated rule 1 with metering function x, yielding the new rule 6. Removing the simple loops: 1. Accelerating simple loops of location 3. Accelerating the following rules: 4: f3 -> f3 : u'=-free+u, [ u>0 && free>0 ], cost: 1 During metering: Instantiating temporary variables by {free==1} Accelerated rule 4 with metering function u, yielding the new rule 7. Removing the simple loops: 4. Accelerated all simple loops using metering functions (where possible): Start location: f0 0: f0 -> f1 : y'=0, [], cost: 1 2: f1 -> f2 : z'=y, [ x<=0 ], cost: 1 6: f1 -> f1 : x'=0, y'=1/2*x+1/2*x^2+y, [ x>0 ], cost: x 3: f2 -> f3 : u'=-1+z, [ z>0 ], cost: 1 5: f3 -> f2 : z'=-1+z, [ u<=0 ], cost: 1 7: f3 -> f3 : u'=0, [ u>0 ], cost: u Chained accelerated rules (with incoming rules): Start location: f0 0: f0 -> f1 : y'=0, [], cost: 1 8: f0 -> f1 : x'=0, y'=1/2*x+1/2*x^2, [ x>0 ], cost: 1+x 2: f1 -> f2 : z'=y, [ x<=0 ], cost: 1 3: f2 -> f3 : u'=-1+z, [ z>0 ], cost: 1 9: f2 -> f3 : u'=0, [ -1+z>0 ], cost: z 5: f3 -> f2 : z'=-1+z, [ u<=0 ], cost: 1 Eliminated locations (on tree-shaped paths): Start location: f0 10: f0 -> f2 : y'=0, z'=0, [ x<=0 ], cost: 2 11: f0 -> f2 : x'=0, y'=1/2*x+1/2*x^2, z'=1/2*x+1/2*x^2, [ x>0 ], cost: 2+x 12: f2 -> f2 : u'=-1+z, z'=-1+z, [ z>0 && -1+z<=0 ], cost: 2 13: f2 -> f2 : u'=0, z'=-1+z, [ -1+z>0 ], cost: 1+z Accelerating simple loops of location 2. Simplified some of the simple loops (and removed duplicate rules). Accelerating the following rules: 12: f2 -> f2 : u'=-1+z, z'=-1+z, [ 1-z==0 ], cost: 2 13: f2 -> f2 : u'=0, z'=-1+z, [ -1+z>0 ], cost: 1+z Accelerated rule 12 with metering function z, yielding the new rule 14. Accelerated rule 13 with metering function -1+z, yielding the new rule 15. Removing the simple loops: 12 13. Accelerated all simple loops using metering functions (where possible): Start location: f0 10: f0 -> f2 : y'=0, z'=0, [ x<=0 ], cost: 2 11: f0 -> f2 : x'=0, y'=1/2*x+1/2*x^2, z'=1/2*x+1/2*x^2, [ x>0 ], cost: 2+x 14: f2 -> f2 : u'=0, z'=0, [ 1-z==0 ], cost: 2*z 15: f2 -> f2 : u'=0, z'=1, [ -1+z>0 ], cost: -3/2-1/2*(-1+z)^2+3/2*z+z*(-1+z) Chained accelerated rules (with incoming rules): Start location: f0 10: f0 -> f2 : y'=0, z'=0, [ x<=0 ], cost: 2 11: f0 -> f2 : x'=0, y'=1/2*x+1/2*x^2, z'=1/2*x+1/2*x^2, [ x>0 ], cost: 2+x 16: f0 -> f2 : u'=0, x'=0, y'=1/2*x+1/2*x^2, z'=0, [ x>0 && 1-1/2*x-1/2*x^2==0 ], cost: 2+2*x+x^2 17: f0 -> f2 : u'=0, x'=0, y'=1/2*x+1/2*x^2, z'=1, [ x>0 && -1+1/2*x+1/2*x^2>0 ], cost: 1/2+7/4*x+3/4*x^2-1/8*(-2+x+x^2)^2+1/4*(x+x^2)*(-2+x+x^2) Removed unreachable locations (and leaf rules with constant cost): Start location: f0 11: f0 -> f2 : x'=0, y'=1/2*x+1/2*x^2, z'=1/2*x+1/2*x^2, [ x>0 ], cost: 2+x 16: f0 -> f2 : u'=0, x'=0, y'=1/2*x+1/2*x^2, z'=0, [ x>0 && 1-1/2*x-1/2*x^2==0 ], cost: 2+2*x+x^2 17: f0 -> f2 : u'=0, x'=0, y'=1/2*x+1/2*x^2, z'=1, [ x>0 && -1+1/2*x+1/2*x^2>0 ], cost: 1/2+7/4*x+3/4*x^2-1/8*(-2+x+x^2)^2+1/4*(x+x^2)*(-2+x+x^2) ### Computing asymptotic complexity ### Fully simplified ITS problem Start location: f0 11: f0 -> f2 : x'=0, y'=1/2*x+1/2*x^2, z'=1/2*x+1/2*x^2, [ x>0 ], cost: 2+x 16: f0 -> f2 : u'=0, x'=0, y'=1/2*x+1/2*x^2, z'=0, [ x>0 && 1-1/2*x-1/2*x^2==0 ], cost: 2+2*x+x^2 17: f0 -> f2 : u'=0, x'=0, y'=1/2*x+1/2*x^2, z'=1, [ x>0 && -1+1/2*x+1/2*x^2>0 ], cost: 1/2+7/4*x+3/4*x^2-1/8*(-2+x+x^2)^2+1/4*(x+x^2)*(-2+x+x^2) Computing asymptotic complexity for rule 11 Solved the limit problem by the following transformations: Created initial limit problem: x (+/+!), 2+x (+) [not solved] removing all constraints (solved by SMT) resulting limit problem: [solved] applying transformation rule (C) using substitution {x==n} resulting limit problem: [solved] Solution: x / n Resulting cost 2+n has complexity: Poly(n^1) Found new complexity Poly(n^1). Computing asymptotic complexity for rule 16 Could not solve the limit problem. Resulting cost 0 has complexity: Unknown Computing asymptotic complexity for rule 17 Solved the limit problem by the following transformations: Created initial limit problem: x (+/+!), -1+1/2*x+1/2*x^2 (+/+!), 7/4*x+7/8*x^2+1/4*x^3+1/8*x^4 (+) [not solved] removing all constraints (solved by SMT) resulting limit problem: [solved] applying transformation rule (C) using substitution {x==n} resulting limit problem: [solved] Solution: x / n Resulting cost 7/8*n^2+1/4*n^3+7/4*n+1/8*n^4 has complexity: Poly(n^4) Found new complexity Poly(n^4). Obtained the following overall complexity (w.r.t. the length of the input n): Complexity: Poly(n^4) Cpx degree: 4 Solved cost: 7/8*n^2+1/4*n^3+7/4*n+1/8*n^4 Rule cost: 1/2+7/4*x+3/4*x^2-1/8*(-2+x+x^2)^2+1/4*(x+x^2)*(-2+x+x^2) Rule guard: [ x>0 && -1+1/2*x+1/2*x^2>0 ] WORST_CASE(Omega(n^4),?)