/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 (full) of the given CpxTRS could be proven to be BOUNDS(n^1, n^2). (0) CpxTRS (1) RcToIrcProof [BOTH BOUNDS(ID, ID), 15 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, 806 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), 272 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), 60 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: gt(s(x), 0) -> true gt(0, y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0, 0, z) -> true div(0, s(x), z) -> false div(s(x), 0, s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: divides(x, []) div(s(x), 0, s([])) test([], y) test(x, []) if1(true, [], y) if1(true, x, []) The defined contexts are: if2([], x1, x2) if1([], x1, x2) [] just represents basic- or constructor-terms in the following defined contexts: if2([], x1, x2) if1([], 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: gt(s(x), 0) -> true gt(0, y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0, 0, z) -> true div(0, s(x), z) -> false div(s(x), 0, s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(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: gt(s(x), 0) -> true [1] gt(0, y) -> false [1] gt(s(x), s(y)) -> gt(x, y) [1] divides(x, y) -> div(x, y, y) [1] div(0, 0, z) -> true [1] div(0, s(x), z) -> false [1] div(s(x), 0, s(z)) -> div(s(x), s(z), s(z)) [1] div(s(x), s(y), z) -> div(x, y, z) [1] prime(x) -> test(x, s(s(0))) [1] test(x, y) -> if1(gt(x, y), x, y) [1] if1(true, x, y) -> if2(divides(x, y), x, y) [1] if1(false, x, y) -> true [1] if2(true, x, y) -> false [1] if2(false, x, y) -> test(x, s(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: gt(s(x), 0) -> true [1] gt(0, y) -> false [1] gt(s(x), s(y)) -> gt(x, y) [1] divides(x, y) -> div(x, y, y) [1] div(0, 0, z) -> true [1] div(0, s(x), z) -> false [1] div(s(x), 0, s(z)) -> div(s(x), s(z), s(z)) [1] div(s(x), s(y), z) -> div(x, y, z) [1] prime(x) -> test(x, s(s(0))) [1] test(x, y) -> if1(gt(x, y), x, y) [1] if1(true, x, y) -> if2(divides(x, y), x, y) [1] if1(false, x, y) -> true [1] if2(true, x, y) -> false [1] if2(false, x, y) -> test(x, s(y)) [1] The TRS has the following type information: gt :: s:0 -> s:0 -> true:false s :: s:0 -> s:0 0 :: s:0 true :: true:false false :: true:false divides :: s:0 -> s:0 -> true:false div :: s:0 -> s:0 -> s:0 -> true:false prime :: s:0 -> true:false test :: s:0 -> s:0 -> true:false if1 :: true:false -> s:0 -> s:0 -> true:false if2 :: true:false -> 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: div(v0, v1, v2) -> null_div [0] if1(v0, v1, v2) -> null_if1 [0] if2(v0, v1, v2) -> null_if2 [0] And the following fresh constants: null_div, null_if1, null_if2 ---------------------------------------- (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: gt(s(x), 0) -> true [1] gt(0, y) -> false [1] gt(s(x), s(y)) -> gt(x, y) [1] divides(x, y) -> div(x, y, y) [1] div(0, 0, z) -> true [1] div(0, s(x), z) -> false [1] div(s(x), 0, s(z)) -> div(s(x), s(z), s(z)) [1] div(s(x), s(y), z) -> div(x, y, z) [1] prime(x) -> test(x, s(s(0))) [1] test(x, y) -> if1(gt(x, y), x, y) [1] if1(true, x, y) -> if2(divides(x, y), x, y) [1] if1(false, x, y) -> true [1] if2(true, x, y) -> false [1] if2(false, x, y) -> test(x, s(y)) [1] div(v0, v1, v2) -> null_div [0] if1(v0, v1, v2) -> null_if1 [0] if2(v0, v1, v2) -> null_if2 [0] The TRS has the following type information: gt :: s:0 -> s:0 -> true:false:null_div:null_if1:null_if2 s :: s:0 -> s:0 0 :: s:0 true :: true:false:null_div:null_if1:null_if2 false :: true:false:null_div:null_if1:null_if2 divides :: s:0 -> s:0 -> true:false:null_div:null_if1:null_if2 div :: s:0 -> s:0 -> s:0 -> true:false:null_div:null_if1:null_if2 prime :: s:0 -> true:false:null_div:null_if1:null_if2 test :: s:0 -> s:0 -> true:false:null_div:null_if1:null_if2 if1 :: true:false:null_div:null_if1:null_if2 -> s:0 -> s:0 -> true:false:null_div:null_if1:null_if2 if2 :: true:false:null_div:null_if1:null_if2 -> s:0 -> s:0 -> true:false:null_div:null_if1:null_if2 null_div :: true:false:null_div:null_if1:null_if2 null_if1 :: true:false:null_div:null_if1:null_if2 null_if2 :: true:false:null_div:null_if1:null_if2 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 true => 2 false => 1 null_div => 0 null_if1 => 0 null_if2 => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: div(z', z'', z1) -{ 1 }-> div(x, y, z) :|: z' = 1 + x, z1 = z, z >= 0, x >= 0, y >= 0, z'' = 1 + y div(z', z'', z1) -{ 1 }-> div(1 + x, 1 + z, 1 + z) :|: z'' = 0, z' = 1 + x, z >= 0, x >= 0, z1 = 1 + z div(z', z'', z1) -{ 1 }-> 2 :|: z'' = 0, z1 = z, z >= 0, z' = 0 div(z', z'', z1) -{ 1 }-> 1 :|: z1 = z, z >= 0, x >= 0, z'' = 1 + x, z' = 0 div(z', z'', z1) -{ 0 }-> 0 :|: v0 >= 0, z1 = v2, v1 >= 0, z'' = v1, v2 >= 0, z' = v0 divides(z', z'') -{ 1 }-> div(x, y, y) :|: z' = x, z'' = y, x >= 0, y >= 0 gt(z', z'') -{ 1 }-> gt(x, y) :|: z' = 1 + x, x >= 0, y >= 0, z'' = 1 + y gt(z', z'') -{ 1 }-> 2 :|: z'' = 0, z' = 1 + x, x >= 0 gt(z', z'') -{ 1 }-> 1 :|: z'' = y, y >= 0, z' = 0 if1(z', z'', z1) -{ 1 }-> if2(divides(x, y), x, y) :|: z1 = y, z' = 2, x >= 0, y >= 0, z'' = x if1(z', z'', z1) -{ 1 }-> 2 :|: z1 = y, x >= 0, y >= 0, z'' = x, z' = 1 if1(z', z'', z1) -{ 0 }-> 0 :|: v0 >= 0, z1 = v2, v1 >= 0, z'' = v1, v2 >= 0, z' = v0 if2(z', z'', z1) -{ 1 }-> test(x, 1 + y) :|: z1 = y, x >= 0, y >= 0, z'' = x, z' = 1 if2(z', z'', z1) -{ 1 }-> 1 :|: z1 = y, z' = 2, x >= 0, y >= 0, z'' = x if2(z', z'', z1) -{ 0 }-> 0 :|: v0 >= 0, z1 = v2, v1 >= 0, z'' = v1, v2 >= 0, z' = v0 prime(z') -{ 1 }-> test(x, 1 + (1 + 0)) :|: z' = x, x >= 0 test(z', z'') -{ 1 }-> if1(gt(x, y), x, y) :|: z' = x, z'' = y, x >= 0, y >= 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(V, V1, V9),0,[gt(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1, V9),0,[divides(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1, V9),0,[div(V, V1, V9, Out)],[V >= 0,V1 >= 0,V9 >= 0]). eq(start(V, V1, V9),0,[prime(V, Out)],[V >= 0]). eq(start(V, V1, V9),0,[test(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1, V9),0,[if1(V, V1, V9, Out)],[V >= 0,V1 >= 0,V9 >= 0]). eq(start(V, V1, V9),0,[if2(V, V1, V9, Out)],[V >= 0,V1 >= 0,V9 >= 0]). eq(gt(V, V1, Out),1,[],[Out = 2,V1 = 0,V = 1 + V2,V2 >= 0]). eq(gt(V, V1, Out),1,[],[Out = 1,V1 = V3,V3 >= 0,V = 0]). eq(gt(V, V1, Out),1,[gt(V4, V5, Ret)],[Out = Ret,V = 1 + V4,V4 >= 0,V5 >= 0,V1 = 1 + V5]). eq(divides(V, V1, Out),1,[div(V7, V6, V6, Ret1)],[Out = Ret1,V = V7,V1 = V6,V7 >= 0,V6 >= 0]). eq(div(V, V1, V9, Out),1,[],[Out = 2,V1 = 0,V9 = V8,V8 >= 0,V = 0]). eq(div(V, V1, V9, Out),1,[],[Out = 1,V9 = V11,V11 >= 0,V10 >= 0,V1 = 1 + V10,V = 0]). eq(div(V, V1, V9, Out),1,[div(1 + V12, 1 + V13, 1 + V13, Ret2)],[Out = Ret2,V1 = 0,V = 1 + V12,V13 >= 0,V12 >= 0,V9 = 1 + V13]). eq(div(V, V1, V9, Out),1,[div(V16, V14, V15, Ret3)],[Out = Ret3,V = 1 + V16,V9 = V15,V15 >= 0,V16 >= 0,V14 >= 0,V1 = 1 + V14]). eq(prime(V, Out),1,[test(V17, 1 + (1 + 0), Ret4)],[Out = Ret4,V = V17,V17 >= 0]). eq(test(V, V1, Out),1,[gt(V19, V18, Ret0),if1(Ret0, V19, V18, Ret5)],[Out = Ret5,V = V19,V1 = V18,V19 >= 0,V18 >= 0]). eq(if1(V, V1, V9, Out),1,[divides(V21, V20, Ret01),if2(Ret01, V21, V20, Ret6)],[Out = Ret6,V9 = V20,V = 2,V21 >= 0,V20 >= 0,V1 = V21]). eq(if1(V, V1, V9, Out),1,[],[Out = 2,V9 = V22,V23 >= 0,V22 >= 0,V1 = V23,V = 1]). eq(if2(V, V1, V9, Out),1,[],[Out = 1,V9 = V24,V = 2,V25 >= 0,V24 >= 0,V1 = V25]). eq(if2(V, V1, V9, Out),1,[test(V27, 1 + V26, Ret7)],[Out = Ret7,V9 = V26,V27 >= 0,V26 >= 0,V1 = V27,V = 1]). eq(div(V, V1, V9, Out),0,[],[Out = 0,V29 >= 0,V9 = V30,V28 >= 0,V1 = V28,V30 >= 0,V = V29]). eq(if1(V, V1, V9, Out),0,[],[Out = 0,V33 >= 0,V9 = V31,V32 >= 0,V1 = V32,V31 >= 0,V = V33]). eq(if2(V, V1, V9, Out),0,[],[Out = 0,V36 >= 0,V9 = V34,V35 >= 0,V1 = V35,V34 >= 0,V = V36]). input_output_vars(gt(V,V1,Out),[V,V1],[Out]). input_output_vars(divides(V,V1,Out),[V,V1],[Out]). input_output_vars(div(V,V1,V9,Out),[V,V1,V9],[Out]). input_output_vars(prime(V,Out),[V],[Out]). input_output_vars(test(V,V1,Out),[V,V1],[Out]). input_output_vars(if1(V,V1,V9,Out),[V,V1,V9],[Out]). input_output_vars(if2(V,V1,V9,Out),[V,V1,V9],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [(div)/4] 1. non_recursive : [divides/3] 2. recursive : [gt/3] 3. recursive : [if1/4,if2/4,test/3] 4. non_recursive : [prime/2] 5. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into (div)/4 1. SCC is completely evaluated into other SCCs 2. SCC is partially evaluated into gt/3 3. SCC is partially evaluated into test/3 4. SCC is completely evaluated into other SCCs 5. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations (div)/4 * CE 17 is refined into CE [26] * CE 14 is refined into CE [27] * CE 13 is refined into CE [28] * CE 16 is refined into CE [29] * CE 15 is refined into CE [30] ### Cost equations --> "Loop" of (div)/4 * CEs [29] --> Loop 15 * CEs [30] --> Loop 16 * CEs [26] --> Loop 17 * CEs [27] --> Loop 18 * CEs [28] --> Loop 19 ### Ranking functions of CR div(V,V1,V9,Out) #### Partial ranking functions of CR div(V,V1,V9,Out) * Partial RF of phase [15,16]: - RF of loop [15:1]: V V1 depends on loops [16:1] - RF of loop [16:1]: -V1+1 depends on loops [15:1] ### Specialization of cost equations gt/3 * CE 25 is refined into CE [31] * CE 23 is refined into CE [32] * CE 24 is refined into CE [33] ### Cost equations --> "Loop" of gt/3 * CEs [32] --> Loop 20 * CEs [33] --> Loop 21 * CEs [31] --> Loop 22 ### Ranking functions of CR gt(V,V1,Out) * RF of phase [22]: [V,V1] #### Partial ranking functions of CR gt(V,V1,Out) * Partial RF of phase [22]: - RF of loop [22:1]: V V1 ### Specialization of cost equations test/3 * CE 22 is refined into CE [34,35] * CE 20 is refined into CE [36] * CE 18 is refined into CE [37,38,39,40] * CE 21 is refined into CE [41,42,43,44] * CE 19 is refined into CE [45] ### Cost equations --> "Loop" of test/3 * CEs [45] --> Loop 23 * CEs [35] --> Loop 24 * CEs [36] --> Loop 25 * CEs [38,39,40,44] --> Loop 26 * CEs [43] --> Loop 27 * CEs [37,42] --> Loop 28 * CEs [34] --> Loop 29 * CEs [41] --> Loop 30 ### Ranking functions of CR test(V,V1,Out) * RF of phase [23]: [V-V1] #### Partial ranking functions of CR test(V,V1,Out) * Partial RF of phase [23]: - RF of loop [23:1]: V-V1 ### Specialization of cost equations start/3 * CE 1 is refined into CE [46,47,48,49,50] * CE 3 is refined into CE [51,52,53,54,55,56,57] * CE 5 is refined into CE [58,59] * CE 6 is refined into CE [60] * CE 2 is refined into CE [61] * CE 4 is refined into CE [62,63,64,65,66,67,68] * CE 7 is refined into CE [69] * CE 8 is refined into CE [70,71,72,73] * CE 9 is refined into CE [74,75,76,77,78] * CE 10 is refined into CE [79,80,81,82,83] * CE 11 is refined into CE [84,85,86,87,88,89,90] * CE 12 is refined into CE [91,92,93,94,95,96,97,98] ### Cost equations --> "Loop" of start/3 * CEs [87,88,90] --> Loop 31 * CEs [47,51,52,71,93] --> Loop 32 * CEs [46,48,49,50,53,54,55,56,57,58,59,60,61,72,73,76,77,78,81,82,83,94,95,96,97,98] --> Loop 33 * CEs [62,63,64,65,66,67,68,69,86,89] --> Loop 34 * CEs [70,74,75,79,80,84,85,91,92] --> Loop 35 ### Ranking functions of CR start(V,V1,V9) #### Partial ranking functions of CR start(V,V1,V9) Computing Bounds ===================================== #### Cost of chains of div(V,V1,V9,Out): * Chain [[15,16],19]: 1*it(15)+1*it(16)+1 Such that:it(15) =< V aux(6) =< -V1 aux(5) =< -V1+1 it(16) =< it(15)+aux(6) it(16) =< it(15)+aux(5) with precondition: [Out=2,V>=1,V1>=0,V9>=0,V>=V1,V1+V9>=1] * Chain [[15,16],18]: 1*it(15)+1*it(16)+1 Such that:it(15) =< V aux(5) =< -V1+1 it(16) =< it(15)+aux(5) with precondition: [Out=1,V>=1,V1>=0,V9>=0,V1+V9>=1] * Chain [[15,16],17]: 1*it(15)+1*it(16)+0 Such that:it(15) =< V aux(5) =< -V1+1 it(16) =< it(15)+aux(5) with precondition: [Out=0,V>=1,V1>=0,V9>=0,V1+V9>=1] * Chain [19]: 1 with precondition: [V=0,V1=0,Out=2,V9>=0] * Chain [18]: 1 with precondition: [V=0,Out=1,V1>=1,V9>=0] * Chain [17]: 0 with precondition: [Out=0,V>=0,V1>=0,V9>=0] #### Cost of chains of gt(V,V1,Out): * Chain [[22],21]: 1*it(22)+1 Such that:it(22) =< V with precondition: [Out=1,V>=1,V1>=V] * Chain [[22],20]: 1*it(22)+1 Such that:it(22) =< V1 with precondition: [Out=2,V1>=1,V>=V1+1] * Chain [21]: 1 with precondition: [V=0,Out=1,V1>=0] * Chain [20]: 1 with precondition: [V1=0,Out=2,V>=1] #### Cost of chains of test(V,V1,Out): * Chain [[23],27]: 6*it(23)+1*s(4)+2*s(13)+1*s(15)+2 Such that:s(16) =< -V1+1 aux(14) =< V aux(15) =< V-V1 s(4) =< aux(14) it(23) =< aux(15) s(16) =< aux(15) s(13) =< it(23)*aux(14) s(15) =< s(13)+s(16) with precondition: [Out=0,V1>=1,V>=V1+1] * Chain [[23],26]: 6*it(23)+2*s(13)+1*s(15)+7*s(17)+3*s(20)+5 Such that:s(16) =< -V1+1 aux(19) =< V aux(20) =< V-V1 aux(21) =< -V1 it(23) =< aux(20) s(16) =< aux(20) s(17) =< aux(19) s(20) =< s(17)+aux(21) s(13) =< it(23)*aux(19) s(15) =< s(13)+s(16) with precondition: [Out=0,V1>=1,V>=V1+2] * Chain [[23],25]: 6*it(23)+2*s(13)+1*s(15)+2*s(31)+1*s(35)+6 Such that:s(16) =< -V1+1 aux(22) =< V aux(23) =< V-V1 aux(24) =< -V1 s(31) =< aux(22) it(23) =< aux(23) s(16) =< aux(23) s(35) =< s(31)+aux(24) s(13) =< it(23)*aux(22) s(15) =< s(13)+s(16) with precondition: [Out=1,V1>=1,V>=V1+2] * Chain [[23],24]: 6*it(23)+2*s(13)+1*s(15)+1*s(36)+3 Such that:s(16) =< -V1+1 aux(25) =< V aux(26) =< V-V1 s(36) =< aux(25) it(23) =< aux(26) s(16) =< aux(26) s(13) =< it(23)*aux(25) s(15) =< s(13)+s(16) with precondition: [Out=2,V1>=1,V>=V1+1] * Chain [30]: 2 with precondition: [V=0,Out=0,V1>=0] * Chain [29]: 3 with precondition: [V=0,Out=2,V1>=0] * Chain [28]: 1*s(37)+1*s(39)+4 Such that:s(38) =< 1 s(37) =< V s(39) =< s(37)+s(38) with precondition: [V1=0,Out=0,V>=1] * Chain [27]: 1*s(4)+2 Such that:s(4) =< V with precondition: [Out=0,V>=1,V1>=V] * Chain [26]: 4*s(17)+3*s(18)+2*s(20)+1*s(29)+5 Such that:s(27) =< -V1 aux(16) =< V aux(17) =< -V1+1 aux(18) =< V1 s(18) =< aux(16) s(17) =< aux(18) s(20) =< s(18)+aux(17) s(29) =< s(18)+s(27) s(29) =< s(18)+aux(17) with precondition: [Out=0,V1>=1,V>=V1+1] * Chain [25]: 1*s(31)+1*s(32)+1*s(35)+6 Such that:s(32) =< V s(33) =< -V1 s(34) =< -V1+1 s(31) =< V1 s(35) =< s(32)+s(33) s(35) =< s(32)+s(34) with precondition: [Out=1,V1>=1,V>=V1+1] * Chain [24]: 1*s(36)+3 Such that:s(36) =< V with precondition: [Out=2,V>=1,V1>=V] #### Cost of chains of start(V,V1,V9): * Chain [35]: 4 with precondition: [V=0] * Chain [34]: 17*s(78)+5*s(86)+8*s(87)+24*s(89)+8*s(91)+4*s(92)+2*s(113)+7 Such that:aux(36) =< V aux(37) =< V1 aux(38) =< V1-V9 aux(39) =< -V9 aux(40) =< V9+1 s(113) =< aux(36) s(78) =< aux(37) s(84) =< aux(39) s(86) =< aux(40) s(87) =< s(78)+aux(39) s(89) =< aux(38) s(84) =< aux(38) s(91) =< s(89)*aux(37) s(92) =< s(91)+s(84) with precondition: [2>=V,V>=1] * Chain [33]: 32*s(115)+7*s(117)+2*s(124)+5*s(139)+8*s(140)+24*s(142)+8*s(144)+4*s(145)+24*s(179)+6*s(183)+4*s(190)+24*s(212)+4*s(213)+8*s(214)+4*s(215)+10 Such that:aux(48) =< V aux(49) =< V-V1 aux(50) =< -V1 aux(51) =< -V1+1 aux(52) =< V1 aux(53) =< V1-V9 aux(54) =< -V9 aux(55) =< -V9+1 aux(56) =< V9+1 s(179) =< aux(48) s(207) =< aux(51) s(115) =< aux(52) s(137) =< aux(54) s(139) =< aux(56) s(183) =< s(179)+aux(51) s(190) =< s(179)+aux(50) s(190) =< s(179)+aux(51) s(212) =< aux(49) s(207) =< aux(49) s(213) =< s(179)+aux(50) s(214) =< s(212)*aux(48) s(215) =< s(214)+s(207) s(117) =< s(115)+aux(55) s(124) =< s(115)+aux(54) s(124) =< s(115)+aux(55) s(140) =< s(115)+aux(54) s(142) =< aux(53) s(137) =< aux(53) s(144) =< s(142)*aux(52) s(145) =< s(144)+s(137) with precondition: [V>=0,V1>=0] * Chain [32]: 1*s(237)+1*s(238)+7 Such that:s(236) =< 1 s(237) =< V s(238) =< s(237)+s(236) with precondition: [V1=0,V>=1] * Chain [31]: 39*s(245)+5*s(246)+8*s(247)+8*s(251)+4*s(252)+7 Such that:aux(62) =< 2 aux(63) =< V s(246) =< aux(62) s(245) =< aux(63) s(247) =< s(245) s(251) =< s(245)*aux(63) s(252) =< s(251) with precondition: [V>=3] Closed-form bounds of start(V,V1,V9): ------------------------------------- * Chain [35] with precondition: [V=0] - Upper bound: 4 - Complexity: constant * Chain [34] with precondition: [2>=V,V>=1] - Upper bound: 2*V+7+nat(V1)*25+nat(V1)*12*nat(V1-V9)+nat(-V9)*12+nat(V9+1)*5+nat(V1-V9)*24 - Complexity: n^2 * Chain [33] with precondition: [V>=0,V1>=0] - Upper bound: 38*V+10+12*V*nat(V-V1)+49*V1+12*V1*nat(V1-V9)+nat(-V9)*14+nat(V9+1)*5+nat(-V1+1)*10+nat(-V9+1)*7+nat(V-V1)*24+nat(V1-V9)*24 - Complexity: n^2 * Chain [32] with precondition: [V1=0,V>=1] - Upper bound: 2*V+8 - Complexity: n * Chain [31] with precondition: [V>=3] - Upper bound: 47*V+17+12*V*V - Complexity: n^2 ### Maximum cost of start(V,V1,V9): 2*V+3+max([max([1,nat(V1)*12*nat(V1-V9)+nat(V1)*25+nat(-V9)*12+nat(V9+1)*5+nat(V1-V9)*24]),36*V+3+max([9*V+7+12*V*V,12*V*nat(V-V1)+nat(V1)*49+nat(V1)*12*nat(V1-V9)+nat(-V9)*14+nat(V9+1)*5+nat(-V1+1)*10+nat(-V9+1)*7+nat(V-V1)*24+nat(V1-V9)*24])])+4 Asymptotic class: n^2 * Total analysis performed in 677 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: gt(s(x), 0') -> true gt(0', y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0', 0', z) -> true div(0', s(x), z) -> false div(s(x), 0', s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0'))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: TRS: Rules: gt(s(x), 0') -> true gt(0', y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0', 0', z) -> true div(0', s(x), z) -> false div(s(x), 0', s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0'))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) Types: gt :: s:0' -> s:0' -> true:false s :: s:0' -> s:0' 0' :: s:0' true :: true:false false :: true:false divides :: s:0' -> s:0' -> true:false div :: s:0' -> s:0' -> s:0' -> true:false prime :: s:0' -> true:false test :: s:0' -> s:0' -> true:false if1 :: true:false -> s:0' -> s:0' -> true:false if2 :: true:false -> s:0' -> s:0' -> true:false hole_true:false1_0 :: true:false hole_s:0'2_0 :: s:0' gen_s:0'3_0 :: Nat -> s:0' ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: gt, div, test They will be analysed ascendingly in the following order: gt < test ---------------------------------------- (18) Obligation: TRS: Rules: gt(s(x), 0') -> true gt(0', y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0', 0', z) -> true div(0', s(x), z) -> false div(s(x), 0', s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0'))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) Types: gt :: s:0' -> s:0' -> true:false s :: s:0' -> s:0' 0' :: s:0' true :: true:false false :: true:false divides :: s:0' -> s:0' -> true:false div :: s:0' -> s:0' -> s:0' -> true:false prime :: s:0' -> true:false test :: s:0' -> s:0' -> true:false if1 :: true:false -> s:0' -> s:0' -> true:false if2 :: true:false -> s:0' -> s:0' -> true:false hole_true:false1_0 :: true:false hole_s:0'2_0 :: s:0' gen_s:0'3_0 :: Nat -> s:0' Generator Equations: gen_s:0'3_0(0) <=> 0' gen_s:0'3_0(+(x, 1)) <=> s(gen_s:0'3_0(x)) The following defined symbols remain to be analysed: gt, div, test They will be analysed ascendingly in the following order: gt < test ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) -> true, rt in Omega(1 + n5_0) Induction Base: gt(gen_s:0'3_0(+(1, 0)), gen_s:0'3_0(0)) ->_R^Omega(1) true Induction Step: gt(gen_s:0'3_0(+(1, +(n5_0, 1))), gen_s:0'3_0(+(n5_0, 1))) ->_R^Omega(1) gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_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: gt(s(x), 0') -> true gt(0', y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0', 0', z) -> true div(0', s(x), z) -> false div(s(x), 0', s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0'))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) Types: gt :: s:0' -> s:0' -> true:false s :: s:0' -> s:0' 0' :: s:0' true :: true:false false :: true:false divides :: s:0' -> s:0' -> true:false div :: s:0' -> s:0' -> s:0' -> true:false prime :: s:0' -> true:false test :: s:0' -> s:0' -> true:false if1 :: true:false -> s:0' -> s:0' -> true:false if2 :: true:false -> s:0' -> s:0' -> true:false hole_true:false1_0 :: true:false hole_s:0'2_0 :: s:0' gen_s:0'3_0 :: Nat -> s:0' Generator Equations: gen_s:0'3_0(0) <=> 0' gen_s:0'3_0(+(x, 1)) <=> s(gen_s:0'3_0(x)) The following defined symbols remain to be analysed: gt, div, test They will be analysed ascendingly in the following order: gt < test ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: TRS: Rules: gt(s(x), 0') -> true gt(0', y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0', 0', z) -> true div(0', s(x), z) -> false div(s(x), 0', s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0'))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) Types: gt :: s:0' -> s:0' -> true:false s :: s:0' -> s:0' 0' :: s:0' true :: true:false false :: true:false divides :: s:0' -> s:0' -> true:false div :: s:0' -> s:0' -> s:0' -> true:false prime :: s:0' -> true:false test :: s:0' -> s:0' -> true:false if1 :: true:false -> s:0' -> s:0' -> true:false if2 :: true:false -> s:0' -> s:0' -> true:false hole_true:false1_0 :: true:false hole_s:0'2_0 :: s:0' gen_s:0'3_0 :: Nat -> s:0' Lemmas: gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) -> true, rt in Omega(1 + n5_0) Generator Equations: gen_s:0'3_0(0) <=> 0' gen_s:0'3_0(+(x, 1)) <=> s(gen_s:0'3_0(x)) The following defined symbols remain to be analysed: div, test ---------------------------------------- (25) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: div(gen_s:0'3_0(n276_0), gen_s:0'3_0(n276_0), gen_s:0'3_0(c)) -> true, rt in Omega(1 + n276_0) Induction Base: div(gen_s:0'3_0(0), gen_s:0'3_0(0), gen_s:0'3_0(c)) ->_R^Omega(1) true Induction Step: div(gen_s:0'3_0(+(n276_0, 1)), gen_s:0'3_0(+(n276_0, 1)), gen_s:0'3_0(c)) ->_R^Omega(1) div(gen_s:0'3_0(n276_0), gen_s:0'3_0(n276_0), gen_s:0'3_0(c)) ->_IH true We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (26) Obligation: TRS: Rules: gt(s(x), 0') -> true gt(0', y) -> false gt(s(x), s(y)) -> gt(x, y) divides(x, y) -> div(x, y, y) div(0', 0', z) -> true div(0', s(x), z) -> false div(s(x), 0', s(z)) -> div(s(x), s(z), s(z)) div(s(x), s(y), z) -> div(x, y, z) prime(x) -> test(x, s(s(0'))) test(x, y) -> if1(gt(x, y), x, y) if1(true, x, y) -> if2(divides(x, y), x, y) if1(false, x, y) -> true if2(true, x, y) -> false if2(false, x, y) -> test(x, s(y)) Types: gt :: s:0' -> s:0' -> true:false s :: s:0' -> s:0' 0' :: s:0' true :: true:false false :: true:false divides :: s:0' -> s:0' -> true:false div :: s:0' -> s:0' -> s:0' -> true:false prime :: s:0' -> true:false test :: s:0' -> s:0' -> true:false if1 :: true:false -> s:0' -> s:0' -> true:false if2 :: true:false -> s:0' -> s:0' -> true:false hole_true:false1_0 :: true:false hole_s:0'2_0 :: s:0' gen_s:0'3_0 :: Nat -> s:0' Lemmas: gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) -> true, rt in Omega(1 + n5_0) div(gen_s:0'3_0(n276_0), gen_s:0'3_0(n276_0), gen_s:0'3_0(c)) -> true, rt in Omega(1 + n276_0) Generator Equations: gen_s:0'3_0(0) <=> 0' gen_s:0'3_0(+(x, 1)) <=> s(gen_s:0'3_0(x)) The following defined symbols remain to be analysed: test