/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 (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). (0) CpxTRS (1) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (2) CpxWeightedTrs (3) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (4) CpxTypedWeightedTrs (5) CompletionProof [UPPER BOUND(ID), 0 ms] (6) CpxTypedWeightedCompleteTrs (7) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (8) CpxRNTS (9) CompleteCoflocoProof [FINISHED, 949 ms] (10) BOUNDS(1, n^1) (11) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (12) CpxTRS (13) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (14) typed CpxTrs (15) OrderProof [LOWER BOUND(ID), 0 ms] (16) typed CpxTrs (17) RewriteLemmaProof [LOWER BOUND(ID), 1022 ms] (18) BEST (19) proven lower bound (20) LowerBoundPropagationProof [FINISHED, 0 ms] (21) BOUNDS(n^1, INF) (22) typed CpxTrs (23) RewriteLemmaProof [LOWER BOUND(ID), 24 ms] (24) typed CpxTrs ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0) -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0) -> false le(0, Y) -> true gcd(0, Y) -> 0 gcd(s(X), 0) -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(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^1). The TRS R consists of the following rules: minus(X, s(Y)) -> pred(minus(X, Y)) [1] minus(X, 0) -> X [1] pred(s(X)) -> X [1] le(s(X), s(Y)) -> le(X, Y) [1] le(s(X), 0) -> false [1] le(0, Y) -> true [1] gcd(0, Y) -> 0 [1] gcd(s(X), 0) -> s(X) [1] gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) [1] if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) [1] if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (3) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (4) Obligation: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: minus(X, s(Y)) -> pred(minus(X, Y)) [1] minus(X, 0) -> X [1] pred(s(X)) -> X [1] le(s(X), s(Y)) -> le(X, Y) [1] le(s(X), 0) -> false [1] le(0, Y) -> true [1] gcd(0, Y) -> 0 [1] gcd(s(X), 0) -> s(X) [1] gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) [1] if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) [1] if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) [1] The TRS has the following type information: minus :: s:0 -> s:0 -> s:0 s :: s:0 -> s:0 pred :: s:0 -> s:0 0 :: s:0 le :: s:0 -> s:0 -> false:true false :: false:true true :: false:true gcd :: s:0 -> s:0 -> s:0 if :: false:true -> s:0 -> s:0 -> s:0 Rewrite Strategy: INNERMOST ---------------------------------------- (5) 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: pred(v0) -> null_pred [0] if(v0, v1, v2) -> null_if [0] minus(v0, v1) -> null_minus [0] le(v0, v1) -> null_le [0] gcd(v0, v1) -> null_gcd [0] And the following fresh constants: null_pred, null_if, null_minus, null_le, null_gcd ---------------------------------------- (6) 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, s(Y)) -> pred(minus(X, Y)) [1] minus(X, 0) -> X [1] pred(s(X)) -> X [1] le(s(X), s(Y)) -> le(X, Y) [1] le(s(X), 0) -> false [1] le(0, Y) -> true [1] gcd(0, Y) -> 0 [1] gcd(s(X), 0) -> s(X) [1] gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) [1] if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) [1] if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) [1] pred(v0) -> null_pred [0] if(v0, v1, v2) -> null_if [0] minus(v0, v1) -> null_minus [0] le(v0, v1) -> null_le [0] gcd(v0, v1) -> null_gcd [0] The TRS has the following type information: minus :: s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd s :: s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd pred :: s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd 0 :: s:0:null_pred:null_if:null_minus:null_gcd le :: s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd -> false:true:null_le false :: false:true:null_le true :: false:true:null_le gcd :: s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd if :: false:true:null_le -> s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd -> s:0:null_pred:null_if:null_minus:null_gcd null_pred :: s:0:null_pred:null_if:null_minus:null_gcd null_if :: s:0:null_pred:null_if:null_minus:null_gcd null_minus :: s:0:null_pred:null_if:null_minus:null_gcd null_le :: false:true:null_le null_gcd :: s:0:null_pred:null_if:null_minus:null_gcd Rewrite Strategy: INNERMOST ---------------------------------------- (7) 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 false => 1 true => 2 null_pred => 0 null_if => 0 null_minus => 0 null_le => 0 null_gcd => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: gcd(z, z') -{ 1 }-> if(le(Y, X), 1 + X, 1 + Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 gcd(z, z') -{ 1 }-> 0 :|: z' = Y, Y >= 0, z = 0 gcd(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 gcd(z, z') -{ 1 }-> 1 + X :|: z = 1 + X, X >= 0, z' = 0 if(z, z', z'') -{ 1 }-> gcd(minus(X, Y), 1 + Y) :|: z = 2, z'' = 1 + Y, Y >= 0, z' = 1 + X, X >= 0 if(z, z', z'') -{ 1 }-> gcd(minus(Y, X), 1 + X) :|: z'' = 1 + Y, Y >= 0, z = 1, z' = 1 + X, X >= 0 if(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 le(z, z') -{ 1 }-> le(X, Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0 le(z, z') -{ 1 }-> 2 :|: z' = Y, Y >= 0, z = 0 le(z, z') -{ 1 }-> 1 :|: z = 1 + X, X >= 0, z' = 0 le(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 }-> pred(minus(X, Y)) :|: Y >= 0, z' = 1 + Y, X >= 0, z = X minus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 pred(z) -{ 1 }-> X :|: z = 1 + X, X >= 0 pred(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (9) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V1, V, V2),0,[minus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[pred(V1, Out)],[V1 >= 0]). eq(start(V1, V, V2),0,[le(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[gcd(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V2),0,[if(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(minus(V1, V, Out),1,[minus(X1, Y1, Ret0),pred(Ret0, Ret)],[Out = Ret,Y1 >= 0,V = 1 + Y1,X1 >= 0,V1 = X1]). eq(minus(V1, V, Out),1,[],[Out = X2,X2 >= 0,V1 = X2,V = 0]). eq(pred(V1, Out),1,[],[Out = X3,V1 = 1 + X3,X3 >= 0]). eq(le(V1, V, Out),1,[le(X4, Y2, Ret1)],[Out = Ret1,V1 = 1 + X4,Y2 >= 0,V = 1 + Y2,X4 >= 0]). eq(le(V1, V, Out),1,[],[Out = 1,V1 = 1 + X5,X5 >= 0,V = 0]). eq(le(V1, V, Out),1,[],[Out = 2,V = Y3,Y3 >= 0,V1 = 0]). eq(gcd(V1, V, Out),1,[],[Out = 0,V = Y4,Y4 >= 0,V1 = 0]). eq(gcd(V1, V, Out),1,[],[Out = 1 + X6,V1 = 1 + X6,X6 >= 0,V = 0]). eq(gcd(V1, V, Out),1,[le(Y5, X7, Ret01),if(Ret01, 1 + X7, 1 + Y5, Ret2)],[Out = Ret2,V1 = 1 + X7,Y5 >= 0,V = 1 + Y5,X7 >= 0]). eq(if(V1, V, V2, Out),1,[minus(X8, Y6, Ret02),gcd(Ret02, 1 + Y6, Ret3)],[Out = Ret3,V1 = 2,V2 = 1 + Y6,Y6 >= 0,V = 1 + X8,X8 >= 0]). eq(if(V1, V, V2, Out),1,[minus(Y7, X9, Ret03),gcd(Ret03, 1 + X9, Ret4)],[Out = Ret4,V2 = 1 + Y7,Y7 >= 0,V1 = 1,V = 1 + X9,X9 >= 0]). eq(pred(V1, Out),0,[],[Out = 0,V3 >= 0,V1 = V3]). eq(if(V1, V, V2, Out),0,[],[Out = 0,V5 >= 0,V2 = V6,V4 >= 0,V1 = V5,V = V4,V6 >= 0]). eq(minus(V1, V, Out),0,[],[Out = 0,V8 >= 0,V7 >= 0,V1 = V8,V = V7]). eq(le(V1, V, Out),0,[],[Out = 0,V9 >= 0,V10 >= 0,V1 = V9,V = V10]). eq(gcd(V1, V, Out),0,[],[Out = 0,V11 >= 0,V12 >= 0,V1 = V11,V = V12]). input_output_vars(minus(V1,V,Out),[V1,V],[Out]). input_output_vars(pred(V1,Out),[V1],[Out]). input_output_vars(le(V1,V,Out),[V1,V],[Out]). input_output_vars(gcd(V1,V,Out),[V1,V],[Out]). input_output_vars(if(V1,V,V2,Out),[V1,V,V2],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [pred/2] 1. recursive [non_tail] : [minus/3] 2. recursive : [le/3] 3. recursive : [gcd/3,if/4] 4. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into pred/2 1. SCC is partially evaluated into minus/3 2. SCC is partially evaluated into le/3 3. SCC is partially evaluated into gcd/3 4. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations pred/2 * CE 17 is refined into CE [23] * CE 18 is refined into CE [24] ### Cost equations --> "Loop" of pred/2 * CEs [23] --> Loop 16 * CEs [24] --> Loop 17 ### Ranking functions of CR pred(V1,Out) #### Partial ranking functions of CR pred(V1,Out) ### Specialization of cost equations minus/3 * CE 10 is refined into CE [25] * CE 9 is refined into CE [26] * CE 8 is refined into CE [27,28] ### Cost equations --> "Loop" of minus/3 * CEs [28] --> Loop 18 * CEs [27] --> Loop 19 * CEs [25] --> Loop 20 * CEs [26] --> Loop 21 ### Ranking functions of CR minus(V1,V,Out) * RF of phase [18]: [V] * RF of phase [19]: [V] #### Partial ranking functions of CR minus(V1,V,Out) * Partial RF of phase [18]: - RF of loop [18:1]: V * Partial RF of phase [19]: - RF of loop [19:1]: V ### Specialization of cost equations le/3 * CE 22 is refined into CE [29] * CE 20 is refined into CE [30] * CE 21 is refined into CE [31] * CE 19 is refined into CE [32] ### Cost equations --> "Loop" of le/3 * CEs [32] --> Loop 22 * CEs [29] --> Loop 23 * CEs [30] --> Loop 24 * CEs [31] --> Loop 25 ### Ranking functions of CR le(V1,V,Out) * RF of phase [22]: [V,V1] #### Partial ranking functions of CR le(V1,V,Out) * Partial RF of phase [22]: - RF of loop [22:1]: V V1 ### Specialization of cost equations gcd/3 * CE 15 is refined into CE [33] * CE 11 is refined into CE [34,35,36,37,38] * CE 14 is refined into CE [39] * CE 16 is refined into CE [40] * CE 13 is refined into CE [41,42,43,44] * CE 12 is refined into CE [45,46,47,48] ### Cost equations --> "Loop" of gcd/3 * CEs [48] --> Loop 26 * CEs [44] --> Loop 27 * CEs [47] --> Loop 28 * CEs [43] --> Loop 29 * CEs [41] --> Loop 30 * CEs [42] --> Loop 31 * CEs [45] --> Loop 32 * CEs [46] --> Loop 33 * CEs [34] --> Loop 34 * CEs [33] --> Loop 35 * CEs [35] --> Loop 36 * CEs [36,37,38,39,40] --> Loop 37 ### Ranking functions of CR gcd(V1,V,Out) * RF of phase [26,27]: [V1+V-3] * RF of phase [30]: [V1] #### Partial ranking functions of CR gcd(V1,V,Out) * Partial RF of phase [26,27]: - RF of loop [26:1]: V-2 V1/2+V/2-2 - RF of loop [27:1]: V1-1 depends on loops [26:1] V1-V+1 depends on loops [26:1] * Partial RF of phase [30]: - RF of loop [30:1]: V1 ### Specialization of cost equations start/3 * CE 3 is refined into CE [49,50,51,52] * CE 1 is refined into CE [53] * CE 2 is refined into CE [54,55,56,57] * CE 4 is refined into CE [58,59,60] * CE 5 is refined into CE [61,62] * CE 6 is refined into CE [63,64,65,66,67] * CE 7 is refined into CE [68,69,70] ### Cost equations --> "Loop" of start/3 * CEs [70] --> Loop 38 * CEs [58,64,69] --> Loop 39 * CEs [49,50,51,52] --> Loop 40 * CEs [54,55,56,57] --> Loop 41 * CEs [53,59,60,61,62,63,65,66,67,68] --> Loop 42 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### Cost of chains of pred(V1,Out): * Chain [17]: 0 with precondition: [Out=0,V1>=0] * Chain [16]: 1 with precondition: [V1=Out+1,V1>=1] #### Cost of chains of minus(V1,V,Out): * Chain [[19],[18],21]: 3*it(18)+1 Such that:aux(1) =< V it(18) =< aux(1) with precondition: [Out=0,V1>=1,V>=2] * Chain [[19],21]: 1*it(19)+1 Such that:it(19) =< V with precondition: [Out=0,V1>=0,V>=1] * Chain [[19],20]: 1*it(19)+0 Such that:it(19) =< V with precondition: [Out=0,V1>=0,V>=1] * Chain [[18],21]: 2*it(18)+1 Such that:it(18) =< V with precondition: [V1=Out+V,V>=1,V1>=V] * Chain [21]: 1 with precondition: [V=0,V1=Out,V1>=0] * Chain [20]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of le(V1,V,Out): * Chain [[22],25]: 1*it(22)+1 Such that:it(22) =< V1 with precondition: [Out=2,V1>=1,V>=V1] * Chain [[22],24]: 1*it(22)+1 Such that:it(22) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [[22],23]: 1*it(22)+0 Such that:it(22) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [25]: 1 with precondition: [V1=0,Out=2,V>=0] * Chain [24]: 1 with precondition: [V=0,Out=1,V1>=1] * Chain [23]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of gcd(V1,V,Out): * Chain [[30],37]: 6*it(30)+1*s(8)+2 Such that:s(8) =< 1 aux(4) =< V1 it(30) =< aux(4) with precondition: [V=1,Out=0,V1>=1] * Chain [[30],34]: 4*it(30)+2 Such that:it(30) =< V1 with precondition: [V=1,Out=0,V1>=2] * Chain [[30],31,37]: 4*it(30)+1*s(8)+6 Such that:s(8) =< 1 it(30) =< V1 with precondition: [V=1,Out=0,V1>=2] * Chain [[26,27],37]: 4*it(26)+4*it(27)+6*s(6)+3*s(21)+2 Such that:aux(10) =< V1-V+1 it(26) =< V1/2+V/2 aux(28) =< V1 aux(29) =< V1+V aux(30) =< V s(6) =< aux(29) it(26) =< aux(29) it(27) =< aux(29) it(26) =< aux(30) it(27) =< aux(30)+aux(10) it(27) =< aux(30)+aux(28) s(22) =< aux(30)+aux(28) s(22) =< it(27)*aux(30) s(21) =< s(22) with precondition: [Out=0,V1>=2,V>=2] * Chain [[26,27],36]: 4*it(26)+4*it(27)+3*s(19)+3*s(21)+2 Such that:aux(10) =< V1-V+1 aux(31) =< V1 aux(32) =< V1+V aux(33) =< V1/2+V/2 aux(34) =< V it(26) =< aux(33) it(26) =< aux(32) it(27) =< aux(32) it(27) =< aux(33) it(26) =< aux(34) it(27) =< aux(34)+aux(10) it(27) =< aux(34)+aux(31) s(22) =< aux(34)+aux(31) s(22) =< it(27)*aux(34) s(21) =< s(22) s(19) =< aux(32) with precondition: [Out=0,V1>=2,V>=2,V+V1>=5] * Chain [[26,27],33,37]: 4*it(26)+4*it(27)+1*s(8)+3*s(19)+3*s(21)+6 Such that:s(8) =< 1 aux(10) =< V1-V+1 aux(35) =< V1 aux(36) =< V1+V aux(37) =< V1/2+V/2 aux(38) =< V it(26) =< aux(37) it(26) =< aux(36) it(27) =< aux(36) it(27) =< aux(37) it(26) =< aux(38) it(27) =< aux(38)+aux(10) it(27) =< aux(38)+aux(35) s(22) =< aux(38)+aux(35) s(22) =< it(27)*aux(38) s(21) =< s(22) s(19) =< aux(36) with precondition: [Out=0,V1>=2,V>=2,V+V1>=5] * Chain [[26,27],32,[30],37]: 4*it(26)+4*it(27)+9*it(30)+1*s(8)+3*s(21)+6 Such that:s(8) =< 1 aux(10) =< V1-V+1 it(26) =< V1/2+V/2 aux(39) =< V1 aux(40) =< V1+V aux(41) =< V it(30) =< aux(40) it(26) =< aux(40) it(27) =< aux(40) it(26) =< aux(41) it(27) =< aux(41)+aux(10) it(27) =< aux(41)+aux(39) s(22) =< aux(41)+aux(39) s(22) =< it(27)*aux(41) s(21) =< s(22) with precondition: [Out=0,V1>=2,V>=2,V+V1>=5] * Chain [[26,27],32,[30],34]: 4*it(26)+4*it(27)+7*it(30)+3*s(21)+6 Such that:aux(10) =< V1-V+1 it(26) =< V1/2+V/2 aux(42) =< V1 aux(43) =< V1+V aux(44) =< V it(30) =< aux(43) it(26) =< aux(43) it(27) =< aux(43) it(26) =< aux(44) it(27) =< aux(44)+aux(10) it(27) =< aux(44)+aux(42) s(22) =< aux(44)+aux(42) s(22) =< it(27)*aux(44) s(21) =< s(22) with precondition: [Out=0,V1>=3,V>=3,V+V1>=7] * Chain [[26,27],32,[30],31,37]: 4*it(26)+4*it(27)+7*it(30)+1*s(8)+3*s(21)+10 Such that:s(8) =< 1 aux(10) =< V1-V+1 it(26) =< V1/2+V/2 aux(45) =< V1 aux(46) =< V1+V aux(47) =< V it(30) =< aux(46) it(26) =< aux(46) it(27) =< aux(46) it(26) =< aux(47) it(27) =< aux(47)+aux(10) it(27) =< aux(47)+aux(45) s(22) =< aux(47)+aux(45) s(22) =< it(27)*aux(47) s(21) =< s(22) with precondition: [Out=0,V1>=3,V>=3,V+V1>=7] * Chain [[26,27],32,37]: 4*it(26)+4*it(27)+5*s(6)+1*s(8)+3*s(21)+6 Such that:s(8) =< 1 aux(10) =< V1-V+1 it(26) =< V1/2+V/2 aux(48) =< V1 aux(49) =< V1+V aux(50) =< V s(6) =< aux(49) it(26) =< aux(49) it(27) =< aux(49) it(26) =< aux(50) it(27) =< aux(50)+aux(10) it(27) =< aux(50)+aux(48) s(22) =< aux(50)+aux(48) s(22) =< it(27)*aux(50) s(21) =< s(22) with precondition: [Out=0,V1>=2,V>=2,V+V1>=5] * Chain [[26,27],32,34]: 4*it(26)+4*it(27)+3*s(19)+3*s(21)+6 Such that:aux(10) =< V1-V+1 aux(51) =< V1 aux(52) =< V1+V aux(53) =< V1/2+V/2 aux(54) =< V it(26) =< aux(53) it(26) =< aux(52) it(27) =< aux(52) it(27) =< aux(53) it(26) =< aux(54) it(27) =< aux(54)+aux(10) it(27) =< aux(54)+aux(51) s(22) =< aux(54)+aux(51) s(22) =< it(27)*aux(54) s(21) =< s(22) s(19) =< aux(52) with precondition: [Out=0,V1>=2,V>=2,V+V1>=5] * Chain [[26,27],32,31,37]: 4*it(26)+4*it(27)+1*s(8)+3*s(19)+3*s(21)+10 Such that:s(8) =< 1 aux(10) =< V1-V+1 aux(55) =< V1 aux(56) =< V1+V aux(57) =< V1/2+V/2 aux(58) =< V it(26) =< aux(57) it(26) =< aux(56) it(27) =< aux(56) it(27) =< aux(57) it(26) =< aux(58) it(27) =< aux(58)+aux(10) it(27) =< aux(58)+aux(55) s(22) =< aux(58)+aux(55) s(22) =< it(27)*aux(58) s(21) =< s(22) s(19) =< aux(56) with precondition: [Out=0,V1>=2,V>=2,V+V1>=5] * Chain [[26,27],29,37]: 4*it(26)+4*it(27)+7*s(8)+3*s(19)+3*s(21)+6 Such that:aux(10) =< V1-V+1 aux(61) =< V1 aux(62) =< V1+V aux(63) =< V1/2+V/2 aux(64) =< V it(26) =< aux(63) s(8) =< aux(63) it(26) =< aux(62) it(27) =< aux(62) it(27) =< aux(63) it(26) =< aux(64) it(27) =< aux(64)+aux(10) it(27) =< aux(64)+aux(61) s(22) =< aux(64)+aux(61) s(22) =< it(27)*aux(64) s(21) =< s(22) s(19) =< aux(62) with precondition: [Out=0,V1>=2,V>=2,V+V1>=6] * Chain [[26,27],28,37]: 4*it(26)+4*it(27)+7*s(8)+3*s(19)+3*s(21)+6 Such that:aux(10) =< V1-V+1 aux(67) =< V1 aux(68) =< V1+V aux(69) =< V1/2+V/2 aux(70) =< V it(26) =< aux(69) s(8) =< aux(67) it(26) =< aux(68) it(27) =< aux(68) it(27) =< aux(69) it(26) =< aux(70) it(27) =< aux(70)+aux(10) it(27) =< aux(70)+aux(67) s(22) =< aux(70)+aux(67) s(22) =< it(27)*aux(70) s(21) =< s(22) s(19) =< aux(68) with precondition: [Out=0,V1>=3,V>=3,V+V1>=8] * Chain [37]: 2*s(6)+1*s(8)+2 Such that:s(8) =< V aux(3) =< V1 s(6) =< aux(3) with precondition: [Out=0,V1>=0,V>=0] * Chain [36]: 2 with precondition: [V1=1,Out=0,V>=2] * Chain [35]: 1 with precondition: [V=0,V1=Out,V1>=1] * Chain [34]: 2 with precondition: [V=1,Out=0,V1>=1] * Chain [33,37]: 1*s(8)+6 Such that:s(8) =< 1 with precondition: [V1=1,Out=0,V>=2] * Chain [32,[30],37]: 6*it(30)+1*s(8)+6 Such that:s(8) =< 1 aux(4) =< V it(30) =< aux(4) with precondition: [V1=1,Out=0,V>=2] * Chain [32,[30],34]: 4*it(30)+6 Such that:it(30) =< V with precondition: [V1=1,Out=0,V>=3] * Chain [32,[30],31,37]: 4*it(30)+1*s(8)+10 Such that:s(8) =< 1 it(30) =< V with precondition: [V1=1,Out=0,V>=3] * Chain [32,37]: 2*s(6)+1*s(8)+6 Such that:s(8) =< 1 aux(3) =< V s(6) =< aux(3) with precondition: [V1=1,Out=0,V>=2] * Chain [32,34]: 6 with precondition: [V1=1,Out=0,V>=2] * Chain [32,31,37]: 1*s(8)+10 Such that:s(8) =< 1 with precondition: [V1=1,Out=0,V>=2] * Chain [31,37]: 1*s(8)+6 Such that:s(8) =< 1 with precondition: [V=1,Out=0,V1>=1] * Chain [29,37]: 7*s(8)+6 Such that:aux(60) =< V s(8) =< aux(60) with precondition: [Out=0,V>=2,V1>=V] * Chain [28,37]: 7*s(8)+6 Such that:aux(66) =< V1 s(8) =< aux(66) with precondition: [Out=0,V1>=2,V>=V1+1] #### Cost of chains of start(V1,V,V2): * Chain [42]: 33*s(169)+17*s(173)+10*s(180)+44*s(181)+24*s(183)+18*s(185)+52*s(186)+20*s(187)+15*s(189)+7*s(191)+10 Such that:s(174) =< 1 s(176) =< V1-V+1 s(177) =< V1+V s(178) =< V1/2+V/2 aux(79) =< V1 aux(80) =< V s(173) =< aux(79) s(169) =< aux(80) s(180) =< s(174) s(181) =< s(178) s(181) =< s(177) s(183) =< s(177) s(183) =< s(178) s(181) =< aux(80) s(183) =< aux(80)+s(176) s(183) =< aux(80)+aux(79) s(184) =< aux(80)+aux(79) s(184) =< s(183)*aux(80) s(185) =< s(184) s(186) =< s(177) s(187) =< s(177) s(187) =< aux(80)+s(176) s(187) =< aux(80)+aux(79) s(188) =< aux(80)+aux(79) s(188) =< s(187)*aux(80) s(189) =< s(188) s(191) =< s(178) with precondition: [V1>=0] * Chain [41]: 57*s(198)+44*s(199)+24*s(201)+18*s(203)+134*s(204)+20*s(205)+15*s(207)+14*s(209)+107*s(215)+44*s(223)+24*s(225)+18*s(227)+20*s(229)+15*s(231)+7*s(233)+44*s(242)+24*s(244)+18*s(246)+20*s(248)+15*s(250)+16*s(251)+12 Such that:s(237) =< -2*V+V2+1 s(218) =< -V+1 s(236) =< -V+V2 s(220) =< V/2 aux(85) =< 1 aux(86) =< V aux(87) =< V2 aux(88) =< V2/2 s(198) =< aux(85) s(204) =< aux(87) s(223) =< s(220) s(215) =< aux(86) s(223) =< aux(86) s(225) =< aux(86) s(225) =< s(220) s(225) =< aux(86)+s(218) s(226) =< aux(86) s(226) =< s(225)*aux(86) s(227) =< s(226) s(229) =< aux(86) s(229) =< aux(86)+s(218) s(230) =< aux(86) s(230) =< s(229)*aux(86) s(231) =< s(230) s(233) =< s(220) s(242) =< aux(88) s(242) =< aux(87) s(244) =< aux(87) s(244) =< aux(88) s(242) =< aux(86) s(244) =< aux(86)+s(237) s(244) =< aux(86)+s(236) s(245) =< aux(86)+s(236) s(245) =< s(244)*aux(86) s(246) =< s(245) s(248) =< aux(87) s(248) =< aux(86)+s(237) s(248) =< aux(86)+s(236) s(249) =< aux(86)+s(236) s(249) =< s(248)*aux(86) s(250) =< s(249) s(251) =< s(236) s(209) =< aux(88) s(199) =< aux(88) s(199) =< aux(87) s(201) =< aux(87) s(201) =< aux(88) s(199) =< aux(85) s(201) =< aux(85)+aux(87) s(202) =< aux(85)+aux(87) s(202) =< s(201)*aux(85) s(203) =< s(202) s(205) =< aux(87) s(205) =< aux(85)+aux(87) s(206) =< aux(85)+aux(87) s(206) =< s(205)*aux(85) s(207) =< s(206) with precondition: [V1=1,V>=1,V2>=1] * Chain [40]: 57*s(259)+44*s(260)+24*s(262)+18*s(264)+134*s(265)+20*s(266)+15*s(268)+14*s(270)+107*s(276)+44*s(284)+24*s(286)+18*s(288)+20*s(290)+15*s(292)+7*s(294)+44*s(303)+24*s(305)+18*s(307)+20*s(309)+15*s(311)+16*s(312)+12 Such that:s(298) =< V-2*V2+1 s(297) =< V-V2 s(279) =< -V2+1 s(281) =< V2/2 aux(93) =< 1 aux(94) =< V aux(95) =< V/2 aux(96) =< V2 s(259) =< aux(93) s(265) =< aux(94) s(284) =< s(281) s(276) =< aux(96) s(284) =< aux(96) s(286) =< aux(96) s(286) =< s(281) s(286) =< aux(96)+s(279) s(287) =< aux(96) s(287) =< s(286)*aux(96) s(288) =< s(287) s(290) =< aux(96) s(290) =< aux(96)+s(279) s(291) =< aux(96) s(291) =< s(290)*aux(96) s(292) =< s(291) s(294) =< s(281) s(303) =< aux(95) s(303) =< aux(94) s(305) =< aux(94) s(305) =< aux(95) s(303) =< aux(96) s(305) =< aux(96)+s(298) s(305) =< aux(96)+s(297) s(306) =< aux(96)+s(297) s(306) =< s(305)*aux(96) s(307) =< s(306) s(309) =< aux(94) s(309) =< aux(96)+s(298) s(309) =< aux(96)+s(297) s(310) =< aux(96)+s(297) s(310) =< s(309)*aux(96) s(311) =< s(310) s(312) =< s(297) s(270) =< aux(95) s(260) =< aux(95) s(260) =< aux(94) s(262) =< aux(94) s(262) =< aux(95) s(260) =< aux(93) s(262) =< aux(93)+aux(94) s(263) =< aux(93)+aux(94) s(263) =< s(262)*aux(93) s(264) =< s(263) s(266) =< aux(94) s(266) =< aux(93)+aux(94) s(267) =< aux(93)+aux(94) s(267) =< s(266)*aux(93) s(268) =< s(267) with precondition: [V1=2,V>=1,V2>=1] * Chain [39]: 1 with precondition: [V=0,V1>=0] * Chain [38]: 3*s(316)+14*s(317)+6 Such that:s(314) =< 1 s(315) =< V1 s(316) =< s(314) s(317) =< s(315) with precondition: [V=1,V1>=1] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [42] with precondition: [V1>=0] - Upper bound: 50*V1+20+nat(V)*66+nat(V1+V)*96+nat(V1/2+V/2)*51 - Complexity: n * Chain [41] with precondition: [V1=1,V>=1,V2>=1] - Upper bound: 217*V+255*V2+146+nat(-V+V2)*49+51/2*V+29*V2 - Complexity: n * Chain [40] with precondition: [V1=2,V>=1,V2>=1] - Upper bound: 255*V+217*V2+146+nat(V-V2)*49+29*V+51/2*V2 - Complexity: n * Chain [39] with precondition: [V=0,V1>=0] - Upper bound: 1 - Complexity: constant * Chain [38] with precondition: [V=1,V1>=1] - Upper bound: 14*V1+9 - Complexity: n ### Maximum cost of start(V1,V,V2): max([14*V1+8,nat(V)*66+19+max([nat(V1+V)*96+50*V1+nat(V1/2+V/2)*51,nat(V)*151+126+nat(V2)*217+nat(V/2)*51+nat(V2/2)*51+max([nat(-V+V2)*49+nat(V2)*38+nat(V2/2)*7,nat(V-V2)*49+nat(V)*38+nat(V/2)*7])])])+1 Asymptotic class: n * Total analysis performed in 818 ms. ---------------------------------------- (10) BOUNDS(1, n^1) ---------------------------------------- (11) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (12) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0') -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0') -> false le(0', Y) -> true gcd(0', Y) -> 0' gcd(s(X), 0') -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (14) Obligation: Innermost TRS: Rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0') -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0') -> false le(0', Y) -> true gcd(0', Y) -> 0' gcd(s(X), 0') -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) Types: minus :: s:0' -> s:0' -> s:0' s :: s:0' -> s:0' pred :: s:0' -> s:0' 0' :: s:0' le :: s:0' -> s:0' -> false:true false :: false:true true :: false:true gcd :: s:0' -> s:0' -> s:0' if :: false:true -> s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' hole_false:true2_0 :: false:true gen_s:0'3_0 :: Nat -> s:0' ---------------------------------------- (15) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: minus, le, gcd They will be analysed ascendingly in the following order: minus < gcd le < gcd ---------------------------------------- (16) Obligation: Innermost TRS: Rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0') -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0') -> false le(0', Y) -> true gcd(0', Y) -> 0' gcd(s(X), 0') -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) Types: minus :: s:0' -> s:0' -> s:0' s :: s:0' -> s:0' pred :: s:0' -> s:0' 0' :: s:0' le :: s:0' -> s:0' -> false:true false :: false:true true :: false:true gcd :: s:0' -> s:0' -> s:0' if :: false:true -> s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' hole_false:true2_0 :: false:true 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: minus, le, gcd They will be analysed ascendingly in the following order: minus < gcd le < gcd ---------------------------------------- (17) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: minus(gen_s:0'3_0(a), gen_s:0'3_0(+(1, n5_0))) -> *4_0, rt in Omega(n5_0) Induction Base: minus(gen_s:0'3_0(a), gen_s:0'3_0(+(1, 0))) Induction Step: minus(gen_s:0'3_0(a), gen_s:0'3_0(+(1, +(n5_0, 1)))) ->_R^Omega(1) pred(minus(gen_s:0'3_0(a), gen_s:0'3_0(+(1, n5_0)))) ->_IH pred(*4_0) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (18) Complex Obligation (BEST) ---------------------------------------- (19) Obligation: Proved the lower bound n^1 for the following obligation: Innermost TRS: Rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0') -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0') -> false le(0', Y) -> true gcd(0', Y) -> 0' gcd(s(X), 0') -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) Types: minus :: s:0' -> s:0' -> s:0' s :: s:0' -> s:0' pred :: s:0' -> s:0' 0' :: s:0' le :: s:0' -> s:0' -> false:true false :: false:true true :: false:true gcd :: s:0' -> s:0' -> s:0' if :: false:true -> s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' hole_false:true2_0 :: false:true 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: minus, le, gcd They will be analysed ascendingly in the following order: minus < gcd le < gcd ---------------------------------------- (20) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (21) BOUNDS(n^1, INF) ---------------------------------------- (22) Obligation: Innermost TRS: Rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0') -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0') -> false le(0', Y) -> true gcd(0', Y) -> 0' gcd(s(X), 0') -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) Types: minus :: s:0' -> s:0' -> s:0' s :: s:0' -> s:0' pred :: s:0' -> s:0' 0' :: s:0' le :: s:0' -> s:0' -> false:true false :: false:true true :: false:true gcd :: s:0' -> s:0' -> s:0' if :: false:true -> s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' hole_false:true2_0 :: false:true gen_s:0'3_0 :: Nat -> s:0' Lemmas: minus(gen_s:0'3_0(a), gen_s:0'3_0(+(1, n5_0))) -> *4_0, rt in Omega(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: le, gcd They will be analysed ascendingly in the following order: le < gcd ---------------------------------------- (23) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: le(gen_s:0'3_0(+(1, n3087_0)), gen_s:0'3_0(n3087_0)) -> false, rt in Omega(1 + n3087_0) Induction Base: le(gen_s:0'3_0(+(1, 0)), gen_s:0'3_0(0)) ->_R^Omega(1) false Induction Step: le(gen_s:0'3_0(+(1, +(n3087_0, 1))), gen_s:0'3_0(+(n3087_0, 1))) ->_R^Omega(1) le(gen_s:0'3_0(+(1, n3087_0)), gen_s:0'3_0(n3087_0)) ->_IH false We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (24) Obligation: Innermost TRS: Rules: minus(X, s(Y)) -> pred(minus(X, Y)) minus(X, 0') -> X pred(s(X)) -> X le(s(X), s(Y)) -> le(X, Y) le(s(X), 0') -> false le(0', Y) -> true gcd(0', Y) -> 0' gcd(s(X), 0') -> s(X) gcd(s(X), s(Y)) -> if(le(Y, X), s(X), s(Y)) if(true, s(X), s(Y)) -> gcd(minus(X, Y), s(Y)) if(false, s(X), s(Y)) -> gcd(minus(Y, X), s(X)) Types: minus :: s:0' -> s:0' -> s:0' s :: s:0' -> s:0' pred :: s:0' -> s:0' 0' :: s:0' le :: s:0' -> s:0' -> false:true false :: false:true true :: false:true gcd :: s:0' -> s:0' -> s:0' if :: false:true -> s:0' -> s:0' -> s:0' hole_s:0'1_0 :: s:0' hole_false:true2_0 :: false:true gen_s:0'3_0 :: Nat -> s:0' Lemmas: minus(gen_s:0'3_0(a), gen_s:0'3_0(+(1, n5_0))) -> *4_0, rt in Omega(n5_0) le(gen_s:0'3_0(+(1, n3087_0)), gen_s:0'3_0(n3087_0)) -> false, rt in Omega(1 + n3087_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: gcd