/export/starexec/sandbox2/solver/bin/starexec_run_complexity /export/starexec/sandbox2/benchmark/theBenchmark.xml /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^1), O(n^1)) proof of /export/starexec/sandbox2/benchmark/theBenchmark.xml # AProVE Commit ID: 794c25de1cacf0d048858bcd21c9a779e1221865 marcel 20200619 unpublished dirty The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). (0) CpxTRS (1) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxWeightedTrs (3) CpxWeightedTrsRenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (4) CpxWeightedTrs (5) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (6) CpxTypedWeightedTrs (7) CompletionProof [UPPER BOUND(ID), 0 ms] (8) CpxTypedWeightedCompleteTrs (9) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 7 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 178 ms] (12) BOUNDS(1, n^1) (13) RelTrsToDecreasingLoopProblemProof [LOWER BOUND(ID), 0 ms] (14) TRS for Loop Detection (15) DecreasingLoopProof [LOWER BOUND(ID), 0 ms] (16) BEST (17) proven lower bound (18) LowerBoundPropagationProof [FINISHED, 0 ms] (19) BOUNDS(n^1, INF) (20) TRS for Loop Detection ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: +(X, 0) -> X +(X, s(Y)) -> s(+(X, Y)) double(X) -> +(X, X) f(0, s(0), X) -> f(X, double(X), X) g(X, Y) -> X g(X, Y) -> Y S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (1) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: +(X, 0) -> X [1] +(X, s(Y)) -> s(+(X, Y)) [1] double(X) -> +(X, X) [1] f(0, s(0), X) -> f(X, double(X), X) [1] g(X, Y) -> X [1] g(X, Y) -> Y [1] Rewrite Strategy: INNERMOST ---------------------------------------- (3) CpxWeightedTrsRenamingProof (BOTH BOUNDS(ID, ID)) Renamed defined symbols to avoid conflicts with arithmetic symbols: + => plus ---------------------------------------- (4) Obligation: The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: plus(X, 0) -> X [1] plus(X, s(Y)) -> s(plus(X, Y)) [1] double(X) -> plus(X, X) [1] f(0, s(0), X) -> f(X, double(X), X) [1] g(X, Y) -> X [1] g(X, Y) -> Y [1] Rewrite Strategy: INNERMOST ---------------------------------------- (5) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (6) Obligation: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: plus(X, 0) -> X [1] plus(X, s(Y)) -> s(plus(X, Y)) [1] double(X) -> plus(X, X) [1] f(0, s(0), X) -> f(X, double(X), X) [1] g(X, Y) -> X [1] g(X, Y) -> Y [1] The TRS has the following type information: plus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s double :: 0:s -> 0:s f :: 0:s -> 0:s -> 0:s -> f g :: g -> g -> g Rewrite Strategy: INNERMOST ---------------------------------------- (7) CompletionProof (UPPER BOUND(ID)) The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added: f(v0, v1, v2) -> null_f [0] And the following fresh constants: null_f, const ---------------------------------------- (8) Obligation: Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: plus(X, 0) -> X [1] plus(X, s(Y)) -> s(plus(X, Y)) [1] double(X) -> plus(X, X) [1] f(0, s(0), X) -> f(X, double(X), X) [1] g(X, Y) -> X [1] g(X, Y) -> Y [1] f(v0, v1, v2) -> null_f [0] The TRS has the following type information: plus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s double :: 0:s -> 0:s f :: 0:s -> 0:s -> 0:s -> null_f g :: g -> g -> g null_f :: null_f const :: g Rewrite Strategy: INNERMOST ---------------------------------------- (9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID)) Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction. The constant constructors are abstracted as follows: 0 => 0 null_f => 0 const => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: double(z) -{ 1 }-> plus(X, X) :|: X >= 0, z = X f(z, z', z'') -{ 1 }-> f(X, double(X), X) :|: z'' = X, X >= 0, z' = 1 + 0, z = 0 f(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 g(z, z') -{ 1 }-> X :|: z' = Y, Y >= 0, X >= 0, z = X g(z, z') -{ 1 }-> Y :|: z' = Y, Y >= 0, X >= 0, z = X plus(z, z') -{ 1 }-> X :|: X >= 0, z = X, z' = 0 plus(z, z') -{ 1 }-> 1 + plus(X, Y) :|: Y >= 0, z' = 1 + Y, X >= 0, z = X Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (11) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V1, V, V2),0,[plus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[double(V1, Out)],[V1 >= 0]). eq(start(V1, V, V2),0,[f(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(start(V1, V, V2),0,[g(V1, V, Out)],[V1 >= 0,V >= 0]). eq(plus(V1, V, Out),1,[],[Out = X1,X1 >= 0,V1 = X1,V = 0]). eq(plus(V1, V, Out),1,[plus(X2, Y1, Ret1)],[Out = 1 + Ret1,Y1 >= 0,V = 1 + Y1,X2 >= 0,V1 = X2]). eq(double(V1, Out),1,[plus(X3, X3, Ret)],[Out = Ret,X3 >= 0,V1 = X3]). eq(f(V1, V, V2, Out),1,[double(X4, Ret11),f(X4, Ret11, X4, Ret2)],[Out = Ret2,V2 = X4,X4 >= 0,V = 1,V1 = 0]). eq(g(V1, V, Out),1,[],[Out = X5,V = Y2,Y2 >= 0,X5 >= 0,V1 = X5]). eq(g(V1, V, Out),1,[],[Out = Y3,V = Y3,Y3 >= 0,X6 >= 0,V1 = X6]). eq(f(V1, V, V2, Out),0,[],[Out = 0,V4 >= 0,V2 = V5,V3 >= 0,V1 = V4,V = V3,V5 >= 0]). input_output_vars(plus(V1,V,Out),[V1,V],[Out]). input_output_vars(double(V1,Out),[V1],[Out]). input_output_vars(f(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(g(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [plus/3] 1. non_recursive : [double/2] 2. recursive : [f/4] 3. non_recursive : [g/3] 4. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into plus/3 1. SCC is completely evaluated into other SCCs 2. SCC is partially evaluated into f/4 3. SCC is partially evaluated into g/3 4. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations plus/3 * CE 6 is refined into CE [11] * CE 5 is refined into CE [12] ### Cost equations --> "Loop" of plus/3 * CEs [12] --> Loop 8 * CEs [11] --> Loop 9 ### Ranking functions of CR plus(V1,V,Out) * RF of phase [9]: [V] #### Partial ranking functions of CR plus(V1,V,Out) * Partial RF of phase [9]: - RF of loop [9:1]: V ### Specialization of cost equations f/4 * CE 8 is refined into CE [13] * CE 7 is refined into CE [14,15] ### Cost equations --> "Loop" of f/4 * CEs [15] --> Loop 10 * CEs [14] --> Loop 11 * CEs [13] --> Loop 12 ### Ranking functions of CR f(V1,V,V2,Out) #### Partial ranking functions of CR f(V1,V,V2,Out) ### Specialization of cost equations g/3 * CE 10 is refined into CE [16] * CE 9 is refined into CE [17] ### Cost equations --> "Loop" of g/3 * CEs [16] --> Loop 13 * CEs [17] --> Loop 14 ### Ranking functions of CR g(V1,V,Out) #### Partial ranking functions of CR g(V1,V,Out) ### Specialization of cost equations start/3 * CE 1 is refined into CE [18,19] * CE 2 is refined into CE [20,21] * CE 3 is refined into CE [22,23] * CE 4 is refined into CE [24,25] ### Cost equations --> "Loop" of start/3 * CEs [21] --> Loop 15 * CEs [18,19,22,24,25] --> Loop 16 * CEs [20,23] --> Loop 17 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### Cost of chains of plus(V1,V,Out): * Chain [[9],8]: 1*it(9)+1 Such that:it(9) =< V with precondition: [V+V1=Out,V1>=0,V>=1] * Chain [8]: 1 with precondition: [V=0,V1=Out,V1>=0] #### Cost of chains of f(V1,V,V2,Out): * Chain [12]: 0 with precondition: [Out=0,V1>=0,V>=0,V2>=0] * Chain [11,12]: 3 with precondition: [V1=0,V=1,V2=0,Out=0] * Chain [10,12]: 1*s(1)+3 Such that:s(1) =< V2 with precondition: [V1=0,V=1,Out=0,V2>=1] #### Cost of chains of g(V1,V,Out): * Chain [14]: 1 with precondition: [V1=Out,V1>=0,V>=0] * Chain [13]: 1 with precondition: [V=Out,V1>=0,V>=0] #### Cost of chains of start(V1,V,V2): * Chain [17]: 1*s(2)+3 Such that:s(2) =< V2 with precondition: [V1=0] * Chain [16]: 1*s(3)+3 Such that:s(3) =< V with precondition: [V1>=0,V>=0] * Chain [15]: 1*s(4)+2 Such that:s(4) =< V1 with precondition: [V1>=1] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [17] with precondition: [V1=0] - Upper bound: nat(V2)+3 - Complexity: n * Chain [16] with precondition: [V1>=0,V>=0] - Upper bound: V+3 - Complexity: n * Chain [15] with precondition: [V1>=1] - Upper bound: V1+2 - Complexity: n ### Maximum cost of start(V1,V,V2): max([V1,nat(V)+1,nat(V2)+1])+2 Asymptotic class: n * Total analysis performed in 109 ms. ---------------------------------------- (12) BOUNDS(1, n^1) ---------------------------------------- (13) RelTrsToDecreasingLoopProblemProof (LOWER BOUND(ID)) Transformed a relative TRS into a decreasing-loop problem. ---------------------------------------- (14) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: +(X, 0) -> X +(X, s(Y)) -> s(+(X, Y)) double(X) -> +(X, X) f(0, s(0), X) -> f(X, double(X), X) g(X, Y) -> X g(X, Y) -> Y S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (15) DecreasingLoopProof (LOWER BOUND(ID)) The following loop(s) give(s) rise to the lower bound Omega(n^1): The rewrite sequence +(X, s(Y)) ->^+ s(+(X, Y)) gives rise to a decreasing loop by considering the right hand sides subterm at position [0]. The pumping substitution is [Y / s(Y)]. The result substitution is [ ]. ---------------------------------------- (16) Complex Obligation (BEST) ---------------------------------------- (17) Obligation: Proved the lower bound n^1 for the following obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: +(X, 0) -> X +(X, s(Y)) -> s(+(X, Y)) double(X) -> +(X, X) f(0, s(0), X) -> f(X, double(X), X) g(X, Y) -> X g(X, Y) -> Y S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (18) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (19) BOUNDS(n^1, INF) ---------------------------------------- (20) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: +(X, 0) -> X +(X, s(Y)) -> s(+(X, Y)) double(X) -> +(X, X) f(0, s(0), X) -> f(X, double(X), X) g(X, Y) -> X g(X, Y) -> Y S is empty. Rewrite Strategy: INNERMOST