/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^2)) 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^2). (0) CpxTRS (1) RcToIrcProof [BOTH BOUNDS(ID, ID), 0 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), 1 ms] (8) CpxTypedWeightedCompleteTrs (9) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (10) CpxRNTS (11) CompleteCoflocoProof [FINISHED, 247 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), 249 ms] (20) BEST (21) proven lower bound (22) LowerBoundPropagationProof [FINISHED, 0 ms] (23) BOUNDS(n^1, INF) (24) 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: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0) -> t g(s(x), s(y)) -> g(x, y) S is empty. Rewrite Strategy: FULL ---------------------------------------- (1) RcToIrcProof (BOTH BOUNDS(ID, ID)) Converted rc-obligation to irc-obligation. The duplicating contexts are: f(t, [], y) f(t, x, []) The defined contexts are: f([], x1, s(x2)) [] just represents basic- or constructor-terms in the following defined contexts: f([], x1, s(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: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0) -> t g(s(x), s(y)) -> g(x, 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: f(t, x, y) -> f(g(x, y), x, s(y)) [1] g(s(x), 0) -> t [1] g(s(x), s(y)) -> g(x, 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: f(t, x, y) -> f(g(x, y), x, s(y)) [1] g(s(x), 0) -> t [1] g(s(x), s(y)) -> g(x, y) [1] The TRS has the following type information: f :: t -> s:0 -> s:0 -> f t :: t g :: s:0 -> s:0 -> t s :: s:0 -> s:0 0 :: s:0 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: g(v0, v1) -> null_g [0] f(v0, v1, v2) -> null_f [0] And the following fresh constants: null_g, null_f ---------------------------------------- (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: f(t, x, y) -> f(g(x, y), x, s(y)) [1] g(s(x), 0) -> t [1] g(s(x), s(y)) -> g(x, y) [1] g(v0, v1) -> null_g [0] f(v0, v1, v2) -> null_f [0] The TRS has the following type information: f :: t:null_g -> s:0 -> s:0 -> null_f t :: t:null_g g :: s:0 -> s:0 -> t:null_g s :: s:0 -> s:0 0 :: s:0 null_g :: t:null_g null_f :: null_f 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: t => 1 0 => 0 null_g => 0 null_f => 0 ---------------------------------------- (10) Obligation: Complexity RNTS consisting of the following rules: f(z, z', z'') -{ 1 }-> f(g(x, y), x, 1 + y) :|: z' = x, z'' = y, z = 1, x >= 0, y >= 0 f(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 g(z, z') -{ 1 }-> g(x, y) :|: z' = 1 + y, x >= 0, y >= 0, z = 1 + x g(z, z') -{ 1 }-> 1 :|: x >= 0, z = 1 + x, z' = 0 g(z, z') -{ 0 }-> 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1 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(V1, V, V2),0,[f(V1, V, V2, Out)],[V1 >= 0,V >= 0,V2 >= 0]). eq(start(V1, V, V2),0,[g(V1, V, Out)],[V1 >= 0,V >= 0]). eq(f(V1, V, V2, Out),1,[g(V4, V3, Ret0),f(Ret0, V4, 1 + V3, Ret)],[Out = Ret,V = V4,V2 = V3,V1 = 1,V4 >= 0,V3 >= 0]). eq(g(V1, V, Out),1,[],[Out = 1,V5 >= 0,V1 = 1 + V5,V = 0]). eq(g(V1, V, Out),1,[g(V6, V7, Ret1)],[Out = Ret1,V = 1 + V7,V6 >= 0,V7 >= 0,V1 = 1 + V6]). eq(g(V1, V, Out),0,[],[Out = 0,V9 >= 0,V8 >= 0,V1 = V9,V = V8]). eq(f(V1, V, V2, Out),0,[],[Out = 0,V11 >= 0,V2 = V12,V10 >= 0,V1 = V11,V = V10,V12 >= 0]). input_output_vars(f(V1,V,V2,Out),[V1,V,V2],[Out]). input_output_vars(g(V1,V,Out),[V1,V],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. recursive : [g/3] 1. recursive : [f/4] 2. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into g/3 1. SCC is partially evaluated into f/4 2. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations g/3 * CE 7 is refined into CE [8] * CE 5 is refined into CE [9] * CE 6 is refined into CE [10] ### Cost equations --> "Loop" of g/3 * CEs [10] --> Loop 7 * CEs [8] --> Loop 8 * CEs [9] --> Loop 9 ### Ranking functions of CR g(V1,V,Out) * RF of phase [7]: [V,V1] #### Partial ranking functions of CR g(V1,V,Out) * Partial RF of phase [7]: - RF of loop [7:1]: V V1 ### Specialization of cost equations f/4 * CE 4 is refined into CE [11] * CE 3 is refined into CE [12,13,14] ### Cost equations --> "Loop" of f/4 * CEs [14] --> Loop 10 * CEs [13] --> Loop 11 * CEs [12] --> Loop 12 * CEs [11] --> Loop 13 ### Ranking functions of CR f(V1,V,V2,Out) * RF of phase [10]: [V-V2] #### Partial ranking functions of CR f(V1,V,V2,Out) * Partial RF of phase [10]: - RF of loop [10:1]: V-V2 ### Specialization of cost equations start/3 * CE 1 is refined into CE [15] * CE 2 is refined into CE [16,17,18] ### Cost equations --> "Loop" of start/3 * CEs [15,16,17,18] --> Loop 14 ### Ranking functions of CR start(V1,V,V2) #### Partial ranking functions of CR start(V1,V,V2) Computing Bounds ===================================== #### Cost of chains of g(V1,V,Out): * Chain [[7],9]: 1*it(7)+1 Such that:it(7) =< V with precondition: [Out=1,V>=1,V1>=V+1] * Chain [[7],8]: 1*it(7)+0 Such that:it(7) =< V with precondition: [Out=0,V1>=1,V>=1] * Chain [9]: 1 with precondition: [V=0,Out=1,V1>=1] * Chain [8]: 0 with precondition: [Out=0,V1>=0,V>=0] #### Cost of chains of f(V1,V,V2,Out): * Chain [[10],13]: 2*it(10)+1*s(4)+0 Such that:aux(1) =< V it(10) =< V-V2 s(4) =< it(10)*aux(1) with precondition: [V1=1,Out=0,V2>=1,V>=V2+1] * Chain [[10],11,13]: 2*it(10)+1*s(4)+1*s(5)+1 Such that:aux(1) =< V s(5) =< V+1 it(10) =< V-V2 s(4) =< it(10)*aux(1) with precondition: [V1=1,Out=0,V2>=1,V>=V2+1] * Chain [13]: 0 with precondition: [Out=0,V1>=0,V>=0,V2>=0] * Chain [12,[10],13]: 2*it(10)+1*s(4)+2 Such that:aux(2) =< V it(10) =< aux(2) s(4) =< it(10)*aux(2) with precondition: [V1=1,V2=0,Out=0,V>=2] * Chain [12,[10],11,13]: 2*it(10)+1*s(4)+1*s(5)+3 Such that:s(5) =< V+1 aux(3) =< V it(10) =< aux(3) s(4) =< it(10)*aux(3) with precondition: [V1=1,V2=0,Out=0,V>=2] * Chain [12,13]: 2 with precondition: [V1=1,V2=0,Out=0,V>=1] * Chain [12,11,13]: 1*s(5)+3 Such that:s(5) =< 2 with precondition: [V1=1,V2=0,Out=0,V>=1] * Chain [11,13]: 1*s(5)+1 Such that:s(5) =< V2+1 with precondition: [V1=1,Out=0,V>=0,V2>=0] #### Cost of chains of start(V1,V,V2): * Chain [14]: 1*s(22)+1*s(23)+2*s(27)+4*s(28)+6*s(29)+2*s(30)+2*s(31)+3 Such that:s(22) =< 2 s(25) =< V+1 s(26) =< V-V2 s(23) =< V2+1 aux(7) =< V s(29) =< aux(7) s(27) =< s(25) s(28) =< s(26) s(30) =< s(29)*aux(7) s(31) =< s(28)*aux(7) with precondition: [V1>=0,V>=0] Closed-form bounds of start(V1,V,V2): ------------------------------------- * Chain [14] with precondition: [V1>=0,V>=0] - Upper bound: 6*V+5+2*V*V+2*V*nat(V-V2)+(2*V+2)+nat(V2+1)+nat(V-V2)*4 - Complexity: n^2 ### Maximum cost of start(V1,V,V2): 6*V+5+2*V*V+2*V*nat(V-V2)+(2*V+2)+nat(V2+1)+nat(V-V2)*4 Asymptotic class: n^2 * Total analysis performed in 171 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: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0') -> t g(s(x), s(y)) -> g(x, y) S is empty. Rewrite Strategy: FULL ---------------------------------------- (15) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (16) Obligation: TRS: Rules: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0') -> t g(s(x), s(y)) -> g(x, y) Types: f :: t -> s:0' -> s:0' -> f t :: t g :: s:0' -> s:0' -> t s :: s:0' -> s:0' 0' :: s:0' hole_f1_0 :: f hole_t2_0 :: t hole_s:0'3_0 :: s:0' gen_s:0'4_0 :: Nat -> s:0' ---------------------------------------- (17) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: f, g They will be analysed ascendingly in the following order: g < f ---------------------------------------- (18) Obligation: TRS: Rules: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0') -> t g(s(x), s(y)) -> g(x, y) Types: f :: t -> s:0' -> s:0' -> f t :: t g :: s:0' -> s:0' -> t s :: s:0' -> s:0' 0' :: s:0' hole_f1_0 :: f hole_t2_0 :: t hole_s:0'3_0 :: s:0' gen_s:0'4_0 :: Nat -> s:0' Generator Equations: gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: g, f They will be analysed ascendingly in the following order: g < f ---------------------------------------- (19) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: g(gen_s:0'4_0(+(1, n6_0)), gen_s:0'4_0(n6_0)) -> t, rt in Omega(1 + n6_0) Induction Base: g(gen_s:0'4_0(+(1, 0)), gen_s:0'4_0(0)) ->_R^Omega(1) t Induction Step: g(gen_s:0'4_0(+(1, +(n6_0, 1))), gen_s:0'4_0(+(n6_0, 1))) ->_R^Omega(1) g(gen_s:0'4_0(+(1, n6_0)), gen_s:0'4_0(n6_0)) ->_IH t 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: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0') -> t g(s(x), s(y)) -> g(x, y) Types: f :: t -> s:0' -> s:0' -> f t :: t g :: s:0' -> s:0' -> t s :: s:0' -> s:0' 0' :: s:0' hole_f1_0 :: f hole_t2_0 :: t hole_s:0'3_0 :: s:0' gen_s:0'4_0 :: Nat -> s:0' Generator Equations: gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: g, f They will be analysed ascendingly in the following order: g < f ---------------------------------------- (22) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (23) BOUNDS(n^1, INF) ---------------------------------------- (24) Obligation: TRS: Rules: f(t, x, y) -> f(g(x, y), x, s(y)) g(s(x), 0') -> t g(s(x), s(y)) -> g(x, y) Types: f :: t -> s:0' -> s:0' -> f t :: t g :: s:0' -> s:0' -> t s :: s:0' -> s:0' 0' :: s:0' hole_f1_0 :: f hole_t2_0 :: t hole_s:0'3_0 :: s:0' gen_s:0'4_0 :: Nat -> s:0' Lemmas: g(gen_s:0'4_0(+(1, n6_0)), gen_s:0'4_0(n6_0)) -> t, rt in Omega(1 + n6_0) Generator Equations: gen_s:0'4_0(0) <=> 0' gen_s:0'4_0(+(x, 1)) <=> s(gen_s:0'4_0(x)) The following defined symbols remain to be analysed: f