/export/starexec/sandbox/solver/bin/starexec_run_complexity /export/starexec/sandbox/benchmark/theBenchmark.xml /export/starexec/sandbox/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^1), O(n^2)) proof of /export/starexec/sandbox/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^2). (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), 0 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 324 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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) cond2(true, x, y) -> cond1(y, y) cond2(false, x, y) -> cond1(p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) neq(0, 0) -> false neq(0, s(x)) -> true neq(s(x), 0) -> true neq(s(x), s(y)) -> neq(x, y) p(0) -> 0 p(s(x)) -> x S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: cond1(s([]), y) cond1(s(x), []) cond2(true, x, []) The defined contexts are: cond2([], s(x1), x2) cond1([], x1) gr(s([]), x1) cond2(x0, s([]), x2) p([]) gr([], x1) [] just represents basic- or constructor-terms in the following defined contexts: cond2([], s(x1), x2) cond1([], x1) 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^2). The TRS R consists of the following rules: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) cond2(true, x, y) -> cond1(y, y) cond2(false, x, y) -> cond1(p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) neq(0, 0) -> false neq(0, s(x)) -> true neq(s(x), 0) -> true neq(s(x), s(y)) -> neq(x, y) p(0) -> 0 p(s(x)) -> 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^2). The TRS R consists of the following rules: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) [1] cond2(true, x, y) -> cond1(y, y) [1] cond2(false, x, y) -> cond1(p(x), y) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] neq(0, 0) -> false [1] neq(0, s(x)) -> true [1] neq(s(x), 0) -> true [1] neq(s(x), s(y)) -> neq(x, y) [1] p(0) -> 0 [1] p(s(x)) -> 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: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) [1] cond2(true, x, y) -> cond1(y, y) [1] cond2(false, x, y) -> cond1(p(x), y) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] neq(0, 0) -> false [1] neq(0, s(x)) -> true [1] neq(s(x), 0) -> true [1] neq(s(x), s(y)) -> neq(x, y) [1] p(0) -> 0 [1] p(s(x)) -> x [1] The TRS has the following type information: cond1 :: s:0 -> s:0 -> cond1:cond2 s :: s:0 -> s:0 cond2 :: true:false -> s:0 -> s:0 -> cond1:cond2 gr :: s:0 -> s:0 -> true:false true :: true:false false :: true:false p :: s:0 -> s:0 0 :: s:0 neq :: s:0 -> s:0 -> true:false 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: cond1(v0, v1) -> null_cond1 [0] And the following fresh constants: null_cond1 ---------------------------------------- (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: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) [1] cond2(true, x, y) -> cond1(y, y) [1] cond2(false, x, y) -> cond1(p(x), y) [1] gr(0, x) -> false [1] gr(s(x), 0) -> true [1] gr(s(x), s(y)) -> gr(x, y) [1] neq(0, 0) -> false [1] neq(0, s(x)) -> true [1] neq(s(x), 0) -> true [1] neq(s(x), s(y)) -> neq(x, y) [1] p(0) -> 0 [1] p(s(x)) -> x [1] cond1(v0, v1) -> null_cond1 [0] The TRS has the following type information: cond1 :: s:0 -> s:0 -> null_cond1 s :: s:0 -> s:0 cond2 :: true:false -> s:0 -> s:0 -> null_cond1 gr :: s:0 -> s:0 -> true:false true :: true:false false :: true:false p :: s:0 -> s:0 0 :: s:0 neq :: s:0 -> s:0 -> true:false null_cond1 :: null_cond1 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: true => 1 false => 0 0 => 0 null_cond1 => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: cond1(z, z') -{ 1 }-> cond2(gr(1 + x, y), 1 + x, y) :|: x >= 0, y >= 0, z = 1 + x, z' = y cond1(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 cond2(z, z', z'') -{ 1 }-> cond1(y, y) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 cond2(z, z', z'') -{ 1 }-> cond1(p(x), y) :|: z' = x, z'' = y, x >= 0, y >= 0, z = 0 gr(z, z') -{ 1 }-> gr(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x gr(z, z') -{ 1 }-> 1 :|: x >= 0, z = 1 + x, z' = 0 gr(z, z') -{ 1 }-> 0 :|: z' = x, x >= 0, z = 0 neq(z, z') -{ 1 }-> neq(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x neq(z, z') -{ 1 }-> 1 :|: z' = 1 + x, x >= 0, z = 0 neq(z, z') -{ 1 }-> 1 :|: x >= 0, z = 1 + x, z' = 0 neq(z, z') -{ 1 }-> 0 :|: z = 0, z' = 0 p(z) -{ 1 }-> x :|: x >= 0, z = 1 + x p(z) -{ 1 }-> 0 :|: z = 0 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, V5),0,[cond1(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V5),0,[cond2(V1, V, V5, Out)],[V1 >= 0,V >= 0,V5 >= 0]). eq(start(V1, V, V5),0,[gr(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V5),0,[neq(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V5),0,[p(V1, Out)],[V1 >= 0]). eq(cond1(V1, V, Out),1,[gr(1 + V3, V2, Ret0),cond2(Ret0, 1 + V3, V2, Ret)],[Out = Ret,V3 >= 0,V2 >= 0,V1 = 1 + V3,V = V2]). eq(cond2(V1, V, V5, Out),1,[cond1(V6, V6, Ret1)],[Out = Ret1,V = V4,V5 = V6,V1 = 1,V4 >= 0,V6 >= 0]). eq(cond2(V1, V, V5, Out),1,[p(V8, Ret01),cond1(Ret01, V7, Ret2)],[Out = Ret2,V = V8,V5 = V7,V8 >= 0,V7 >= 0,V1 = 0]). eq(gr(V1, V, Out),1,[],[Out = 0,V = V9,V9 >= 0,V1 = 0]). eq(gr(V1, V, Out),1,[],[Out = 1,V10 >= 0,V1 = 1 + V10,V = 0]). eq(gr(V1, V, Out),1,[gr(V12, V11, Ret3)],[Out = Ret3,V = 1 + V11,V12 >= 0,V11 >= 0,V1 = 1 + V12]). eq(neq(V1, V, Out),1,[],[Out = 0,V1 = 0,V = 0]). eq(neq(V1, V, Out),1,[],[Out = 1,V = 1 + V13,V13 >= 0,V1 = 0]). eq(neq(V1, V, Out),1,[],[Out = 1,V14 >= 0,V1 = 1 + V14,V = 0]). eq(neq(V1, V, Out),1,[neq(V16, V15, Ret4)],[Out = Ret4,V = 1 + V15,V16 >= 0,V15 >= 0,V1 = 1 + V16]). eq(p(V1, Out),1,[],[Out = 0,V1 = 0]). eq(p(V1, Out),1,[],[Out = V17,V17 >= 0,V1 = 1 + V17]). eq(cond1(V1, V, Out),0,[],[Out = 0,V19 >= 0,V18 >= 0,V1 = V19,V = V18]). input_output_vars(cond1(V1,V,Out),[V1,V],[Out]). input_output_vars(cond2(V1,V,V5,Out),[V1,V,V5],[Out]). input_output_vars(gr(V1,V,Out),[V1,V],[Out]). input_output_vars(neq(V1,V,Out),[V1,V],[Out]). input_output_vars(p(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [p/2] 1. recursive : [gr/3] 2. recursive : [cond1/3,cond2/4] 3. recursive : [neq/3] 4. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into p/2 1. SCC is partially evaluated into gr/3 2. SCC is partially evaluated into cond1/3 3. SCC is partially evaluated into neq/3 4. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations p/2 * CE 8 is refined into CE [19] * CE 7 is refined into CE [20] ### Cost equations --> "Loop" of p/2 * CEs [19] --> Loop 14 * CEs [20] --> Loop 15 ### Ranking functions of CR p(V1,Out) #### Partial ranking functions of CR p(V1,Out) ### Specialization of cost equations gr/3 * CE 14 is refined into CE [21] * CE 13 is refined into CE [22] * CE 12 is refined into CE [23] ### Cost equations --> "Loop" of gr/3 * CEs [22] --> Loop 16 * CEs [23] --> Loop 17 * CEs [21] --> Loop 18 ### Ranking functions of CR gr(V1,V,Out) * RF of phase [18]: [V,V1] #### Partial ranking functions of CR gr(V1,V,Out) * Partial RF of phase [18]: - RF of loop [18:1]: V V1 ### Specialization of cost equations cond1/3 * CE 11 is refined into CE [24] * CE 9 is refined into CE [25] * CE 10 is refined into CE [26,27] ### Cost equations --> "Loop" of cond1/3 * CEs [27] --> Loop 19 * CEs [25] --> Loop 20 * CEs [26] --> Loop 21 * CEs [24] --> Loop 22 ### Ranking functions of CR cond1(V1,V,Out) * RF of phase [20]: [V1] #### Partial ranking functions of CR cond1(V1,V,Out) * Partial RF of phase [20]: - RF of loop [20:1]: V1 ### Specialization of cost equations neq/3 * CE 18 is refined into CE [28] * CE 17 is refined into CE [29] * CE 16 is refined into CE [30] * CE 15 is refined into CE [31] ### Cost equations --> "Loop" of neq/3 * CEs [29] --> Loop 23 * CEs [30] --> Loop 24 * CEs [31] --> Loop 25 * CEs [28] --> Loop 26 ### Ranking functions of CR neq(V1,V,Out) * RF of phase [26]: [V,V1] #### Partial ranking functions of CR neq(V1,V,Out) * Partial RF of phase [26]: - RF of loop [26:1]: V V1 ### Specialization of cost equations start/3 * CE 2 is refined into CE [32] * CE 1 is refined into CE [33,34] * CE 3 is refined into CE [35] * CE 4 is refined into CE [36,37,38,39] * CE 5 is refined into CE [40,41,42,43,44,45] * CE 6 is refined into CE [46,47] ### Cost equations --> "Loop" of start/3 * CEs [43] --> Loop 27 * CEs [37,42,47] --> Loop 28 * CEs [32,35,38,39,44,45] --> Loop 29 * CEs [33,34,36,40,41,46] --> Loop 30 ### Ranking functions of CR start(V1,V,V5) #### Partial ranking functions of CR start(V1,V,V5) Computing Bounds ===================================== #### Cost of chains of p(V1,Out): * Chain [15]: 1 with precondition: [V1=0,Out=0] * Chain [14]: 1 with precondition: [V1=Out+1,V1>=1] #### Cost of chains of gr(V1,V,Out): * Chain [[18],17]: 1*it(18)+1 Such that:it(18) =< V1 with precondition: [Out=0,V1>=1,V>=V1] * Chain [[18],16]: 1*it(18)+1 Such that:it(18) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [17]: 1 with precondition: [V1=0,Out=0,V>=0] * Chain [16]: 1 with precondition: [V=0,Out=1,V1>=1] #### Cost of chains of cond1(V1,V,Out): * Chain [[20],22]: 4*it(20)+1*s(3)+0 Such that:aux(3) =< V1 it(20) =< aux(3) s(3) =< it(20)*aux(3) with precondition: [Out=0,V1>=1,V>=V1] * Chain [22]: 0 with precondition: [Out=0,V1>=0,V>=0] * Chain [21,22]: 3 with precondition: [V=0,Out=0,V1>=1] * Chain [19,[20],22]: 5*it(20)+1*s(3)+3 Such that:aux(4) =< V it(20) =< aux(4) s(3) =< it(20)*aux(4) with precondition: [Out=0,V>=1,V1>=V+1] * Chain [19,22]: 1*s(4)+3 Such that:s(4) =< V with precondition: [Out=0,V>=1,V1>=V+1] #### Cost of chains of neq(V1,V,Out): * Chain [[26],25]: 1*it(26)+1 Such that:it(26) =< V1 with precondition: [Out=0,V1=V,V1>=1] * Chain [[26],24]: 1*it(26)+1 Such that:it(26) =< V1 with precondition: [Out=1,V1>=1,V>=V1+1] * Chain [[26],23]: 1*it(26)+1 Such that:it(26) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [25]: 1 with precondition: [V1=0,V=0,Out=0] * Chain [24]: 1 with precondition: [V1=0,Out=1,V>=1] * Chain [23]: 1 with precondition: [V=0,Out=1,V1>=1] #### Cost of chains of start(V1,V,V5): * Chain [30]: 12*s(14)+2*s(17)+4*s(21)+1*s(22)+5 Such that:s(18) =< V aux(6) =< V5 s(14) =< aux(6) s(21) =< s(18) s(22) =< s(21)*s(18) s(17) =< s(14)*aux(6) with precondition: [V1=0] * Chain [29]: 10*s(26)+2*s(28)+8*s(32)+6*s(33)+1*s(34)+1*s(35)+4 Such that:aux(7) =< V5 aux(8) =< V1 aux(9) =< V s(33) =< aux(8) s(32) =< aux(9) s(34) =< s(33)*aux(8) s(35) =< s(32)*aux(9) s(26) =< aux(7) s(28) =< s(26)*aux(7) with precondition: [V1>=0,V>=0] * Chain [28]: 1 with precondition: [V1>=1] * Chain [27]: 1*s(40)+1 Such that:s(40) =< V with precondition: [V1=V,V1>=1] Closed-form bounds of start(V1,V,V5): ------------------------------------- * Chain [30] with precondition: [V1=0] - Upper bound: nat(V)*4+5+nat(V)*nat(V)+nat(V5)*12+nat(V5)*2*nat(V5) - Complexity: n^2 * Chain [29] with precondition: [V1>=0,V>=0] - Upper bound: 6*V1+4+V1*V1+8*V+V*V+nat(V5)*10+nat(V5)*2*nat(V5) - Complexity: n^2 * Chain [28] with precondition: [V1>=1] - Upper bound: 1 - Complexity: constant * Chain [27] with precondition: [V1=V,V1>=1] - Upper bound: V+1 - Complexity: n ### Maximum cost of start(V1,V,V5): nat(V)*3+3+nat(V)*nat(V)+nat(V5)*10+nat(V5)*2*nat(V5)+max([nat(V5)*2+1,6*V1+V1*V1+nat(V)*4])+nat(V)+1 Asymptotic class: n^2 * Total analysis performed in 243 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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) cond2(true, x, y) -> cond1(y, y) cond2(false, x, y) -> cond1(p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) neq(0, 0) -> false neq(0, s(x)) -> true neq(s(x), 0) -> true neq(s(x), s(y)) -> neq(x, y) p(0) -> 0 p(s(x)) -> 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 neq(s(x), s(y)) ->^+ neq(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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). The TRS R consists of the following rules: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) cond2(true, x, y) -> cond1(y, y) cond2(false, x, y) -> cond1(p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) neq(0, 0) -> false neq(0, s(x)) -> true neq(s(x), 0) -> true neq(s(x), s(y)) -> neq(x, y) p(0) -> 0 p(s(x)) -> 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^2). The TRS R consists of the following rules: cond1(s(x), y) -> cond2(gr(s(x), y), s(x), y) cond2(true, x, y) -> cond1(y, y) cond2(false, x, y) -> cond1(p(x), y) gr(0, x) -> false gr(s(x), 0) -> true gr(s(x), s(y)) -> gr(x, y) neq(0, 0) -> false neq(0, s(x)) -> true neq(s(x), 0) -> true neq(s(x), s(y)) -> neq(x, y) p(0) -> 0 p(s(x)) -> x S is empty. Rewrite Strategy: FULL