/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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). (0) CpxTRS (1) RcToIrcProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxTRS (3) RelTrsToWeightedTrsProof [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), 6 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 149 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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: p(s(x)) -> x fac(0) -> s(0) fac(s(x)) -> times(s(x), fac(p(s(x)))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: fac(s([])) The defined contexts are: fac([]) p(s([])) [] just represents basic- or constructor-terms in the following defined contexts: fac([]) As the TRS is an overlay system and the defined contexts and the duplicating contexts don't overlap, we have rc = irc. ---------------------------------------- (2) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: p(s(x)) -> x fac(0) -> s(0) fac(s(x)) -> times(s(x), fac(p(s(x)))) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (3) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (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: p(s(x)) -> x [1] fac(0) -> s(0) [1] fac(s(x)) -> times(s(x), fac(p(s(x)))) [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: p(s(x)) -> x [1] fac(0) -> s(0) [1] fac(s(x)) -> times(s(x), fac(p(s(x)))) [1] The TRS has the following type information: p :: s:0:times -> s:0:times s :: s:0:times -> s:0:times fac :: s:0:times -> s:0:times 0 :: s:0:times times :: s:0:times -> s:0:times -> s:0:times 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: p(v0) -> null_p [0] fac(v0) -> null_fac [0] And the following fresh constants: null_p, null_fac ---------------------------------------- (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: p(s(x)) -> x [1] fac(0) -> s(0) [1] fac(s(x)) -> times(s(x), fac(p(s(x)))) [1] p(v0) -> null_p [0] fac(v0) -> null_fac [0] The TRS has the following type information: p :: s:0:times:null_p:null_fac -> s:0:times:null_p:null_fac s :: s:0:times:null_p:null_fac -> s:0:times:null_p:null_fac fac :: s:0:times:null_p:null_fac -> s:0:times:null_p:null_fac 0 :: s:0:times:null_p:null_fac times :: s:0:times:null_p:null_fac -> s:0:times:null_p:null_fac -> s:0:times:null_p:null_fac null_p :: s:0:times:null_p:null_fac null_fac :: s:0:times:null_p:null_fac 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_p => 0 null_fac => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: fac(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 fac(z) -{ 1 }-> 1 + 0 :|: z = 0 fac(z) -{ 1 }-> 1 + (1 + x) + fac(p(1 + x)) :|: x >= 0, z = 1 + x p(z) -{ 1 }-> x :|: x >= 0, z = 1 + x p(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 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(V),0,[p(V, Out)],[V >= 0]). eq(start(V),0,[fac(V, Out)],[V >= 0]). eq(p(V, Out),1,[],[Out = V1,V1 >= 0,V = 1 + V1]). eq(fac(V, Out),1,[],[Out = 1,V = 0]). eq(fac(V, Out),1,[p(1 + V2, Ret10),fac(Ret10, Ret1)],[Out = 2 + Ret1 + V2,V2 >= 0,V = 1 + V2]). eq(p(V, Out),0,[],[Out = 0,V3 >= 0,V = V3]). eq(fac(V, Out),0,[],[Out = 0,V4 >= 0,V = V4]). input_output_vars(p(V,Out),[V],[Out]). input_output_vars(fac(V,Out),[V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [p/2] 1. recursive : [fac/2] 2. non_recursive : [start/1] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into p/2 1. SCC is partially evaluated into fac/2 2. SCC is partially evaluated into start/1 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations p/2 * CE 3 is refined into CE [8] * CE 4 is refined into CE [9] ### Cost equations --> "Loop" of p/2 * CEs [8] --> Loop 7 * CEs [9] --> Loop 8 ### Ranking functions of CR p(V,Out) #### Partial ranking functions of CR p(V,Out) ### Specialization of cost equations fac/2 * CE 7 is refined into CE [10] * CE 5 is refined into CE [11] * CE 6 is refined into CE [12,13] ### Cost equations --> "Loop" of fac/2 * CEs [13] --> Loop 9 * CEs [12] --> Loop 10 * CEs [10] --> Loop 11 * CEs [11] --> Loop 12 ### Ranking functions of CR fac(V,Out) * RF of phase [9]: [V] #### Partial ranking functions of CR fac(V,Out) * Partial RF of phase [9]: - RF of loop [9:1]: V ### Specialization of cost equations start/1 * CE 1 is refined into CE [14,15] * CE 2 is refined into CE [16,17,18,19] ### Cost equations --> "Loop" of start/1 * CEs [14,15,16,17,18,19] --> Loop 13 ### Ranking functions of CR start(V) #### Partial ranking functions of CR start(V) Computing Bounds ===================================== #### Cost of chains of p(V,Out): * Chain [8]: 0 with precondition: [Out=0,V>=0] * Chain [7]: 1 with precondition: [V=Out+1,V>=1] #### Cost of chains of fac(V,Out): * Chain [[9],12]: 2*it(9)+1 Such that:it(9) =< V with precondition: [V>=1] * Chain [[9],11]: 2*it(9)+0 Such that:it(9) =< V with precondition: [V>=1,Out>=V+1] * Chain [[9],10,12]: 2*it(9)+2 Such that:it(9) =< V with precondition: [V>=1,Out>=2*V+2] * Chain [[9],10,11]: 2*it(9)+1 Such that:it(9) =< V with precondition: [V>=1,Out>=2*V+1] * Chain [12]: 1 with precondition: [V=0,Out=1] * Chain [11]: 0 with precondition: [Out=0,V>=0] * Chain [10,12]: 2 with precondition: [V+2=Out,V>=1] * Chain [10,11]: 1 with precondition: [V+1=Out,V>=1] #### Cost of chains of start(V): * Chain [13]: 8*s(6)+2 Such that:s(5) =< V s(6) =< s(5) with precondition: [V>=0] Closed-form bounds of start(V): ------------------------------------- * Chain [13] with precondition: [V>=0] - Upper bound: 8*V+2 - Complexity: n ### Maximum cost of start(V): 8*V+2 Asymptotic class: n * Total analysis performed in 73 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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: p(s(x)) -> x fac(0) -> s(0) fac(s(x)) -> times(s(x), fac(p(s(x)))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) DecreasingLoopProof (LOWER BOUND(ID)) The following loop(s) give(s) rise to the lower bound Omega(n^1): The rewrite sequence fac(s(x)) ->^+ times(s(x), fac(x)) gives rise to a decreasing loop by considering the right hand sides subterm at position [1]. The pumping substitution is [x / s(x)]. The result substitution is [ ]. ---------------------------------------- (16) Complex Obligation (BEST) ---------------------------------------- (17) Obligation: Proved the lower bound n^1 for the following obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: p(s(x)) -> x fac(0) -> s(0) fac(s(x)) -> times(s(x), fac(p(s(x)))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (18) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (19) BOUNDS(n^1, INF) ---------------------------------------- (20) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: p(s(x)) -> x fac(0) -> s(0) fac(s(x)) -> times(s(x), fac(p(s(x)))) S is empty. Rewrite Strategy: FULL