/export/starexec/sandbox2/solver/bin/starexec_run_complexity /export/starexec/sandbox2/benchmark/theBenchmark.xml /export/starexec/sandbox2/output/output_files -------------------------------------------------------------------------------- WORST_CASE(Omega(n^2), O(n^2)) 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^2, n^2). (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, 175 ms] (10) BOUNDS(1, n^2) (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), 292 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), 84 ms] (24) proven lower bound (25) LowerBoundPropagationProof [FINISHED, 0 ms] (26) BOUNDS(n^2, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(n^2, n^2). The TRS R consists of the following rules: and(tt, X) -> activate(X) plus(N, 0) -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0) -> 0 x(N, s(M)) -> plus(x(N, M), N) activate(X) -> 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^2). The TRS R consists of the following rules: and(tt, X) -> activate(X) [1] plus(N, 0) -> N [1] plus(N, s(M)) -> s(plus(N, M)) [1] x(N, 0) -> 0 [1] x(N, s(M)) -> plus(x(N, M), N) [1] activate(X) -> 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: and(tt, X) -> activate(X) [1] plus(N, 0) -> N [1] plus(N, s(M)) -> s(plus(N, M)) [1] x(N, 0) -> 0 [1] x(N, s(M)) -> plus(x(N, M), N) [1] activate(X) -> X [1] The TRS has the following type information: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s x :: 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: none And the following fresh constants: const ---------------------------------------- (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: and(tt, X) -> activate(X) [1] plus(N, 0) -> N [1] plus(N, s(M)) -> s(plus(N, M)) [1] x(N, 0) -> 0 [1] x(N, s(M)) -> plus(x(N, M), N) [1] activate(X) -> X [1] The TRS has the following type information: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0:s -> 0:s -> 0:s 0 :: 0:s s :: 0:s -> 0:s x :: 0:s -> 0:s -> 0:s const :: and:activate 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: tt => 0 0 => 0 const => 0 ---------------------------------------- (8) Obligation: Complexity RNTS consisting of the following rules: activate(z) -{ 1 }-> X :|: X >= 0, z = X and(z, z') -{ 1 }-> activate(X) :|: z' = X, X >= 0, z = 0 plus(z, z') -{ 1 }-> N :|: z = N, z' = 0, N >= 0 plus(z, z') -{ 1 }-> 1 + plus(N, M) :|: z' = 1 + M, z = N, M >= 0, N >= 0 x(z, z') -{ 1 }-> plus(x(N, M), N) :|: z' = 1 + M, z = N, M >= 0, N >= 0 x(z, z') -{ 1 }-> 0 :|: z = N, z' = 0, N >= 0 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),0,[and(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[plus(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[x(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V),0,[activate(V1, Out)],[V1 >= 0]). eq(and(V1, V, Out),1,[activate(X1, Ret)],[Out = Ret,V = X1,X1 >= 0,V1 = 0]). eq(plus(V1, V, Out),1,[],[Out = N1,V1 = N1,V = 0,N1 >= 0]). eq(plus(V1, V, Out),1,[plus(N2, M1, Ret1)],[Out = 1 + Ret1,V = 1 + M1,V1 = N2,M1 >= 0,N2 >= 0]). eq(x(V1, V, Out),1,[],[Out = 0,V1 = N3,V = 0,N3 >= 0]). eq(x(V1, V, Out),1,[x(N4, M2, Ret0),plus(Ret0, N4, Ret2)],[Out = Ret2,V = 1 + M2,V1 = N4,M2 >= 0,N4 >= 0]). eq(activate(V1, Out),1,[],[Out = X2,X2 >= 0,V1 = X2]). input_output_vars(and(V1,V,Out),[V1,V],[Out]). input_output_vars(plus(V1,V,Out),[V1,V],[Out]). input_output_vars(x(V1,V,Out),[V1,V],[Out]). input_output_vars(activate(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [activate/2] 1. non_recursive : [and/3] 2. recursive : [plus/3] 3. recursive [non_tail] : [x/3] 4. non_recursive : [start/2] #### Obtained direct recursion through partial evaluation 0. SCC is completely evaluated into other SCCs 1. SCC is completely evaluated into other SCCs 2. SCC is partially evaluated into plus/3 3. SCC is partially evaluated into x/3 4. SCC is partially evaluated into start/2 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations plus/3 * CE 6 is refined into CE [9] * CE 5 is refined into CE [10] ### Cost equations --> "Loop" of plus/3 * CEs [10] --> Loop 6 * CEs [9] --> Loop 7 ### Ranking functions of CR plus(V1,V,Out) * RF of phase [7]: [V] #### Partial ranking functions of CR plus(V1,V,Out) * Partial RF of phase [7]: - RF of loop [7:1]: V ### Specialization of cost equations x/3 * CE 8 is refined into CE [11,12] * CE 7 is refined into CE [13] ### Cost equations --> "Loop" of x/3 * CEs [13] --> Loop 8 * CEs [12] --> Loop 9 * CEs [11] --> Loop 10 ### Ranking functions of CR x(V1,V,Out) * RF of phase [9]: [V] * RF of phase [10]: [V] #### Partial ranking functions of CR x(V1,V,Out) * Partial RF of phase [9]: - RF of loop [9:1]: V * Partial RF of phase [10]: - RF of loop [10:1]: V ### Specialization of cost equations start/2 * CE 1 is refined into CE [14] * CE 2 is refined into CE [15,16] * CE 3 is refined into CE [17,18,19] * CE 4 is refined into CE [20] ### Cost equations --> "Loop" of start/2 * CEs [15,18] --> Loop 11 * CEs [14,16,17,19,20] --> Loop 12 ### Ranking functions of CR start(V1,V) #### Partial ranking functions of CR start(V1,V) Computing Bounds ===================================== #### Cost of chains of plus(V1,V,Out): * Chain [[7],6]: 1*it(7)+1 Such that:it(7) =< V with precondition: [V+V1=Out,V1>=0,V>=1] * Chain [6]: 1 with precondition: [V=0,V1=Out,V1>=0] #### Cost of chains of x(V1,V,Out): * Chain [[10],8]: 2*it(10)+1 Such that:it(10) =< V with precondition: [V1=0,Out=0,V>=1] * Chain [[9],8]: 2*it(9)+1*s(3)+1 Such that:aux(1) =< V1 it(9) =< V s(3) =< it(9)*aux(1) with precondition: [V1>=1,V>=1,Out+1>=V+V1] * Chain [8]: 1 with precondition: [V=0,Out=0,V1>=0] #### Cost of chains of start(V1,V): * Chain [12]: 5*s(4)+1*s(8)+2 Such that:s(6) =< V1 aux(2) =< V s(4) =< aux(2) s(8) =< s(4)*s(6) with precondition: [V1>=0] * Chain [11]: 1 with precondition: [V=0,V1>=0] Closed-form bounds of start(V1,V): ------------------------------------- * Chain [12] with precondition: [V1>=0] - Upper bound: nat(V)*V1+2+nat(V)*5 - Complexity: n^2 * Chain [11] with precondition: [V=0,V1>=0] - Upper bound: 1 - Complexity: constant ### Maximum cost of start(V1,V): nat(V)*V1+1+nat(V)*5+1 Asymptotic class: n^2 * Total analysis performed in 111 ms. ---------------------------------------- (10) BOUNDS(1, n^2) ---------------------------------------- (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^2, INF). The TRS R consists of the following rules: and(tt, X) -> activate(X) plus(N, 0') -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0') -> 0' x(N, s(M)) -> plus(x(N, M), N) activate(X) -> X S is empty. Rewrite Strategy: INNERMOST ---------------------------------------- (13) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (14) Obligation: Innermost TRS: Rules: and(tt, X) -> activate(X) plus(N, 0') -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0') -> 0' x(N, s(M)) -> plus(x(N, M), N) activate(X) -> X Types: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s x :: 0':s -> 0':s -> 0':s hole_and:activate1_0 :: and:activate hole_tt2_0 :: tt hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s ---------------------------------------- (15) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: plus, x They will be analysed ascendingly in the following order: plus < x ---------------------------------------- (16) Obligation: Innermost TRS: Rules: and(tt, X) -> activate(X) plus(N, 0') -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0') -> 0' x(N, s(M)) -> plus(x(N, M), N) activate(X) -> X Types: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s x :: 0':s -> 0':s -> 0':s hole_and:activate1_0 :: and:activate hole_tt2_0 :: tt hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: plus, x They will be analysed ascendingly in the following order: plus < x ---------------------------------------- (17) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: plus(gen_0':s4_0(a), gen_0':s4_0(n6_0)) -> gen_0':s4_0(+(n6_0, a)), rt in Omega(1 + n6_0) Induction Base: plus(gen_0':s4_0(a), gen_0':s4_0(0)) ->_R^Omega(1) gen_0':s4_0(a) Induction Step: plus(gen_0':s4_0(a), gen_0':s4_0(+(n6_0, 1))) ->_R^Omega(1) s(plus(gen_0':s4_0(a), gen_0':s4_0(n6_0))) ->_IH s(gen_0':s4_0(+(a, c7_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: and(tt, X) -> activate(X) plus(N, 0') -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0') -> 0' x(N, s(M)) -> plus(x(N, M), N) activate(X) -> X Types: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s x :: 0':s -> 0':s -> 0':s hole_and:activate1_0 :: and:activate hole_tt2_0 :: tt hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: plus, x They will be analysed ascendingly in the following order: plus < x ---------------------------------------- (20) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (21) BOUNDS(n^1, INF) ---------------------------------------- (22) Obligation: Innermost TRS: Rules: and(tt, X) -> activate(X) plus(N, 0') -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0') -> 0' x(N, s(M)) -> plus(x(N, M), N) activate(X) -> X Types: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s x :: 0':s -> 0':s -> 0':s hole_and:activate1_0 :: and:activate hole_tt2_0 :: tt hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Lemmas: plus(gen_0':s4_0(a), gen_0':s4_0(n6_0)) -> gen_0':s4_0(+(n6_0, a)), rt in Omega(1 + n6_0) Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: x ---------------------------------------- (23) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: x(gen_0':s4_0(a), gen_0':s4_0(n473_0)) -> gen_0':s4_0(*(n473_0, a)), rt in Omega(1 + a*n473_0 + n473_0) Induction Base: x(gen_0':s4_0(a), gen_0':s4_0(0)) ->_R^Omega(1) 0' Induction Step: x(gen_0':s4_0(a), gen_0':s4_0(+(n473_0, 1))) ->_R^Omega(1) plus(x(gen_0':s4_0(a), gen_0':s4_0(n473_0)), gen_0':s4_0(a)) ->_IH plus(gen_0':s4_0(*(c474_0, a)), gen_0':s4_0(a)) ->_L^Omega(1 + a) gen_0':s4_0(+(a, *(n473_0, a))) We have rt in Omega(n^2) and sz in O(n). Thus, we have irc_R in Omega(n^2). ---------------------------------------- (24) Obligation: Proved the lower bound n^2 for the following obligation: Innermost TRS: Rules: and(tt, X) -> activate(X) plus(N, 0') -> N plus(N, s(M)) -> s(plus(N, M)) x(N, 0') -> 0' x(N, s(M)) -> plus(x(N, M), N) activate(X) -> X Types: and :: tt -> and:activate -> and:activate tt :: tt activate :: and:activate -> and:activate plus :: 0':s -> 0':s -> 0':s 0' :: 0':s s :: 0':s -> 0':s x :: 0':s -> 0':s -> 0':s hole_and:activate1_0 :: and:activate hole_tt2_0 :: tt hole_0':s3_0 :: 0':s gen_0':s4_0 :: Nat -> 0':s Lemmas: plus(gen_0':s4_0(a), gen_0':s4_0(n6_0)) -> gen_0':s4_0(+(n6_0, a)), rt in Omega(1 + n6_0) Generator Equations: gen_0':s4_0(0) <=> 0' gen_0':s4_0(+(x, 1)) <=> s(gen_0':s4_0(x)) The following defined symbols remain to be analysed: x ---------------------------------------- (25) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (26) BOUNDS(n^2, INF)