### Pre-processing the ITS problem ### Initial linear ITS problem Start location: f0 0: f0 -> facsum : [], cost: 0 1: facsum -> fac : facsum : x'=-1+x, [ x>0 ], cost: 1 2: facsum -> sink : [ x<=0 ], cost: 1 3: fac -> fac : x'=-1+x, [ x>1 ], cost: 1 4: fac -> sink : [ x<=1 ], cost: 1 Checking for constant complexity: Could not prove constant complexity. Removed unreachable and leaf rules: Start location: f0 0: f0 -> facsum : [], cost: 0 1: facsum -> fac : facsum : x'=-1+x, [ x>0 ], cost: 1 3: fac -> fac : x'=-1+x, [ x>1 ], cost: 1 ### Simplification by acceleration and chaining ### Accelerating simple loops of location 2. Accelerating the following rules: 3: fac -> fac : x'=-1+x, [ x>1 ], cost: 1 Accelerated rule 3 with metering function -1+x, yielding the new rule 5. Removing the simple loops: 3. Accelerated all simple loops using metering functions (where possible): Start location: f0 0: f0 -> facsum : [], cost: 0 1: facsum -> fac : facsum : x'=-1+x, [ x>0 ], cost: 1 5: fac -> fac : x'=1, [ x>1 ], cost: -1+x Chained accelerated rules (with incoming rules): Start location: f0 0: f0 -> facsum : [], cost: 0 1: facsum -> fac : facsum : x'=-1+x, [ x>0 ], cost: 1 6: facsum -> fac : x'=1, facsum : x'=-1+x, [ x>1 ], cost: x Removed locations with no outgoing rules from right-hand sides Start location: f0 0: f0 -> facsum : [], cost: 0 7: facsum -> facsum : x'=-1+x, [ x>0 ], cost: 1 8: facsum -> facsum : x'=-1+x, [ x>1 ], cost: x Accelerating simple loops of location 1. Accelerating the following rules: 7: facsum -> facsum : x'=-1+x, [ x>0 ], cost: 1 8: facsum -> facsum : x'=-1+x, [ x>1 ], cost: x Accelerated rule 7 with metering function x, yielding the new rule 9. Accelerated rule 8 with metering function -1+x, yielding the new rule 10. Removing the simple loops: 7 8. Accelerated all simple loops using metering functions (where possible): Start location: f0 0: f0 -> facsum : [], cost: 0 9: facsum -> facsum : x'=0, [ x>0 ], cost: x 10: facsum -> facsum : x'=1, [ x>1 ], cost: -1/2-1/2*(-1+x)^2+(-1+x)*x+1/2*x Chained accelerated rules (with incoming rules): Start location: f0 0: f0 -> facsum : [], cost: 0 11: f0 -> facsum : x'=0, [ x>0 ], cost: x 12: f0 -> facsum : x'=1, [ x>1 ], cost: -1/2-1/2*(-1+x)^2+(-1+x)*x+1/2*x Removed unreachable locations (and leaf rules with constant cost): Start location: f0 11: f0 -> facsum : x'=0, [ x>0 ], cost: x 12: f0 -> facsum : x'=1, [ x>1 ], cost: -1/2-1/2*(-1+x)^2+(-1+x)*x+1/2*x ### Obtained a tail recursive problem, continuing simplification ### ### Computing asymptotic complexity ### Fully simplified ITS problem Start location: f0 11: f0 -> facsum : x'=0, [ x>0 ], cost: x 12: f0 -> facsum : x'=1, [ x>1 ], cost: -1/2-1/2*(-1+x)^2+(-1+x)*x+1/2*x Computing asymptotic complexity for rule 11 Solved the limit problem by the following transformations: Created initial limit problem: x (+) [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 n has complexity: Poly(n^1) Found new complexity Poly(n^1). Computing asymptotic complexity for rule 12 Solved the limit problem by the following transformations: Created initial limit problem: -1+x (+/+!), -1+1/2*x+1/2*x^2 (+) [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 -1+1/2*n+1/2*n^2 has complexity: Poly(n^2) Found new complexity Poly(n^2). Obtained the following overall complexity (w.r.t. the length of the input n): Complexity: Poly(n^2) Cpx degree: 2 Solved cost: -1+1/2*n+1/2*n^2 Rule cost: -1/2-1/2*(-1+x)^2+(-1+x)*x+1/2*x Rule guard: [ x>1 ] WORST_CASE(Omega(n^2),?)