/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^2)) 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^2). (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), 3 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 461 ms] (12) BOUNDS(1, n^2) (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^2). The TRS R consists of the following rules: -(x, 0) -> x -(s(x), s(y)) -> -(x, y) p(s(x)) -> x f(s(x), y) -> f(p(-(s(x), y)), p(-(y, s(x)))) f(x, s(y)) -> f(p(-(x, s(y))), p(-(s(y), x))) 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^2). The TRS R consists of the following rules: -(x, 0) -> x [1] -(s(x), s(y)) -> -(x, y) [1] p(s(x)) -> x [1] f(s(x), y) -> f(p(-(s(x), y)), p(-(y, s(x)))) [1] f(x, s(y)) -> f(p(-(x, s(y))), p(-(s(y), x))) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (3) CpxWeightedTrsRenamingProof (BOTH BOUNDS(ID, ID)) Renamed defined symbols to avoid conflicts with arithmetic symbols: - => minus ---------------------------------------- (4) Obligation: The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^2). The TRS R consists of the following rules: minus(x, 0) -> x [1] minus(s(x), s(y)) -> minus(x, y) [1] p(s(x)) -> x [1] f(s(x), y) -> f(p(minus(s(x), y)), p(minus(y, s(x)))) [1] f(x, s(y)) -> f(p(minus(x, s(y))), p(minus(s(y), 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: minus(x, 0) -> x [1] minus(s(x), s(y)) -> minus(x, y) [1] p(s(x)) -> x [1] f(s(x), y) -> f(p(minus(s(x), y)), p(minus(y, s(x)))) [1] f(x, s(y)) -> f(p(minus(x, s(y))), p(minus(s(y), x))) [1] The TRS has the following type information: minus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s p :: 0:s -> 0:s f :: 0:s -> 0:s -> f 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: minus(v0, v1) -> null_minus [0] p(v0) -> null_p [0] f(v0, v1) -> null_f [0] And the following fresh constants: null_minus, null_p, null_f ---------------------------------------- (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: minus(x, 0) -> x [1] minus(s(x), s(y)) -> minus(x, y) [1] p(s(x)) -> x [1] f(s(x), y) -> f(p(minus(s(x), y)), p(minus(y, s(x)))) [1] f(x, s(y)) -> f(p(minus(x, s(y))), p(minus(s(y), x))) [1] minus(v0, v1) -> null_minus [0] p(v0) -> null_p [0] f(v0, v1) -> null_f [0] The TRS has the following type information: minus :: 0:s:null_minus:null_p -> 0:s:null_minus:null_p -> 0:s:null_minus:null_p 0 :: 0:s:null_minus:null_p s :: 0:s:null_minus:null_p -> 0:s:null_minus:null_p p :: 0:s:null_minus:null_p -> 0:s:null_minus:null_p f :: 0:s:null_minus:null_p -> 0:s:null_minus:null_p -> null_f null_minus :: 0:s:null_minus:null_p null_p :: 0:s:null_minus:null_p null_f :: null_f 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_minus => 0 null_p => 0 null_f => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: f(z, z') -{ 1 }-> f(p(minus(x, 1 + y)), p(minus(1 + y, x))) :|: z' = 1 + y, x >= 0, y >= 0, z = x f(z, z') -{ 1 }-> f(p(minus(1 + x, y)), p(minus(y, 1 + x))) :|: x >= 0, y >= 0, z = 1 + x, z' = y f(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 minus(z, z') -{ 1 }-> x :|: x >= 0, z = x, z' = 0 minus(z, z') -{ 1 }-> minus(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x minus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 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(V1, V),0,[minus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[p(V1, Out)],[V1 >= 0]). eq(start(V1, V),0,[f(V1, V, Out)],[V1 >= 0,V >= 0]). eq(minus(V1, V, Out),1,[],[Out = V2,V2 >= 0,V1 = V2,V = 0]). eq(minus(V1, V, Out),1,[minus(V3, V4, Ret)],[Out = Ret,V = 1 + V4,V3 >= 0,V4 >= 0,V1 = 1 + V3]). eq(p(V1, Out),1,[],[Out = V5,V5 >= 0,V1 = 1 + V5]). eq(f(V1, V, Out),1,[minus(1 + V6, V7, Ret00),p(Ret00, Ret0),minus(V7, 1 + V6, Ret10),p(Ret10, Ret1),f(Ret0, Ret1, Ret2)],[Out = Ret2,V6 >= 0,V7 >= 0,V1 = 1 + V6,V = V7]). eq(f(V1, V, Out),1,[minus(V8, 1 + V9, Ret001),p(Ret001, Ret01),minus(1 + V9, V8, Ret101),p(Ret101, Ret11),f(Ret01, Ret11, Ret3)],[Out = Ret3,V = 1 + V9,V8 >= 0,V9 >= 0,V1 = V8]). eq(minus(V1, V, Out),0,[],[Out = 0,V11 >= 0,V10 >= 0,V1 = V11,V = V10]). eq(p(V1, Out),0,[],[Out = 0,V12 >= 0,V1 = V12]). eq(f(V1, V, Out),0,[],[Out = 0,V14 >= 0,V13 >= 0,V1 = V14,V = V13]). input_output_vars(minus(V1,V,Out),[V1,V],[Out]). input_output_vars(p(V1,Out),[V1],[Out]). input_output_vars(f(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [minus/3] 1. non_recursive : [p/2] 2. recursive : [f/3] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into minus/3 1. SCC is partially evaluated into p/2 2. SCC is partially evaluated into f/3 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations minus/3 * CE 6 is refined into CE [12] * CE 4 is refined into CE [13] * CE 5 is refined into CE [14] ### Cost equations --> "Loop" of minus/3 * CEs [14] --> Loop 10 * CEs [12] --> Loop 11 * CEs [13] --> Loop 12 ### Ranking functions of CR minus(V1,V,Out) * RF of phase [10]: [V,V1] #### Partial ranking functions of CR minus(V1,V,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V V1 ### Specialization of cost equations p/2 * CE 7 is refined into CE [15] * CE 8 is refined into CE [16] ### Cost equations --> "Loop" of p/2 * CEs [15] --> Loop 13 * CEs [16] --> Loop 14 ### Ranking functions of CR p(V1,Out) #### Partial ranking functions of CR p(V1,Out) ### Specialization of cost equations f/3 * CE 11 is refined into CE [17] * CE 9 is refined into CE [18,19,20,21,22,23,24,25] * CE 10 is refined into CE [26,27,28,29,30,31,32,33] ### Cost equations --> "Loop" of f/3 * CEs [25,33] --> Loop 15 * CEs [22,30] --> Loop 16 * CEs [24,32] --> Loop 17 * CEs [19] --> Loop 18 * CEs [18,20] --> Loop 19 * CEs [27] --> Loop 20 * CEs [21,23,26,28,29,31] --> Loop 21 * CEs [17] --> Loop 22 ### Ranking functions of CR f(V1,V,Out) * RF of phase [18]: [V1] * RF of phase [20]: [V] #### Partial ranking functions of CR f(V1,V,Out) * Partial RF of phase [18]: - RF of loop [18:1]: V1 * Partial RF of phase [20]: - RF of loop [20:1]: V ### Specialization of cost equations start/2 * CE 1 is refined into CE [34,35,36] * CE 2 is refined into CE [37,38] * CE 3 is refined into CE [39,40,41] ### Cost equations --> "Loop" of start/2 * CEs [41] --> Loop 23 * CEs [34,35,36,37,38,39,40] --> Loop 24 ### Ranking functions of CR start(V1,V) #### Partial ranking functions of CR start(V1,V) Computing Bounds ===================================== #### Cost of chains of minus(V1,V,Out): * Chain [[10],12]: 1*it(10)+1 Such that:it(10) =< V with precondition: [V1=Out+V,V>=1,V1>=V] * Chain [[10],11]: 1*it(10)+0 Such that:it(10) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [12]: 1 with precondition: [V=0,V1=Out,V1>=0] * Chain [11]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of p(V1,Out): * Chain [14]: 0 with precondition: [Out=0,V1>=0] * Chain [13]: 1 with precondition: [V1=Out+1,V1>=1] #### Cost of chains of f(V1,V,Out): * Chain [[20],22]: 3*it(20)+1*s(4)+0 Such that:aux(3) =< V it(20) =< aux(3) s(4) =< it(20)*aux(3) with precondition: [V1=0,Out=0,V>=1] * Chain [[20],21,22]: 9*it(20)+1*s(4)+2 Such that:aux(6) =< V it(20) =< aux(6) s(4) =< it(20)*aux(6) with precondition: [V1=0,Out=0,V>=2] * Chain [[18],22]: 3*it(18)+1*s(18)+0 Such that:aux(9) =< V1 it(18) =< aux(9) s(18) =< it(18)*aux(9) with precondition: [V=0,Out=0,V1>=1] * Chain [[18],19,22]: 5*it(18)+1*s(18)+2 Such that:aux(11) =< V1 it(18) =< aux(11) s(18) =< it(18)*aux(11) with precondition: [V=0,Out=0,V1>=2] * Chain [22]: 0 with precondition: [Out=0,V1>=0,V>=0] * Chain [21,22]: 6*s(5)+5*s(6)+2 Such that:aux(4) =< V1 aux(5) =< V s(6) =< aux(4) s(5) =< aux(5) with precondition: [Out=0,V1>=0,V>=1] * Chain [19,22]: 2*s(19)+1*s(20)+2 Such that:aux(10) =< V1 s(20) =< V s(19) =< aux(10) with precondition: [Out=0,V1>=1,V>=0] * Chain [17,22]: 4*s(22)+3 Such that:aux(14) =< V1 s(22) =< aux(14) with precondition: [Out=0,V1=V,V1>=1] * Chain [16,[20],22]: 3*it(20)+1*s(4)+2*s(26)+2*s(27)+3 Such that:aux(3) =< -V1+V aux(16) =< V1+1 aux(15) =< V it(20) =< aux(3) s(4) =< it(20)*aux(3) s(26) =< aux(15) s(27) =< aux(16) with precondition: [Out=0,V1>=1,V>=V1+2] * Chain [16,[20],21,22]: 9*it(20)+1*s(4)+2*s(26)+2*s(27)+5 Such that:aux(6) =< -V1+V aux(16) =< V1+1 aux(15) =< V it(20) =< aux(6) s(4) =< it(20)*aux(6) s(26) =< aux(15) s(27) =< aux(16) with precondition: [Out=0,V1>=1,V>=V1+3] * Chain [16,22]: 2*s(26)+2*s(27)+3 Such that:aux(16) =< V1+1 aux(15) =< V s(26) =< aux(15) s(27) =< aux(16) with precondition: [Out=0,V1>=1,V>=V1+1] * Chain [16,21,22]: 6*s(5)+2*s(26)+2*s(27)+5 Such that:aux(5) =< -V1+V aux(16) =< V1+1 aux(15) =< V s(5) =< aux(5) s(26) =< aux(15) s(27) =< aux(16) with precondition: [Out=0,V1>=1,V>=V1+2] * Chain [15,[18],22]: 3*it(18)+1*s(18)+2*s(30)+2*s(31)+3 Such that:aux(18) =< V1 aux(9) =< V1-V aux(17) =< V it(18) =< aux(9) s(18) =< it(18)*aux(9) s(30) =< aux(17) s(31) =< aux(18) with precondition: [Out=0,V>=1,V1>=V+2] * Chain [15,[18],19,22]: 5*it(18)+1*s(18)+2*s(30)+2*s(31)+5 Such that:aux(18) =< V1 aux(11) =< V1-V aux(17) =< V it(18) =< aux(11) s(18) =< it(18)*aux(11) s(30) =< aux(17) s(31) =< aux(18) with precondition: [Out=0,V>=1,V1>=V+3] * Chain [15,22]: 2*s(30)+2*s(31)+3 Such that:aux(18) =< V1 aux(17) =< V s(30) =< aux(17) s(31) =< aux(18) with precondition: [Out=0,V>=1,V1>=V+1] * Chain [15,19,22]: 2*s(19)+2*s(30)+2*s(31)+5 Such that:aux(18) =< V1 aux(10) =< V1-V aux(17) =< V s(19) =< aux(10) s(30) =< aux(17) s(31) =< aux(18) with precondition: [Out=0,V>=1,V1>=V+2] #### Cost of chains of start(V1,V): * Chain [24]: 37*s(101)+18*s(109)+8*s(110)+2*s(111)+10*s(112)+23*s(113)+2*s(114)+2*s(115)+2*s(118)+5 Such that:s(103) =< -V1+V s(105) =< V1+1 s(106) =< V1-V aux(25) =< V1 aux(26) =< V s(101) =< aux(26) s(109) =< s(103) s(110) =< s(105) s(111) =< s(109)*s(103) s(112) =< s(106) s(113) =< aux(25) s(114) =< s(112)*s(106) s(115) =< s(101)*aux(26) s(118) =< s(113)*aux(25) with precondition: [V1>=0] * Chain [23]: 4*s(120)+3 Such that:s(119) =< V s(120) =< s(119) with precondition: [V1=V,V1>=1] Closed-form bounds of start(V1,V): ------------------------------------- * Chain [24] with precondition: [V1>=0] - Upper bound: 23*V1+5+2*V1*V1+nat(V)*37+nat(V)*2*nat(V)+(8*V1+8)+nat(-V1+V)*18+nat(-V1+V)*2*nat(-V1+V)+nat(V1-V)*10+nat(V1-V)*2*nat(V1-V) - Complexity: n^2 * Chain [23] with precondition: [V1=V,V1>=1] - Upper bound: 4*V+3 - Complexity: n ### Maximum cost of start(V1,V): 23*V1+2+2*V1*V1+nat(V)*33+nat(V)*2*nat(V)+(8*V1+8)+nat(-V1+V)*18+nat(-V1+V)*2*nat(-V1+V)+nat(V1-V)*10+nat(V1-V)*2*nat(V1-V)+(nat(V)*4+3) Asymptotic class: n^2 * Total analysis performed in 367 ms. ---------------------------------------- (12) BOUNDS(1, n^2) ---------------------------------------- (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^2). The TRS R consists of the following rules: -(x, 0) -> x -(s(x), s(y)) -> -(x, y) p(s(x)) -> x f(s(x), y) -> f(p(-(s(x), y)), p(-(y, s(x)))) f(x, s(y)) -> f(p(-(x, s(y))), p(-(s(y), x))) 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 -(s(x), s(y)) ->^+ -(x, y) gives rise to a decreasing loop by considering the right hand sides subterm at position []. The pumping substitution is [x / s(x), 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^2). The TRS R consists of the following rules: -(x, 0) -> x -(s(x), s(y)) -> -(x, y) p(s(x)) -> x f(s(x), y) -> f(p(-(s(x), y)), p(-(y, s(x)))) f(x, s(y)) -> f(p(-(x, s(y))), p(-(s(y), x))) 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^2). The TRS R consists of the following rules: -(x, 0) -> x -(s(x), s(y)) -> -(x, y) p(s(x)) -> x f(s(x), y) -> f(p(-(s(x), y)), p(-(y, s(x)))) f(x, s(y)) -> f(p(-(x, s(y))), p(-(s(y), x))) S is empty. Rewrite Strategy: INNERMOST