/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, 542 ms] (12) BOUNDS(1, n^2) (13) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (14) CpxTRS (15) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (16) typed CpxTrs (17) OrderProof [LOWER BOUND(ID), 0 ms] (18) typed CpxTrs (19) RewriteLemmaProof [LOWER BOUND(ID), 290 ms] (20) BEST (21) proven lower bound (22) LowerBoundPropagationProof [FINISHED, 0 ms] (23) BOUNDS(n^1, INF) (24) typed CpxTrs (25) RewriteLemmaProof [LOWER BOUND(ID), 27 ms] (26) typed CpxTrs ---------------------------------------- (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: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0 cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0, v) -> false gt(s(u), 0) -> true gt(s(u), s(v)) -> gt(u, v) equal(0, 0) -> true equal(s(x), 0) -> false equal(0, s(y)) -> false equal(s(x), s(y)) -> equal(x, y) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: diff([], y) diff(x, []) cond1(false, [], y) cond1(false, x, []) The defined contexts are: cond2([], x1, x2) cond1([], x1, x2) [] just represents basic- or constructor-terms in the following defined contexts: cond2([], x1, x2) cond1([], x1, x2) 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: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0 cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0, v) -> false gt(s(u), 0) -> true gt(s(u), s(v)) -> gt(u, v) equal(0, 0) -> true equal(s(x), 0) -> false equal(0, s(y)) -> false equal(s(x), s(y)) -> equal(x, y) 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: diff(x, y) -> cond1(equal(x, y), x, y) [1] cond1(true, x, y) -> 0 [1] cond1(false, x, y) -> cond2(gt(x, y), x, y) [1] cond2(true, x, y) -> s(diff(x, s(y))) [1] cond2(false, x, y) -> s(diff(s(x), y)) [1] gt(0, v) -> false [1] gt(s(u), 0) -> true [1] gt(s(u), s(v)) -> gt(u, v) [1] equal(0, 0) -> true [1] equal(s(x), 0) -> false [1] equal(0, s(y)) -> false [1] equal(s(x), s(y)) -> equal(x, 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: diff(x, y) -> cond1(equal(x, y), x, y) [1] cond1(true, x, y) -> 0 [1] cond1(false, x, y) -> cond2(gt(x, y), x, y) [1] cond2(true, x, y) -> s(diff(x, s(y))) [1] cond2(false, x, y) -> s(diff(s(x), y)) [1] gt(0, v) -> false [1] gt(s(u), 0) -> true [1] gt(s(u), s(v)) -> gt(u, v) [1] equal(0, 0) -> true [1] equal(s(x), 0) -> false [1] equal(0, s(y)) -> false [1] equal(s(x), s(y)) -> equal(x, y) [1] The TRS has the following type information: diff :: 0:s -> 0:s -> 0:s cond1 :: true:false -> 0:s -> 0:s -> 0:s equal :: 0:s -> 0:s -> true:false true :: true:false 0 :: 0:s false :: true:false cond2 :: true:false -> 0:s -> 0:s -> 0:s gt :: 0:s -> 0:s -> true:false s :: 0:s -> 0:s 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: none And the following fresh constants: none ---------------------------------------- (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: diff(x, y) -> cond1(equal(x, y), x, y) [1] cond1(true, x, y) -> 0 [1] cond1(false, x, y) -> cond2(gt(x, y), x, y) [1] cond2(true, x, y) -> s(diff(x, s(y))) [1] cond2(false, x, y) -> s(diff(s(x), y)) [1] gt(0, v) -> false [1] gt(s(u), 0) -> true [1] gt(s(u), s(v)) -> gt(u, v) [1] equal(0, 0) -> true [1] equal(s(x), 0) -> false [1] equal(0, s(y)) -> false [1] equal(s(x), s(y)) -> equal(x, y) [1] The TRS has the following type information: diff :: 0:s -> 0:s -> 0:s cond1 :: true:false -> 0:s -> 0:s -> 0:s equal :: 0:s -> 0:s -> true:false true :: true:false 0 :: 0:s false :: true:false cond2 :: true:false -> 0:s -> 0:s -> 0:s gt :: 0:s -> 0:s -> true:false s :: 0:s -> 0:s 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 0 => 0 false => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: cond1(z, z', z'') -{ 1 }-> cond2(gt(x, y), x, y) :|: z' = x, z'' = y, x >= 0, y >= 0, z = 0 cond1(z, z', z'') -{ 1 }-> 0 :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 cond2(z, z', z'') -{ 1 }-> 1 + diff(x, 1 + y) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 cond2(z, z', z'') -{ 1 }-> 1 + diff(1 + x, y) :|: z' = x, z'' = y, x >= 0, y >= 0, z = 0 diff(z, z') -{ 1 }-> cond1(equal(x, y), x, y) :|: x >= 0, y >= 0, z = x, z' = y equal(z, z') -{ 1 }-> equal(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x equal(z, z') -{ 1 }-> 1 :|: z = 0, z' = 0 equal(z, z') -{ 1 }-> 0 :|: x >= 0, z = 1 + x, z' = 0 equal(z, z') -{ 1 }-> 0 :|: z' = 1 + y, y >= 0, z = 0 gt(z, z') -{ 1 }-> gt(u, v) :|: v >= 0, z' = 1 + v, z = 1 + u, u >= 0 gt(z, z') -{ 1 }-> 1 :|: z = 1 + u, z' = 0, u >= 0 gt(z, z') -{ 1 }-> 0 :|: v >= 0, z' = v, 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,[diff(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V5),0,[cond1(V1, V, V5, Out)],[V1 >= 0,V >= 0,V5 >= 0]). eq(start(V1, V, V5),0,[cond2(V1, V, V5, Out)],[V1 >= 0,V >= 0,V5 >= 0]). eq(start(V1, V, V5),0,[gt(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V5),0,[equal(V1, V, Out)],[V1 >= 0,V >= 0]). eq(diff(V1, V, Out),1,[equal(V3, V2, Ret0),cond1(Ret0, V3, V2, Ret)],[Out = Ret,V3 >= 0,V2 >= 0,V1 = V3,V = V2]). eq(cond1(V1, V, V5, Out),1,[],[Out = 0,V = V4,V5 = V6,V1 = 1,V4 >= 0,V6 >= 0]). eq(cond1(V1, V, V5, Out),1,[gt(V8, V7, Ret01),cond2(Ret01, V8, V7, Ret1)],[Out = Ret1,V = V8,V5 = V7,V8 >= 0,V7 >= 0,V1 = 0]). eq(cond2(V1, V, V5, Out),1,[diff(V9, 1 + V10, Ret11)],[Out = 1 + Ret11,V = V9,V5 = V10,V1 = 1,V9 >= 0,V10 >= 0]). eq(cond2(V1, V, V5, Out),1,[diff(1 + V12, V11, Ret12)],[Out = 1 + Ret12,V = V12,V5 = V11,V12 >= 0,V11 >= 0,V1 = 0]). eq(gt(V1, V, Out),1,[],[Out = 0,V13 >= 0,V = V13,V1 = 0]). eq(gt(V1, V, Out),1,[],[Out = 1,V1 = 1 + V14,V = 0,V14 >= 0]). eq(gt(V1, V, Out),1,[gt(V16, V15, Ret2)],[Out = Ret2,V15 >= 0,V = 1 + V15,V1 = 1 + V16,V16 >= 0]). eq(equal(V1, V, Out),1,[],[Out = 1,V1 = 0,V = 0]). eq(equal(V1, V, Out),1,[],[Out = 0,V17 >= 0,V1 = 1 + V17,V = 0]). eq(equal(V1, V, Out),1,[],[Out = 0,V = 1 + V18,V18 >= 0,V1 = 0]). eq(equal(V1, V, Out),1,[equal(V20, V19, Ret3)],[Out = Ret3,V = 1 + V19,V20 >= 0,V19 >= 0,V1 = 1 + V20]). input_output_vars(diff(V1,V,Out),[V1,V],[Out]). input_output_vars(cond1(V1,V,V5,Out),[V1,V,V5],[Out]). input_output_vars(cond2(V1,V,V5,Out),[V1,V,V5],[Out]). input_output_vars(gt(V1,V,Out),[V1,V],[Out]). input_output_vars(equal(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [equal/3] 1. recursive : [gt/3] 2. recursive : [cond1/4,cond2/4,diff/3] 3. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into equal/3 1. SCC is partially evaluated into gt/3 2. SCC is partially evaluated into diff/3 3. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations equal/3 * CE 18 is refined into CE [19] * CE 16 is refined into CE [20] * CE 17 is refined into CE [21] * CE 15 is refined into CE [22] ### Cost equations --> "Loop" of equal/3 * CEs [20] --> Loop 13 * CEs [21] --> Loop 14 * CEs [22] --> Loop 15 * CEs [19] --> Loop 16 ### Ranking functions of CR equal(V1,V,Out) * RF of phase [16]: [V,V1] #### Partial ranking functions of CR equal(V1,V,Out) * Partial RF of phase [16]: - RF of loop [16:1]: V V1 ### Specialization of cost equations gt/3 * CE 11 is refined into CE [23] * CE 10 is refined into CE [24] * CE 9 is refined into CE [25] ### Cost equations --> "Loop" of gt/3 * CEs [24] --> Loop 17 * CEs [25] --> Loop 18 * CEs [23] --> Loop 19 ### Ranking functions of CR gt(V1,V,Out) * RF of phase [19]: [V,V1] #### Partial ranking functions of CR gt(V1,V,Out) * Partial RF of phase [19]: - RF of loop [19:1]: V V1 ### Specialization of cost equations diff/3 * CE 13 is refined into CE [26,27] * CE 14 is refined into CE [28,29] * CE 12 is refined into CE [30,31] ### Cost equations --> "Loop" of diff/3 * CEs [31] --> Loop 20 * CEs [30] --> Loop 21 * CEs [27] --> Loop 22 * CEs [29] --> Loop 23 * CEs [26] --> Loop 24 * CEs [28] --> Loop 25 ### Ranking functions of CR diff(V1,V,Out) * RF of phase [22]: [V1-V] * RF of phase [23]: [-V1+V] #### Partial ranking functions of CR diff(V1,V,Out) * Partial RF of phase [22]: - RF of loop [22:1]: V1-V * Partial RF of phase [23]: - RF of loop [23:1]: -V1+V ### Specialization of cost equations start/3 * CE 1 is refined into CE [32] * CE 5 is refined into CE [33,34,35,36,37] * CE 2 is refined into CE [38,39,40,41] * CE 3 is refined into CE [42,43,44,45,46,47] * CE 4 is refined into CE [48,49,50,51,52] * CE 6 is refined into CE [53,54,55,56,57,58,59,60] * CE 7 is refined into CE [61,62,63,64] * CE 8 is refined into CE [65,66,67,68,69,70] ### Cost equations --> "Loop" of start/3 * CEs [59,64,69] --> Loop 26 * CEs [58,60,63,68,70] --> Loop 27 * CEs [32,35,36,37] --> Loop 28 * CEs [33,34,56,57,62,67] --> Loop 29 * CEs [40] --> Loop 30 * CEs [46] --> Loop 31 * CEs [45,50] --> Loop 32 * CEs [39,49] --> Loop 33 * CEs [38,54] --> Loop 34 * CEs [41,42,43,44,47,48,51,52,53,55,61,65,66] --> Loop 35 ### Ranking functions of CR start(V1,V,V5) #### Partial ranking functions of CR start(V1,V,V5) Computing Bounds ===================================== #### Cost of chains of equal(V1,V,Out): * Chain [[16],15]: 1*it(16)+1 Such that:it(16) =< V1 with precondition: [Out=1,V1=V,V1>=1] * Chain [[16],14]: 1*it(16)+1 Such that:it(16) =< V1 with precondition: [Out=0,V1>=1,V>=V1+1] * Chain [[16],13]: 1*it(16)+1 Such that:it(16) =< V with precondition: [Out=0,V>=1,V1>=V+1] * Chain [15]: 1 with precondition: [V1=0,V=0,Out=1] * Chain [14]: 1 with precondition: [V1=0,Out=0,V>=1] * Chain [13]: 1 with precondition: [V=0,Out=0,V1>=1] #### Cost of chains of gt(V1,V,Out): * Chain [[19],18]: 1*it(19)+1 Such that:it(19) =< V1 with precondition: [Out=0,V1>=1,V>=V1] * Chain [[19],17]: 1*it(19)+1 Such that:it(19) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [18]: 1 with precondition: [V1=0,Out=0,V>=0] * Chain [17]: 1 with precondition: [V=0,Out=1,V1>=1] #### Cost of chains of diff(V1,V,Out): * Chain [[23],20]: 5*it(23)+1*s(1)+2*s(6)+3 Such that:it(23) =< Out aux(3) =< V s(1) =< aux(3) s(7) =< it(23)*aux(3) s(6) =< s(7) with precondition: [Out+V1=V,V1>=1,V>=V1+1] * Chain [[22],20]: 5*it(22)+1*s(1)+2*s(12)+3 Such that:it(22) =< Out aux(6) =< V+Out s(1) =< aux(6) s(13) =< it(22)*aux(6) s(12) =< s(13) with precondition: [V1=Out+V,V>=1,V1>=V+1] * Chain [25,[23],20]: 6*it(23)+2*s(6)+8 Such that:aux(7) =< Out it(23) =< aux(7) s(7) =< it(23)*aux(7) s(6) =< s(7) with precondition: [V1=0,V=Out,V>=2] * Chain [25,20]: 1*s(1)+8 Such that:s(1) =< 1 with precondition: [V1=0,V=1,Out=1] * Chain [24,[22],20]: 6*it(22)+2*s(12)+8 Such that:aux(8) =< Out it(22) =< aux(8) s(13) =< it(22)*aux(8) s(12) =< s(13) with precondition: [V=0,V1=Out,V1>=2] * Chain [24,20]: 1*s(1)+8 Such that:s(1) =< 1 with precondition: [V1=1,V=0,Out=1] * Chain [21]: 3 with precondition: [V1=0,V=0,Out=0] * Chain [20]: 1*s(1)+3 Such that:s(1) =< V with precondition: [Out=0,V=V1,V>=1] #### Cost of chains of start(V1,V,V5): * Chain [35]: 9*s(14)+5*s(15)+8*s(17)+2*s(19)+3*s(20)+2*s(26)+10*s(28)+4*s(32)+5*s(34)+1*s(36)+2*s(38)+2*s(47)+11 Such that:s(35) =< V+1 s(15) =< V-V5 s(34) =< V-V5+1 aux(10) =< 1 aux(11) =< -V+V5 aux(12) =< V aux(13) =< V5 s(20) =< aux(10) s(28) =< aux(11) s(17) =< aux(12) s(14) =< aux(13) s(31) =< s(28)*aux(13) s(32) =< s(31) s(18) =< s(15)*aux(12) s(19) =< s(18) s(46) =< s(17)*aux(12) s(47) =< s(46) s(36) =< s(35) s(37) =< s(34)*s(35) s(38) =< s(37) s(25) =< s(14)*aux(13) s(26) =< s(25) with precondition: [V1=0,V>=0] * Chain [34]: 10 with precondition: [V1=0,V=1] * Chain [33]: 6*s(50)+2*s(54)+6*s(56)+2*s(58)+9 Such that:aux(15) =< V s(55) =< V+1 s(50) =< aux(15) s(53) =< s(50)*aux(15) s(54) =< s(53) s(56) =< s(55) s(57) =< s(56)*s(55) s(58) =< s(57) with precondition: [V1=0,V5=0,V>=1] * Chain [32]: 2*s(59)+1*s(61)+6 Such that:s(61) =< V+1 aux(16) =< V5 s(59) =< aux(16) with precondition: [V1=0,V+1=V5,V>=0] * Chain [31]: 1*s(62)+5*s(63)+1*s(65)+2*s(67)+6 Such that:s(63) =< 1 s(62) =< V5 s(64) =< V5+1 s(65) =< s(64) s(66) =< s(63)*s(64) s(67) =< s(66) with precondition: [V1=0,V=V5,V>=1] * Chain [30]: 1*s(68)+1*s(69)+6 Such that:s(68) =< V5 s(69) =< V5+1 with precondition: [V1=0,V=V5+1,V>=2] * Chain [29]: 2*s(70)+6*s(72)+2*s(74)+6*s(77)+2*s(79)+9 Such that:s(76) =< V1 s(71) =< V5+1 aux(17) =< 1 s(70) =< aux(17) s(77) =< s(76) s(78) =< s(77)*s(76) s(79) =< s(78) s(72) =< s(71) s(73) =< s(72)*s(71) s(74) =< s(73) with precondition: [V=0,V1>=1] * Chain [28]: 2*s(80)+5*s(81)+1*s(83)+2*s(85)+5*s(86)+2*s(90)+4 Such that:s(86) =< -V+V5+1 s(82) =< V s(81) =< V-V5 aux(18) =< V5+1 s(80) =< aux(18) s(89) =< s(86)*aux(18) s(90) =< s(89) s(83) =< s(82) s(84) =< s(81)*s(82) s(85) =< s(84) with precondition: [V1=1,V>=0,V5>=0] * Chain [27]: 3*s(91)+5*s(92)+2*s(96)+2*s(97)+3 Such that:s(92) =< -V1+V aux(19) =< V1 aux(20) =< V s(97) =< aux(19) s(91) =< aux(20) s(95) =< s(92)*aux(20) s(96) =< s(95) with precondition: [V1>=1,V>=V1] * Chain [26]: 5*s(100)+1*s(102)+2*s(104)+2*s(105)+3 Such that:s(101) =< V1 s(100) =< V1-V aux(21) =< V s(105) =< aux(21) s(102) =< s(101) s(103) =< s(100)*s(101) s(104) =< s(103) with precondition: [V>=1,V1>=V+1] Closed-form bounds of start(V1,V,V5): ------------------------------------- * Chain [35] with precondition: [V1=0,V>=0] - Upper bound: 8*V+14+2*V*V+2*V*nat(V-V5)+nat(V5)*9+nat(V5)*2*nat(V5)+nat(V5)*4*nat(-V+V5)+(V+1)+(2*V+2)*nat(V-V5+1)+nat(-V+V5)*10+nat(V-V5+1)*5+nat(V-V5)*5 - Complexity: n^2 * Chain [34] with precondition: [V1=0,V=1] - Upper bound: 10 - Complexity: constant * Chain [33] with precondition: [V1=0,V5=0,V>=1] - Upper bound: 6*V+9+2*V*V+(6*V+6)+(2*V+2)*(V+1) - Complexity: n^2 * Chain [32] with precondition: [V1=0,V+1=V5,V>=0] - Upper bound: V+2*V5+7 - Complexity: n * Chain [31] with precondition: [V1=0,V=V5,V>=1] - Upper bound: 4*V5+14 - Complexity: n * Chain [30] with precondition: [V1=0,V=V5+1,V>=2] - Upper bound: 2*V5+7 - Complexity: n * Chain [29] with precondition: [V=0,V1>=1] - Upper bound: 6*V1+11+2*V1*V1+nat(V5+1)*6+nat(V5+1)*2*nat(V5+1) - Complexity: n^2 * Chain [28] with precondition: [V1=1,V>=0,V5>=0] - Upper bound: V+4+2*V*nat(V-V5)+(2*V5+2)+(2*V5+2)*nat(-V+V5+1)+nat(-V+V5+1)*5+nat(V-V5)*5 - Complexity: n^2 * Chain [27] with precondition: [V1>=1,V>=V1] - Upper bound: 2*V1+3*V+3+(-V1+V)*(2*V)+(-5*V1+5*V) - Complexity: n^2 * Chain [26] with precondition: [V>=1,V1>=V+1] - Upper bound: 5*V1-5*V+(V1+3+(V1-V)*(2*V1)+2*V) - Complexity: n^2 ### Maximum cost of start(V1,V,V5): max([max([max([max([2*V*nat(-V1+V)+2*V1+nat(-V1+V)*5,3*V+6+2*V*V+(V+1)+max([5*V+5+(2*V+2)*(V+1),2*V+5+2*V*nat(V-V5)+nat(V5)*9+nat(V5)*2*nat(V5)+nat(V5)*4*nat(-V+V5)+(2*V+2)*nat(V-V5+1)+nat(-V+V5)*10+nat(V-V5+1)*5+nat(V-V5)*5])])+V,2*V1*nat(V1-V)+V1+nat(V1-V)*5])+V,2*V*nat(V-V5)+1+nat(V5+1)*2+nat(V5+1)*2*nat(-V+V5+1)+nat(-V+V5+1)*5+nat(V-V5)*5])+V,max([nat(V5)+max([V+1+nat(V5),nat(V5+1)*2+5+nat(V5+1)]),6*V1+1+2*V1*V1+nat(V5+1)*6+nat(V5+1)*2*nat(V5+1)+4])+3])+3 Asymptotic class: n^2 * Total analysis performed in 451 ms. ---------------------------------------- (12) BOUNDS(1, n^2) ---------------------------------------- (13) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (14) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0' cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0', v) -> false gt(s(u), 0') -> true gt(s(u), s(v)) -> gt(u, v) equal(0', 0') -> true equal(s(x), 0') -> false equal(0', s(y)) -> false equal(s(x), s(y)) -> equal(x, y) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: TRS: Rules: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0' cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0', v) -> false gt(s(u), 0') -> true gt(s(u), s(v)) -> gt(u, v) equal(0', 0') -> true equal(s(x), 0') -> false equal(0', s(y)) -> false equal(s(x), s(y)) -> equal(x, y) Types: diff :: 0':s -> 0':s -> 0':s cond1 :: true:false -> 0':s -> 0':s -> 0':s equal :: 0':s -> 0':s -> true:false true :: true:false 0' :: 0':s false :: true:false cond2 :: true:false -> 0':s -> 0':s -> 0':s gt :: 0':s -> 0':s -> true:false s :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_true:false2_0 :: true:false gen_0':s3_0 :: Nat -> 0':s ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: diff, equal, gt They will be analysed ascendingly in the following order: equal < diff gt < diff ---------------------------------------- (18) Obligation: TRS: Rules: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0' cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0', v) -> false gt(s(u), 0') -> true gt(s(u), s(v)) -> gt(u, v) equal(0', 0') -> true equal(s(x), 0') -> false equal(0', s(y)) -> false equal(s(x), s(y)) -> equal(x, y) Types: diff :: 0':s -> 0':s -> 0':s cond1 :: true:false -> 0':s -> 0':s -> 0':s equal :: 0':s -> 0':s -> true:false true :: true:false 0' :: 0':s false :: true:false cond2 :: true:false -> 0':s -> 0':s -> 0':s gt :: 0':s -> 0':s -> true:false s :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_true:false2_0 :: true:false gen_0':s3_0 :: Nat -> 0':s Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: equal, diff, gt They will be analysed ascendingly in the following order: equal < diff gt < diff ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: equal(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) -> true, rt in Omega(1 + n5_0) Induction Base: equal(gen_0':s3_0(0), gen_0':s3_0(0)) ->_R^Omega(1) true Induction Step: equal(gen_0':s3_0(+(n5_0, 1)), gen_0':s3_0(+(n5_0, 1))) ->_R^Omega(1) equal(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) ->_IH true We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (20) Complex Obligation (BEST) ---------------------------------------- (21) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0' cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0', v) -> false gt(s(u), 0') -> true gt(s(u), s(v)) -> gt(u, v) equal(0', 0') -> true equal(s(x), 0') -> false equal(0', s(y)) -> false equal(s(x), s(y)) -> equal(x, y) Types: diff :: 0':s -> 0':s -> 0':s cond1 :: true:false -> 0':s -> 0':s -> 0':s equal :: 0':s -> 0':s -> true:false true :: true:false 0' :: 0':s false :: true:false cond2 :: true:false -> 0':s -> 0':s -> 0':s gt :: 0':s -> 0':s -> true:false s :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_true:false2_0 :: true:false gen_0':s3_0 :: Nat -> 0':s Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: equal, diff, gt They will be analysed ascendingly in the following order: equal < diff gt < diff ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: TRS: Rules: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0' cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0', v) -> false gt(s(u), 0') -> true gt(s(u), s(v)) -> gt(u, v) equal(0', 0') -> true equal(s(x), 0') -> false equal(0', s(y)) -> false equal(s(x), s(y)) -> equal(x, y) Types: diff :: 0':s -> 0':s -> 0':s cond1 :: true:false -> 0':s -> 0':s -> 0':s equal :: 0':s -> 0':s -> true:false true :: true:false 0' :: 0':s false :: true:false cond2 :: true:false -> 0':s -> 0':s -> 0':s gt :: 0':s -> 0':s -> true:false s :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_true:false2_0 :: true:false gen_0':s3_0 :: Nat -> 0':s Lemmas: equal(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) -> true, rt in Omega(1 + n5_0) Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: gt, diff They will be analysed ascendingly in the following order: gt < diff ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: gt(gen_0':s3_0(n476_0), gen_0':s3_0(n476_0)) -> false, rt in Omega(1 + n476_0) Induction Base: gt(gen_0':s3_0(0), gen_0':s3_0(0)) ->_R^Omega(1) false Induction Step: gt(gen_0':s3_0(+(n476_0, 1)), gen_0':s3_0(+(n476_0, 1))) ->_R^Omega(1) gt(gen_0':s3_0(n476_0), gen_0':s3_0(n476_0)) ->_IH false We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (26) Obligation: TRS: Rules: diff(x, y) -> cond1(equal(x, y), x, y) cond1(true, x, y) -> 0' cond1(false, x, y) -> cond2(gt(x, y), x, y) cond2(true, x, y) -> s(diff(x, s(y))) cond2(false, x, y) -> s(diff(s(x), y)) gt(0', v) -> false gt(s(u), 0') -> true gt(s(u), s(v)) -> gt(u, v) equal(0', 0') -> true equal(s(x), 0') -> false equal(0', s(y)) -> false equal(s(x), s(y)) -> equal(x, y) Types: diff :: 0':s -> 0':s -> 0':s cond1 :: true:false -> 0':s -> 0':s -> 0':s equal :: 0':s -> 0':s -> true:false true :: true:false 0' :: 0':s false :: true:false cond2 :: true:false -> 0':s -> 0':s -> 0':s gt :: 0':s -> 0':s -> true:false s :: 0':s -> 0':s hole_0':s1_0 :: 0':s hole_true:false2_0 :: true:false gen_0':s3_0 :: Nat -> 0':s Lemmas: equal(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) -> true, rt in Omega(1 + n5_0) gt(gen_0':s3_0(n476_0), gen_0':s3_0(n476_0)) -> false, rt in Omega(1 + n476_0) Generator Equations: gen_0':s3_0(0) <=> 0' gen_0':s3_0(+(x, 1)) <=> s(gen_0':s3_0(x)) The following defined symbols remain to be analysed: diff