/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^1)) 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^1). (0) CpxTRS (1) NestedDefinedSymbolProof [UPPER BOUND(ID), 0 ms] (2) CpxTRS (3) RcToIrcProof [BOTH BOUNDS(ID, ID), 0 ms] (4) CpxTRS (5) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (6) CpxWeightedTrs (7) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (8) CpxTypedWeightedTrs (9) CompletionProof [UPPER BOUND(ID), 0 ms] (10) CpxTypedWeightedCompleteTrs (11) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (12) CpxRNTS (13) CompleteCoflocoProof [FINISHED, 288 ms] (14) BOUNDS(1, n^1) (15) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (16) CpxTRS (17) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (18) typed CpxTrs (19) OrderProof [LOWER BOUND(ID), 0 ms] (20) typed CpxTrs (21) RewriteLemmaProof [LOWER BOUND(ID), 278 ms] (22) BEST (23) proven lower bound (24) LowerBoundPropagationProof [FINISHED, 0 ms] (25) BOUNDS(n^1, INF) (26) typed CpxTrs (27) RewriteLemmaProof [LOWER BOUND(ID), 52 ms] (28) BOUNDS(1, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (full) 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) quot(0, s(y)) -> 0 quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0, y) -> y plus(s(x), y) -> s(plus(x, y)) plus(minus(x, s(0)), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) NestedDefinedSymbolProof (UPPER BOUND(ID)) The following defined symbols can occur below the 0th argument of quot: minus The following defined symbols can occur below the 0th argument of minus: minus Hence, the left-hand sides of the following rules are not basic-reachable and can be removed: plus(minus(x, s(0)), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0))) ---------------------------------------- (2) Obligation: The Runtime Complexity (full) of the given CpxTRS could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: minus(x, 0) -> x minus(s(x), s(y)) -> minus(x, y) quot(0, s(y)) -> 0 quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0, y) -> y plus(s(x), y) -> s(plus(x, y)) S is empty. Rewrite Strategy: FULL ---------------------------------------- (3) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: quot(s(x), s([])) The defined contexts are: quot([], s(x1)) minus([], x1) [] just represents basic- or constructor-terms in the following defined contexts: quot([], s(x1)) As the TRS is an overlay system and the defined contexts and the duplicating contexts don't overlap, we have rc = irc. ---------------------------------------- (4) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: minus(x, 0) -> x minus(s(x), s(y)) -> minus(x, y) quot(0, s(y)) -> 0 quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0, y) -> y plus(s(x), y) -> s(plus(x, y)) S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (5) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (6) 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] quot(0, s(y)) -> 0 [1] quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) [1] plus(0, y) -> y [1] plus(s(x), y) -> s(plus(x, y)) [1] Rewrite Strategy: INNERMOST ---------------------------------------- (7) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (8) 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] quot(0, s(y)) -> 0 [1] quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) [1] plus(0, y) -> y [1] plus(s(x), y) -> s(plus(x, y)) [1] The TRS has the following type information: minus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s quot :: 0:s -> 0:s -> 0:s plus :: 0:s -> 0:s -> 0:s Rewrite Strategy: INNERMOST ---------------------------------------- (9) 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] plus(v0, v1) -> null_plus [0] And the following fresh constants: null_minus, null_quot, null_plus ---------------------------------------- (10) 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] quot(0, s(y)) -> 0 [1] quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) [1] plus(0, y) -> y [1] plus(s(x), y) -> s(plus(x, y)) [1] minus(v0, v1) -> null_minus [0] quot(v0, v1) -> null_quot [0] plus(v0, v1) -> null_plus [0] The TRS has the following type information: minus :: 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus 0 :: 0:s:null_minus:null_quot:null_plus s :: 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus quot :: 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus plus :: 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus -> 0:s:null_minus:null_quot:null_plus null_minus :: 0:s:null_minus:null_quot:null_plus null_quot :: 0:s:null_minus:null_quot:null_plus null_plus :: 0:s:null_minus:null_quot:null_plus Rewrite Strategy: INNERMOST ---------------------------------------- (11) 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 null_minus => 0 null_quot => 0 null_plus => 0 ---------------------------------------- (12) Obligation: Complexity RNTS consisting of the following rules: 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 plus(z, z') -{ 1 }-> y :|: y >= 0, z = 0, z' = y plus(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 plus(z, z') -{ 1 }-> 1 + plus(x, y) :|: x >= 0, y >= 0, z = 1 + x, z' = y quot(z, z') -{ 1 }-> 0 :|: z' = 1 + y, y >= 0, z = 0 quot(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 quot(z, z') -{ 1 }-> 1 + quot(minus(x, y), 1 + y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (13) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V1, V),0,[minus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[quot(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[plus(V1, V, Out)],[V1 >= 0,V >= 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(quot(V1, V, Out),1,[],[Out = 0,V = 1 + V5,V5 >= 0,V1 = 0]). eq(quot(V1, V, Out),1,[minus(V7, V6, Ret10),quot(Ret10, 1 + V6, Ret1)],[Out = 1 + Ret1,V = 1 + V6,V7 >= 0,V6 >= 0,V1 = 1 + V7]). eq(plus(V1, V, Out),1,[],[Out = V8,V8 >= 0,V1 = 0,V = V8]). eq(plus(V1, V, Out),1,[plus(V9, V10, Ret11)],[Out = 1 + Ret11,V9 >= 0,V10 >= 0,V1 = 1 + V9,V = V10]). eq(minus(V1, V, Out),0,[],[Out = 0,V12 >= 0,V11 >= 0,V1 = V12,V = V11]). eq(quot(V1, V, Out),0,[],[Out = 0,V14 >= 0,V13 >= 0,V1 = V14,V = V13]). eq(plus(V1, V, Out),0,[],[Out = 0,V16 >= 0,V15 >= 0,V1 = V16,V = V15]). input_output_vars(minus(V1,V,Out),[V1,V],[Out]). input_output_vars(quot(V1,V,Out),[V1,V],[Out]). input_output_vars(plus(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [minus/3] 1. recursive : [plus/3] 2. recursive : [quot/3] 3. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into minus/3 1. SCC is partially evaluated into plus/3 2. SCC is partially evaluated into quot/3 3. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations minus/3 * CE 6 is refined into CE [13] * CE 4 is refined into CE [14] * CE 5 is refined into CE [15] ### Cost equations --> "Loop" of minus/3 * CEs [15] --> Loop 10 * CEs [13] --> Loop 11 * CEs [14] --> Loop 12 ### Ranking functions of CR minus(V1,V,Out) * RF of phase [10]: [V,V1] #### Partial ranking functions of CR minus(V1,V,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V V1 ### Specialization of cost equations plus/3 * CE 12 is refined into CE [16] * CE 10 is refined into CE [17] * CE 11 is refined into CE [18] ### Cost equations --> "Loop" of plus/3 * CEs [18] --> Loop 13 * CEs [16] --> Loop 14 * CEs [17] --> Loop 15 ### Ranking functions of CR plus(V1,V,Out) * RF of phase [13]: [V1] #### Partial ranking functions of CR plus(V1,V,Out) * Partial RF of phase [13]: - RF of loop [13:1]: V1 ### Specialization of cost equations quot/3 * CE 7 is refined into CE [19] * CE 9 is refined into CE [20] * CE 8 is refined into CE [21,22,23] ### Cost equations --> "Loop" of quot/3 * CEs [23] --> Loop 16 * CEs [22] --> Loop 17 * CEs [21] --> Loop 18 * CEs [19,20] --> Loop 19 ### Ranking functions of CR quot(V1,V,Out) * RF of phase [16]: [V1-1,V1-V+1] * RF of phase [18]: [V1] #### Partial ranking functions of CR quot(V1,V,Out) * Partial RF of phase [16]: - RF of loop [16:1]: V1-1 V1-V+1 * Partial RF of phase [18]: - RF of loop [18:1]: V1 ### Specialization of cost equations start/2 * CE 1 is refined into CE [24,25,26] * CE 2 is refined into CE [27,28,29,30,31] * CE 3 is refined into CE [32,33,34,35] ### Cost equations --> "Loop" of start/2 * CEs [27] --> Loop 20 * CEs [24] --> Loop 21 * CEs [25,26,28,29,30,31,32,33,34,35] --> Loop 22 ### Ranking functions of CR start(V1,V) #### Partial ranking functions of CR start(V1,V) Computing Bounds ===================================== #### Cost of chains of minus(V1,V,Out): * Chain [[10],12]: 1*it(10)+1 Such that:it(10) =< V with precondition: [V1=Out+V,V>=1,V1>=V] * Chain [[10],11]: 1*it(10)+0 Such that:it(10) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [12]: 1 with precondition: [V=0,V1=Out,V1>=0] * Chain [11]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of plus(V1,V,Out): * Chain [[13],15]: 1*it(13)+1 Such that:it(13) =< -V+Out with precondition: [V+V1=Out,V1>=1,V>=0] * Chain [[13],14]: 1*it(13)+0 Such that:it(13) =< Out with precondition: [V>=0,Out>=1,V1>=Out] * Chain [15]: 1 with precondition: [V1=0,V=Out,V>=0] * Chain [14]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of quot(V1,V,Out): * Chain [[18],19]: 2*it(18)+1 Such that:it(18) =< Out with precondition: [V=1,Out>=1,V1>=Out] * Chain [[18],17,19]: 2*it(18)+1*s(2)+2 Such that:s(2) =< 1 it(18) =< Out with precondition: [V=1,Out>=2,V1>=Out] * Chain [[16],19]: 2*it(16)+1*s(5)+1 Such that:it(16) =< V1-V+1 aux(3) =< V1 it(16) =< aux(3) s(5) =< aux(3) with precondition: [V>=2,Out>=1,V1+2>=2*Out+V] * Chain [[16],17,19]: 2*it(16)+1*s(2)+1*s(5)+2 Such that:it(16) =< V1-V+1 s(2) =< V aux(4) =< V1 it(16) =< aux(4) s(5) =< aux(4) with precondition: [V>=2,Out>=2,V1+3>=2*Out+V] * Chain [19]: 1 with precondition: [Out=0,V1>=0,V>=0] * Chain [17,19]: 1*s(2)+2 Such that:s(2) =< V with precondition: [Out=1,V1>=1,V>=1] #### Cost of chains of start(V1,V): * Chain [22]: 4*s(9)+4*s(12)+4*s(14)+2 Such that:aux(6) =< V1 aux(7) =< V1-V+1 aux(8) =< V s(14) =< aux(6) s(12) =< aux(7) s(9) =< aux(8) s(12) =< aux(6) with precondition: [V1>=0,V>=0] * Chain [21]: 1 with precondition: [V=0,V1>=0] * Chain [20]: 1*s(21)+4*s(23)+2 Such that:s(21) =< 1 s(22) =< V1 s(23) =< s(22) with precondition: [V=1,V1>=1] Closed-form bounds of start(V1,V): ------------------------------------- * Chain [22] with precondition: [V1>=0,V>=0] - Upper bound: 4*V1+4*V+2+nat(V1-V+1)*4 - Complexity: n * Chain [21] with precondition: [V=0,V1>=0] - Upper bound: 1 - Complexity: constant * Chain [20] with precondition: [V=1,V1>=1] - Upper bound: 4*V1+3 - Complexity: n ### Maximum cost of start(V1,V): 4*V1+1+max([1,nat(V1-V+1)*4+4*V])+1 Asymptotic class: n * Total analysis performed in 217 ms. ---------------------------------------- (14) BOUNDS(1, n^1) ---------------------------------------- (15) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (16) 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: minus(x, 0') -> x minus(s(x), s(y)) -> minus(x, y) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0', y) -> y plus(s(x), y) -> s(plus(x, y)) plus(minus(x, s(0')), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0'))) S is empty. Rewrite Strategy: FULL ---------------------------------------- (17) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (18) Obligation: TRS: Rules: minus(x, 0') -> x minus(s(x), s(y)) -> minus(x, y) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0', y) -> y plus(s(x), y) -> s(plus(x, y)) plus(minus(x, s(0')), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0'))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s quot :: 0':s -> 0':s -> 0':s plus :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s ---------------------------------------- (19) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: minus, quot, plus They will be analysed ascendingly in the following order: minus < quot minus < plus ---------------------------------------- (20) Obligation: TRS: Rules: minus(x, 0') -> x minus(s(x), s(y)) -> minus(x, y) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0', y) -> y plus(s(x), y) -> s(plus(x, y)) plus(minus(x, s(0')), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0'))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s quot :: 0':s -> 0':s -> 0':s plus :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: minus, quot, plus They will be analysed ascendingly in the following order: minus < quot minus < plus ---------------------------------------- (21) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: minus(gen_0':s2_0(n4_0), gen_0':s2_0(n4_0)) -> gen_0':s2_0(0), rt in Omega(1 + n4_0) Induction Base: minus(gen_0':s2_0(0), gen_0':s2_0(0)) ->_R^Omega(1) gen_0':s2_0(0) Induction Step: minus(gen_0':s2_0(+(n4_0, 1)), gen_0':s2_0(+(n4_0, 1))) ->_R^Omega(1) minus(gen_0':s2_0(n4_0), gen_0':s2_0(n4_0)) ->_IH gen_0':s2_0(0) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (22) Complex Obligation (BEST) ---------------------------------------- (23) Obligation: Proved the lower bound n^1 for the following obligation: TRS: Rules: minus(x, 0') -> x minus(s(x), s(y)) -> minus(x, y) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0', y) -> y plus(s(x), y) -> s(plus(x, y)) plus(minus(x, s(0')), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0'))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s quot :: 0':s -> 0':s -> 0':s plus :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: minus, quot, plus They will be analysed ascendingly in the following order: minus < quot minus < plus ---------------------------------------- (24) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (25) BOUNDS(n^1, INF) ---------------------------------------- (26) Obligation: TRS: Rules: minus(x, 0') -> x minus(s(x), s(y)) -> minus(x, y) quot(0', s(y)) -> 0' quot(s(x), s(y)) -> s(quot(minus(x, y), s(y))) plus(0', y) -> y plus(s(x), y) -> s(plus(x, y)) plus(minus(x, s(0')), minus(y, s(s(z)))) -> plus(minus(y, s(s(z))), minus(x, s(0'))) Types: minus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s quot :: 0':s -> 0':s -> 0':s plus :: 0':s -> 0':s -> 0':s hole_0':s1_0 :: 0':s gen_0':s2_0 :: Nat -> 0':s Lemmas: minus(gen_0':s2_0(n4_0), gen_0':s2_0(n4_0)) -> gen_0':s2_0(0), rt in Omega(1 + n4_0) Generator Equations: gen_0':s2_0(0) <=> 0' gen_0':s2_0(+(x, 1)) <=> s(gen_0':s2_0(x)) The following defined symbols remain to be analysed: quot, plus ---------------------------------------- (27) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: plus(gen_0':s2_0(n296_0), gen_0':s2_0(b)) -> gen_0':s2_0(+(n296_0, b)), rt in Omega(1 + n296_0) Induction Base: plus(gen_0':s2_0(0), gen_0':s2_0(b)) ->_R^Omega(1) gen_0':s2_0(b) Induction Step: plus(gen_0':s2_0(+(n296_0, 1)), gen_0':s2_0(b)) ->_R^Omega(1) s(plus(gen_0':s2_0(n296_0), gen_0':s2_0(b))) ->_IH s(gen_0':s2_0(+(b, c297_0))) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (28) BOUNDS(1, INF)