/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, 350 ms] (10) BOUNDS(1, n^1) (11) RelTrsToDecreasingLoopProblemProof [LOWER BOUND(ID), 0 ms] (12) TRS for Loop Detection (13) DecreasingLoopProof [LOWER BOUND(ID), 0 ms] (14) BEST (15) proven lower bound (16) LowerBoundPropagationProof [FINISHED, 0 ms] (17) BOUNDS(n^1, INF) (18) TRS for Loop Detection ---------------------------------------- (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, 0) -> x minus(s(x), s(y)) -> minus(x, y) le(0, y) -> true le(s(x), 0) -> false le(s(x), s(y)) -> le(x, y) quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) if_quot(true, x, y) -> s(quot(minus(x, y), y)) if_quot(false, x, y) -> 0 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, 0) -> x [1] minus(s(x), s(y)) -> minus(x, y) [1] le(0, y) -> true [1] le(s(x), 0) -> false [1] le(s(x), s(y)) -> le(x, y) [1] quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) [1] if_quot(true, x, y) -> s(quot(minus(x, y), y)) [1] if_quot(false, x, y) -> 0 [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, 0) -> x [1] minus(s(x), s(y)) -> minus(x, y) [1] le(0, y) -> true [1] le(s(x), 0) -> false [1] le(s(x), s(y)) -> le(x, y) [1] quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) [1] if_quot(true, x, y) -> s(quot(minus(x, y), y)) [1] if_quot(false, x, y) -> 0 [1] The TRS has the following type information: minus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s le :: 0:s -> 0:s -> true:false true :: true:false false :: true:false quot :: 0:s -> 0:s -> 0:s if_quot :: true:false -> 0:s -> 0:s -> 0:s 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: minus(v0, v1) -> null_minus [0] quot(v0, v1) -> null_quot [0] le(v0, v1) -> null_le [0] if_quot(v0, v1, v2) -> null_if_quot [0] And the following fresh constants: null_minus, null_quot, null_le, null_if_quot ---------------------------------------- (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, 0) -> x [1] minus(s(x), s(y)) -> minus(x, y) [1] le(0, y) -> true [1] le(s(x), 0) -> false [1] le(s(x), s(y)) -> le(x, y) [1] quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) [1] if_quot(true, x, y) -> s(quot(minus(x, y), y)) [1] if_quot(false, x, y) -> 0 [1] minus(v0, v1) -> null_minus [0] quot(v0, v1) -> null_quot [0] le(v0, v1) -> null_le [0] if_quot(v0, v1, v2) -> null_if_quot [0] The TRS has the following type information: minus :: 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot 0 :: 0:s:null_minus:null_quot:null_if_quot s :: 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot le :: 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot -> true:false:null_le true :: true:false:null_le false :: true:false:null_le quot :: 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot if_quot :: true:false:null_le -> 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot -> 0:s:null_minus:null_quot:null_if_quot null_minus :: 0:s:null_minus:null_quot:null_if_quot null_quot :: 0:s:null_minus:null_quot:null_if_quot null_le :: true:false:null_le null_if_quot :: 0:s:null_minus:null_quot:null_if_quot 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 true => 2 false => 1 null_minus => 0 null_quot => 0 null_le => 0 null_if_quot => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: if_quot(z, z', z'') -{ 1 }-> 0 :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 if_quot(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 if_quot(z, z', z'') -{ 1 }-> 1 + quot(minus(x, y), y) :|: z = 2, z' = x, z'' = y, x >= 0, y >= 0 le(z, z') -{ 1 }-> le(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x le(z, z') -{ 1 }-> 2 :|: y >= 0, z = 0, z' = y le(z, z') -{ 1 }-> 1 :|: x >= 0, z = 1 + x, 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 }-> minus(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x minus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 quot(z, z') -{ 1 }-> if_quot(le(1 + y, x), x, 1 + y) :|: z' = 1 + y, x >= 0, y >= 0, z = x quot(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 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, V12),0,[minus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V12),0,[le(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V12),0,[quot(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V12),0,[fun(V1, V, V12, Out)],[V1 >= 0,V >= 0,V12 >= 0]). eq(minus(V1, V, Out),1,[],[Out = V2,V2 >= 0,V1 = V2,V = 0]). eq(minus(V1, V, Out),1,[minus(V3, V4, Ret)],[Out = Ret,V = 1 + V4,V3 >= 0,V4 >= 0,V1 = 1 + V3]). eq(le(V1, V, Out),1,[],[Out = 2,V5 >= 0,V1 = 0,V = V5]). eq(le(V1, V, Out),1,[],[Out = 1,V6 >= 0,V1 = 1 + V6,V = 0]). eq(le(V1, V, Out),1,[le(V7, V8, Ret1)],[Out = Ret1,V = 1 + V8,V7 >= 0,V8 >= 0,V1 = 1 + V7]). eq(quot(V1, V, Out),1,[le(1 + V10, V9, Ret0),fun(Ret0, V9, 1 + V10, Ret2)],[Out = Ret2,V = 1 + V10,V9 >= 0,V10 >= 0,V1 = V9]). eq(fun(V1, V, V12, Out),1,[minus(V13, V11, Ret10),quot(Ret10, V11, Ret11)],[Out = 1 + Ret11,V1 = 2,V = V13,V12 = V11,V13 >= 0,V11 >= 0]). eq(fun(V1, V, V12, Out),1,[],[Out = 0,V = V15,V12 = V14,V1 = 1,V15 >= 0,V14 >= 0]). eq(minus(V1, V, Out),0,[],[Out = 0,V17 >= 0,V16 >= 0,V1 = V17,V = V16]). eq(quot(V1, V, Out),0,[],[Out = 0,V19 >= 0,V18 >= 0,V1 = V19,V = V18]). eq(le(V1, V, Out),0,[],[Out = 0,V21 >= 0,V20 >= 0,V1 = V21,V = V20]). eq(fun(V1, V, V12, Out),0,[],[Out = 0,V22 >= 0,V12 = V24,V23 >= 0,V1 = V22,V = V23,V24 >= 0]). input_output_vars(minus(V1,V,Out),[V1,V],[Out]). input_output_vars(le(V1,V,Out),[V1,V],[Out]). input_output_vars(quot(V1,V,Out),[V1,V],[Out]). input_output_vars(fun(V1,V,V12,Out),[V1,V,V12],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [minus/3] 1. recursive : [le/3] 2. recursive : [fun/4,quot/3] 3. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into minus/3 1. SCC is partially evaluated into le/3 2. SCC is partially evaluated into quot/3 3. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations minus/3 * CE 9 is refined into CE [18] * CE 7 is refined into CE [19] * CE 8 is refined into CE [20] ### Cost equations --> "Loop" of minus/3 * CEs [20] --> Loop 12 * CEs [18] --> Loop 13 * CEs [19] --> Loop 14 ### Ranking functions of CR minus(V1,V,Out) * RF of phase [12]: [V,V1] #### Partial ranking functions of CR minus(V1,V,Out) * Partial RF of phase [12]: - RF of loop [12:1]: V V1 ### Specialization of cost equations le/3 * CE 17 is refined into CE [21] * CE 15 is refined into CE [22] * CE 14 is refined into CE [23] * CE 16 is refined into CE [24] ### Cost equations --> "Loop" of le/3 * CEs [24] --> Loop 15 * CEs [21] --> Loop 16 * CEs [22] --> Loop 17 * CEs [23] --> Loop 18 ### Ranking functions of CR le(V1,V,Out) * RF of phase [15]: [V,V1] #### Partial ranking functions of CR le(V1,V,Out) * Partial RF of phase [15]: - RF of loop [15:1]: V V1 ### Specialization of cost equations quot/3 * CE 10 is refined into CE [25,26,27,28] * CE 11 is refined into CE [29,30] * CE 13 is refined into CE [31] * CE 12 is refined into CE [32,33] ### Cost equations --> "Loop" of quot/3 * CEs [33] --> Loop 19 * CEs [32] --> Loop 20 * CEs [25,26,27,28,29,30,31] --> Loop 21 ### Ranking functions of CR quot(V1,V,Out) * RF of phase [19]: [V1,V1-V+1] #### Partial ranking functions of CR quot(V1,V,Out) * Partial RF of phase [19]: - RF of loop [19:1]: V1 V1-V+1 ### Specialization of cost equations start/3 * CE 3 is refined into CE [34,35,36,37] * CE 1 is refined into CE [38] * CE 2 is refined into CE [39] * CE 4 is refined into CE [40,41,42] * CE 5 is refined into CE [43,44,45,46,47] * CE 6 is refined into CE [48,49] ### Cost equations --> "Loop" of start/3 * CEs [40,44] --> Loop 22 * CEs [34,35,36,37] --> Loop 23 * CEs [39] --> Loop 24 * CEs [38,41,42,43,45,46,47,48,49] --> Loop 25 ### Ranking functions of CR start(V1,V,V12) #### Partial ranking functions of CR start(V1,V,V12) Computing Bounds ===================================== #### Cost of chains of minus(V1,V,Out): * Chain [[12],14]: 1*it(12)+1 Such that:it(12) =< V with precondition: [V1=Out+V,V>=1,V1>=V] * Chain [[12],13]: 1*it(12)+0 Such that:it(12) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [14]: 1 with precondition: [V=0,V1=Out,V1>=0] * Chain [13]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of le(V1,V,Out): * Chain [[15],18]: 1*it(15)+1 Such that:it(15) =< V1 with precondition: [Out=2,V1>=1,V>=V1] * Chain [[15],17]: 1*it(15)+1 Such that:it(15) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [[15],16]: 1*it(15)+0 Such that:it(15) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [18]: 1 with precondition: [V1=0,Out=2,V>=0] * Chain [17]: 1 with precondition: [V=0,Out=1,V1>=1] * Chain [16]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of quot(V1,V,Out): * Chain [[19],21]: 9*it(19)+1*s(5)+3 Such that:s(5) =< V aux(5) =< V1 it(19) =< aux(5) with precondition: [V>=1,Out>=1,V1+1>=Out+V] * Chain [[19],20,21]: 4*it(19)+3*s(5)+2*s(11)+6 Such that:aux(3) =< V1 aux(7) =< V aux(8) =< V1-V it(19) =< aux(8) s(5) =< aux(7) it(19) =< aux(3) s(12) =< aux(3) s(12) =< aux(8) s(11) =< s(12) with precondition: [V>=1,Out>=2,V1+2>=2*V+Out] * Chain [21]: 3*s(3)+1*s(5)+3 Such that:s(5) =< V aux(1) =< V1 s(3) =< aux(1) with precondition: [Out=0,V1>=0,V>=0] * Chain [20,21]: 3*s(5)+6 Such that:aux(7) =< V s(5) =< aux(7) with precondition: [Out=1,V>=1,V1>=V] #### Cost of chains of start(V1,V,V12): * Chain [25]: 12*s(27)+13*s(31)+4*s(39)+2*s(41)+6 Such that:s(35) =< V1-V aux(11) =< V1 aux(12) =< V s(31) =< aux(11) s(27) =< aux(12) s(39) =< s(35) s(39) =< aux(11) s(40) =< aux(11) s(40) =< s(35) s(41) =< s(40) with precondition: [V1>=0,V>=0] * Chain [24]: 1 with precondition: [V1=1,V>=0,V12>=0] * Chain [23]: 3*s(45)+12*s(46)+12*s(53)+4*s(59)+2*s(61)+8 Such that:s(44) =< V s(55) =< V-2*V12 aux(16) =< V-V12 aux(17) =< V12 s(45) =< s(44) s(46) =< aux(17) s(59) =< s(55) s(59) =< aux(16) s(60) =< aux(16) s(60) =< s(55) s(61) =< s(60) s(53) =< aux(16) with precondition: [V1=2,V>=0,V12>=0] * Chain [22]: 1 with precondition: [V=0,V1>=0] Closed-form bounds of start(V1,V,V12): ------------------------------------- * Chain [25] with precondition: [V1>=0,V>=0] - Upper bound: 15*V1+12*V+6+nat(V1-V)*4 - Complexity: n * Chain [24] with precondition: [V1=1,V>=0,V12>=0] - Upper bound: 1 - Complexity: constant * Chain [23] with precondition: [V1=2,V>=0,V12>=0] - Upper bound: 3*V+12*V12+8+nat(V-V12)*14+nat(V-2*V12)*4 - Complexity: n * Chain [22] with precondition: [V=0,V1>=0] - Upper bound: 1 - Complexity: constant ### Maximum cost of start(V1,V,V12): 3*V+5+max([15*V1+9*V+nat(V1-V)*4,nat(V12)*12+2+nat(V-V12)*14+nat(V-2*V12)*4])+1 Asymptotic class: n * Total analysis performed in 269 ms. ---------------------------------------- (10) BOUNDS(1, n^1) ---------------------------------------- (11) RelTrsToDecreasingLoopProblemProof (LOWER BOUND(ID)) Transformed a relative TRS into a decreasing-loop problem. ---------------------------------------- (12) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: minus(x, 0) -> x minus(s(x), s(y)) -> minus(x, y) le(0, y) -> true le(s(x), 0) -> false le(s(x), s(y)) -> le(x, y) quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) if_quot(true, x, y) -> s(quot(minus(x, y), y)) if_quot(false, x, y) -> 0 S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) DecreasingLoopProof (LOWER BOUND(ID)) The following loop(s) give(s) rise to the lower bound Omega(n^1): The rewrite sequence minus(s(x), s(y)) ->^+ minus(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 [ ]. ---------------------------------------- (14) Complex Obligation (BEST) ---------------------------------------- (15) Obligation: Proved the lower bound n^1 for the following obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: minus(x, 0) -> x minus(s(x), s(y)) -> minus(x, y) le(0, y) -> true le(s(x), 0) -> false le(s(x), s(y)) -> le(x, y) quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) if_quot(true, x, y) -> s(quot(minus(x, y), y)) if_quot(false, x, y) -> 0 S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (16) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (17) BOUNDS(n^1, INF) ---------------------------------------- (18) Obligation: Analyzing the following TRS for decreasing loops: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: minus(x, 0) -> x minus(s(x), s(y)) -> minus(x, y) le(0, y) -> true le(s(x), 0) -> false le(s(x), s(y)) -> le(x, y) quot(x, s(y)) -> if_quot(le(s(y), x), x, s(y)) if_quot(true, x, y) -> s(quot(minus(x, y), y)) if_quot(false, x, y) -> 0 S is empty. Rewrite Strategy: INNERMOST