WORST_CASE(Omega(n^1),O(n^1)) proof of input_qMy1r9MVhF.trs # AProVE Commit ID: 5b976082cb74a395683ed8cc7acf94bd611ab29f fuhs 20230524 unpublished The Runtime Complexity (parallel-innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). (0) CpxTRS (1) CpxTrsToCdtProof [UPPER BOUND(ID), 0 ms] (2) CdtProblem (3) CdtLeafRemovalProof [BOTH BOUNDS(ID, ID), 0 ms] (4) CdtProblem (5) CdtRhsSimplificationProcessorProof [BOTH BOUNDS(ID, ID), 0 ms] (6) CdtProblem (7) CdtUsableRulesProof [BOTH BOUNDS(ID, ID), 0 ms] (8) CdtProblem (9) CdtToCpxRelTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (10) CpxRelTRS (11) RelTrsToWeightedTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (12) CpxWeightedTrs (13) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (14) CpxTypedWeightedTrs (15) CompletionProof [UPPER BOUND(ID), 0 ms] (16) CpxTypedWeightedCompleteTrs (17) CpxTypedWeightedTrsToRntsProof [UPPER BOUND(ID), 0 ms] (18) CpxRNTS (19) CompleteCoflocoProof [FINISHED, 135 ms] (20) BOUNDS(1, n^1) (21) CpxTrsToCdtProof [BOTH BOUNDS(ID, ID), 0 ms] (22) CdtProblem (23) CdtToCpxRelTrsProof [BOTH BOUNDS(ID, ID), 0 ms] (24) CpxRelTRS (25) RenamingProof [BOTH BOUNDS(ID, ID), 0 ms] (26) CpxRelTRS (27) TypeInferenceProof [BOTH BOUNDS(ID, ID), 0 ms] (28) typed CpxTrs (29) OrderProof [LOWER BOUND(ID), 21 ms] (30) typed CpxTrs (31) RewriteLemmaProof [LOWER BOUND(ID), 773 ms] (32) BEST (33) proven lower bound (34) LowerBoundPropagationProof [FINISHED, 0 ms] (35) BOUNDS(n^1, INF) (36) typed CpxTrs (37) RewriteLemmaProof [LOWER BOUND(ID), 20 ms] (38) BOUNDS(1, INF) ---------------------------------------- (0) Obligation: The Runtime Complexity (parallel-innermost) of the given CpxTRS could be proven to be BOUNDS(n^1, n^1). The TRS R consists of the following rules: is_empty(nil) -> true is_empty(cons(x, l)) -> false hd(cons(x, l)) -> x tl(cons(x, l)) -> l append(l1, l2) -> ifappend(l1, l2, is_empty(l1)) ifappend(l1, l2, true) -> l2 ifappend(l1, l2, false) -> cons(hd(l1), append(tl(l1), l2)) S is empty. Rewrite Strategy: PARALLEL_INNERMOST ---------------------------------------- (1) CpxTrsToCdtProof (UPPER BOUND(ID)) Converted Cpx (relative) TRS with rewrite strategy PARALLEL_INNERMOST to CDT ---------------------------------------- (2) Obligation: Complexity Dependency Tuples Problem Rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Tuples: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) S tuples: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) K tuples:none Defined Rule Symbols: is_empty_1, hd_1, tl_1, append_2, ifappend_3 Defined Pair Symbols: IS_EMPTY_1, HD_1, TL_1, APPEND_2, IFAPPEND_3 Compound Symbols: c, c1, c2, c3, c4_2, c5, c6_1, c7_2 ---------------------------------------- (3) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID)) Removed 6 trailing nodes: IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) TL(cons(z0, z1)) -> c3 IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 ---------------------------------------- (4) Obligation: Complexity Dependency Tuples Problem Rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Tuples: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) S tuples: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) K tuples:none Defined Rule Symbols: is_empty_1, hd_1, tl_1, append_2, ifappend_3 Defined Pair Symbols: APPEND_2, IFAPPEND_3 Compound Symbols: c4_2, c7_2 ---------------------------------------- (5) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID)) Removed 2 trailing tuple parts ---------------------------------------- (6) Obligation: Complexity Dependency Tuples Problem Rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Tuples: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) S tuples: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) K tuples:none Defined Rule Symbols: is_empty_1, hd_1, tl_1, append_2, ifappend_3 Defined Pair Symbols: APPEND_2, IFAPPEND_3 Compound Symbols: c4_1, c7_1 ---------------------------------------- (7) CdtUsableRulesProof (BOTH BOUNDS(ID, ID)) The following rules are not usable and were removed: hd(cons(z0, z1)) -> z0 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) ---------------------------------------- (8) Obligation: Complexity Dependency Tuples Problem Rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false tl(cons(z0, z1)) -> z1 Tuples: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) S tuples: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) K tuples:none Defined Rule Symbols: is_empty_1, tl_1 Defined Pair Symbols: APPEND_2, IFAPPEND_3 Compound Symbols: c4_1, c7_1 ---------------------------------------- (9) CdtToCpxRelTrsProof (BOTH BOUNDS(ID, ID)) Converted S to standard rules, and D \ S as well as R to relative rules. ---------------------------------------- (10) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(1, n^1). The TRS R consists of the following rules: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) The (relative) TRS S consists of the following rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false tl(cons(z0, z1)) -> z1 Rewrite Strategy: INNERMOST ---------------------------------------- (11) RelTrsToWeightedTrsProof (BOTH BOUNDS(ID, ID)) Transformed relative TRS to weighted TRS ---------------------------------------- (12) 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: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) [1] IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) [1] is_empty(nil) -> true [0] is_empty(cons(z0, z1)) -> false [0] tl(cons(z0, z1)) -> z1 [0] Rewrite Strategy: INNERMOST ---------------------------------------- (13) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Infered types. ---------------------------------------- (14) Obligation: Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) [1] IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) [1] is_empty(nil) -> true [0] is_empty(cons(z0, z1)) -> false [0] tl(cons(z0, z1)) -> z1 [0] The TRS has the following type information: APPEND :: nil:cons -> a -> c4 c4 :: c7 -> c4 IFAPPEND :: nil:cons -> a -> false:true -> c7 is_empty :: nil:cons -> false:true false :: false:true c7 :: c4 -> c7 tl :: nil:cons -> nil:cons nil :: nil:cons true :: false:true cons :: b -> nil:cons -> nil:cons Rewrite Strategy: INNERMOST ---------------------------------------- (15) 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: is_empty(v0) -> null_is_empty [0] tl(v0) -> null_tl [0] IFAPPEND(v0, v1, v2) -> null_IFAPPEND [0] And the following fresh constants: null_is_empty, null_tl, null_IFAPPEND, const, const1, const2 ---------------------------------------- (16) 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: APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0))) [1] IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1)) [1] is_empty(nil) -> true [0] is_empty(cons(z0, z1)) -> false [0] tl(cons(z0, z1)) -> z1 [0] is_empty(v0) -> null_is_empty [0] tl(v0) -> null_tl [0] IFAPPEND(v0, v1, v2) -> null_IFAPPEND [0] The TRS has the following type information: APPEND :: nil:cons:null_tl -> a -> c4 c4 :: c7:null_IFAPPEND -> c4 IFAPPEND :: nil:cons:null_tl -> a -> false:true:null_is_empty -> c7:null_IFAPPEND is_empty :: nil:cons:null_tl -> false:true:null_is_empty false :: false:true:null_is_empty c7 :: c4 -> c7:null_IFAPPEND tl :: nil:cons:null_tl -> nil:cons:null_tl nil :: nil:cons:null_tl true :: false:true:null_is_empty cons :: b -> nil:cons:null_tl -> nil:cons:null_tl null_is_empty :: false:true:null_is_empty null_tl :: nil:cons:null_tl null_IFAPPEND :: c7:null_IFAPPEND const :: c4 const1 :: a const2 :: b Rewrite Strategy: INNERMOST ---------------------------------------- (17) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID)) Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction. The constant constructors are abstracted as follows: false => 1 nil => 0 true => 2 null_is_empty => 0 null_tl => 0 null_IFAPPEND => 0 const => 0 const1 => 0 const2 => 0 ---------------------------------------- (18) Obligation: Complexity RNTS consisting of the following rules: APPEND(z, z') -{ 1 }-> 1 + IFAPPEND(z0, z1, is_empty(z0)) :|: z = z0, z1 >= 0, z' = z1, z0 >= 0 IFAPPEND(z, z', z'') -{ 0 }-> 0 :|: v0 >= 0, z'' = v2, v1 >= 0, z = v0, z' = v1, v2 >= 0 IFAPPEND(z, z', z'') -{ 1 }-> 1 + APPEND(tl(z0), z1) :|: z = z0, z1 >= 0, z' = z1, z0 >= 0, z'' = 1 is_empty(z) -{ 0 }-> 2 :|: z = 0 is_empty(z) -{ 0 }-> 1 :|: z1 >= 0, z0 >= 0, z = 1 + z0 + z1 is_empty(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 tl(z) -{ 0 }-> z1 :|: z1 >= 0, z0 >= 0, z = 1 + z0 + z1 tl(z) -{ 0 }-> 0 :|: v0 >= 0, z = v0 Only complete derivations are relevant for the runtime complexity. ---------------------------------------- (19) CompleteCoflocoProof (FINISHED) Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo: eq(start(V1, V, V4),0,[fun(V1, V, Out)],[V1 >= 0,V >= 0]). eq(start(V1, V, V4),0,[fun1(V1, V, V4, Out)],[V1 >= 0,V >= 0,V4 >= 0]). eq(start(V1, V, V4),0,[fun2(V1, Out)],[V1 >= 0]). eq(start(V1, V, V4),0,[tl(V1, Out)],[V1 >= 0]). eq(fun(V1, V, Out),1,[fun2(V3, Ret12),fun1(V3, V2, Ret12, Ret1)],[Out = 1 + Ret1,V1 = V3,V2 >= 0,V = V2,V3 >= 0]). eq(fun1(V1, V, V4, Out),1,[tl(V6, Ret10),fun(Ret10, V5, Ret11)],[Out = 1 + Ret11,V1 = V6,V5 >= 0,V = V5,V6 >= 0,V4 = 1]). eq(fun2(V1, Out),0,[],[Out = 2,V1 = 0]). eq(fun2(V1, Out),0,[],[Out = 1,V7 >= 0,V8 >= 0,V1 = 1 + V7 + V8]). eq(tl(V1, Out),0,[],[Out = V10,V10 >= 0,V9 >= 0,V1 = 1 + V10 + V9]). eq(fun2(V1, Out),0,[],[Out = 0,V11 >= 0,V1 = V11]). eq(tl(V1, Out),0,[],[Out = 0,V12 >= 0,V1 = V12]). eq(fun1(V1, V, V4, Out),0,[],[Out = 0,V14 >= 0,V4 = V15,V13 >= 0,V1 = V14,V = V13,V15 >= 0]). input_output_vars(fun(V1,V,Out),[V1,V],[Out]). input_output_vars(fun1(V1,V,V4,Out),[V1,V,V4],[Out]). input_output_vars(fun2(V1,Out),[V1],[Out]). input_output_vars(tl(V1,Out),[V1],[Out]). CoFloCo proof output: Preprocessing Cost Relations ===================================== #### Computed strongly connected components 0. non_recursive : [tl/2] 1. non_recursive : [fun2/2] 2. recursive : [fun/3,fun1/4] 3. non_recursive : [start/3] #### Obtained direct recursion through partial evaluation 0. SCC is partially evaluated into tl/2 1. SCC is partially evaluated into fun2/2 2. SCC is partially evaluated into fun/3 3. SCC is partially evaluated into start/3 Control-Flow Refinement of Cost Relations ===================================== ### Specialization of cost equations tl/2 * CE 6 is refined into CE [13] * CE 7 is refined into CE [14] ### Cost equations --> "Loop" of tl/2 * CEs [13] --> Loop 9 * CEs [14] --> Loop 10 ### Ranking functions of CR tl(V1,Out) #### Partial ranking functions of CR tl(V1,Out) ### Specialization of cost equations fun2/2 * CE 11 is refined into CE [15] * CE 12 is refined into CE [16] * CE 10 is refined into CE [17] ### Cost equations --> "Loop" of fun2/2 * CEs [15] --> Loop 11 * CEs [16] --> Loop 12 * CEs [17] --> Loop 13 ### Ranking functions of CR fun2(V1,Out) #### Partial ranking functions of CR fun2(V1,Out) ### Specialization of cost equations fun/3 * CE 9 is refined into CE [18,19] * CE 8 is refined into CE [20,21,22] ### Cost equations --> "Loop" of fun/3 * CEs [20,21,22] --> Loop 14 * CEs [18,19] --> Loop 15 ### Ranking functions of CR fun(V1,V,Out) * RF of phase [15]: [V1] #### Partial ranking functions of CR fun(V1,V,Out) * Partial RF of phase [15]: - RF of loop [15:1]: V1 ### Specialization of cost equations start/3 * CE 1 is refined into CE [23] * CE 2 is refined into CE [24,25,26] * CE 3 is refined into CE [27,28] * CE 4 is refined into CE [29,30,31] * CE 5 is refined into CE [32,33] ### Cost equations --> "Loop" of start/3 * CEs [24,25,26] --> Loop 16 * CEs [23,27,28,29,30,31,32,33] --> Loop 17 ### Ranking functions of CR start(V1,V,V4) #### Partial ranking functions of CR start(V1,V,V4) Computing Bounds ===================================== #### Cost of chains of tl(V1,Out): * Chain [10]: 0 with precondition: [Out=0,V1>=0] * Chain [9]: 0 with precondition: [Out>=0,V1>=Out+1] #### Cost of chains of fun2(V1,Out): * Chain [13]: 0 with precondition: [V1=0,Out=2] * Chain [12]: 0 with precondition: [Out=0,V1>=0] * Chain [11]: 0 with precondition: [Out=1,V1>=1] #### Cost of chains of fun(V1,V,Out): * Chain [[15],14]: 2*it(15)+1 Such that:it(15) =< V1 with precondition: [V>=0,Out>=3,2*V1+1>=Out] * Chain [14]: 1 with precondition: [Out=1,V1>=0,V>=0] #### Cost of chains of start(V1,V,V4): * Chain [17]: 2*s(1)+1 Such that:s(1) =< V1 with precondition: [V1>=0] * Chain [16]: 2*s(2)+2 Such that:s(2) =< V1 with precondition: [V4=1,V1>=0,V>=0] Closed-form bounds of start(V1,V,V4): ------------------------------------- * Chain [17] with precondition: [V1>=0] - Upper bound: 2*V1+1 - Complexity: n * Chain [16] with precondition: [V4=1,V1>=0,V>=0] - Upper bound: 2*V1+2 - Complexity: n ### Maximum cost of start(V1,V,V4): 2*V1+2 Asymptotic class: n * Total analysis performed in 94 ms. ---------------------------------------- (20) BOUNDS(1, n^1) ---------------------------------------- (21) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID)) Converted Cpx (relative) TRS with rewrite strategy PARALLEL_INNERMOST to CDT ---------------------------------------- (22) Obligation: Complexity Dependency Tuples Problem Rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Tuples: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) S tuples: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) K tuples:none Defined Rule Symbols: is_empty_1, hd_1, tl_1, append_2, ifappend_3 Defined Pair Symbols: IS_EMPTY_1, HD_1, TL_1, APPEND_2, IFAPPEND_3 Compound Symbols: c, c1, c2, c3, c4_2, c5, c6_1, c7_2 ---------------------------------------- (23) CdtToCpxRelTrsProof (BOTH BOUNDS(ID, ID)) Converted S to standard rules, and D \ S as well as R to relative rules. ---------------------------------------- (24) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) The (relative) TRS S consists of the following rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Rewrite Strategy: INNERMOST ---------------------------------------- (25) RenamingProof (BOTH BOUNDS(ID, ID)) Renamed function symbols to avoid clashes with predefined symbol. ---------------------------------------- (26) Obligation: The Runtime Complexity (innermost) of the given CpxRelTRS could be proven to be BOUNDS(n^1, INF). The TRS R consists of the following rules: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) The (relative) TRS S consists of the following rules: is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Rewrite Strategy: INNERMOST ---------------------------------------- (27) TypeInferenceProof (BOTH BOUNDS(ID, ID)) Inferred types. ---------------------------------------- (28) Obligation: Innermost TRS: Rules: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Types: IS_EMPTY :: nil:cons -> c:c1 nil :: nil:cons c :: c:c1 cons :: hd -> nil:cons -> nil:cons c1 :: c:c1 HD :: nil:cons -> c2 c2 :: c2 TL :: nil:cons -> c3 c3 :: c3 APPEND :: nil:cons -> a -> c4 c4 :: c5:c6:c7 -> c:c1 -> c4 IFAPPEND :: nil:cons -> a -> true:false -> c5:c6:c7 is_empty :: nil:cons -> true:false true :: true:false c5 :: c5:c6:c7 false :: true:false c6 :: c2 -> c5:c6:c7 c7 :: c4 -> c3 -> c5:c6:c7 tl :: nil:cons -> nil:cons hd :: nil:cons -> hd append :: nil:cons -> nil:cons -> nil:cons ifappend :: nil:cons -> nil:cons -> true:false -> nil:cons hole_c:c11_8 :: c:c1 hole_nil:cons2_8 :: nil:cons hole_hd3_8 :: hd hole_c24_8 :: c2 hole_c35_8 :: c3 hole_c46_8 :: c4 hole_a7_8 :: a hole_c5:c6:c78_8 :: c5:c6:c7 hole_true:false9_8 :: true:false gen_nil:cons10_8 :: Nat -> nil:cons ---------------------------------------- (29) OrderProof (LOWER BOUND(ID)) Heuristically decided to analyse the following defined symbols: APPEND, append ---------------------------------------- (30) Obligation: Innermost TRS: Rules: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Types: IS_EMPTY :: nil:cons -> c:c1 nil :: nil:cons c :: c:c1 cons :: hd -> nil:cons -> nil:cons c1 :: c:c1 HD :: nil:cons -> c2 c2 :: c2 TL :: nil:cons -> c3 c3 :: c3 APPEND :: nil:cons -> a -> c4 c4 :: c5:c6:c7 -> c:c1 -> c4 IFAPPEND :: nil:cons -> a -> true:false -> c5:c6:c7 is_empty :: nil:cons -> true:false true :: true:false c5 :: c5:c6:c7 false :: true:false c6 :: c2 -> c5:c6:c7 c7 :: c4 -> c3 -> c5:c6:c7 tl :: nil:cons -> nil:cons hd :: nil:cons -> hd append :: nil:cons -> nil:cons -> nil:cons ifappend :: nil:cons -> nil:cons -> true:false -> nil:cons hole_c:c11_8 :: c:c1 hole_nil:cons2_8 :: nil:cons hole_hd3_8 :: hd hole_c24_8 :: c2 hole_c35_8 :: c3 hole_c46_8 :: c4 hole_a7_8 :: a hole_c5:c6:c78_8 :: c5:c6:c7 hole_true:false9_8 :: true:false gen_nil:cons10_8 :: Nat -> nil:cons Generator Equations: gen_nil:cons10_8(0) <=> nil gen_nil:cons10_8(+(x, 1)) <=> cons(hole_hd3_8, gen_nil:cons10_8(x)) The following defined symbols remain to be analysed: APPEND, append ---------------------------------------- (31) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: APPEND(gen_nil:cons10_8(n12_8), hole_a7_8) -> *11_8, rt in Omega(n12_8) Induction Base: APPEND(gen_nil:cons10_8(0), hole_a7_8) Induction Step: APPEND(gen_nil:cons10_8(+(n12_8, 1)), hole_a7_8) ->_R^Omega(1) c4(IFAPPEND(gen_nil:cons10_8(+(n12_8, 1)), hole_a7_8, is_empty(gen_nil:cons10_8(+(n12_8, 1)))), IS_EMPTY(gen_nil:cons10_8(+(n12_8, 1)))) ->_R^Omega(0) c4(IFAPPEND(gen_nil:cons10_8(+(1, n12_8)), hole_a7_8, false), IS_EMPTY(gen_nil:cons10_8(+(1, n12_8)))) ->_R^Omega(1) c4(c7(APPEND(tl(gen_nil:cons10_8(+(1, n12_8))), hole_a7_8), TL(gen_nil:cons10_8(+(1, n12_8)))), IS_EMPTY(gen_nil:cons10_8(+(1, n12_8)))) ->_R^Omega(0) c4(c7(APPEND(gen_nil:cons10_8(n12_8), hole_a7_8), TL(gen_nil:cons10_8(+(1, n12_8)))), IS_EMPTY(gen_nil:cons10_8(+(1, n12_8)))) ->_IH c4(c7(*11_8, TL(gen_nil:cons10_8(+(1, n12_8)))), IS_EMPTY(gen_nil:cons10_8(+(1, n12_8)))) ->_R^Omega(1) c4(c7(*11_8, c3), IS_EMPTY(gen_nil:cons10_8(+(1, n12_8)))) ->_R^Omega(1) c4(c7(*11_8, c3), c1) We have rt in Omega(n^1) and sz in O(n). Thus, we have irc_R in Omega(n). ---------------------------------------- (32) Complex Obligation (BEST) ---------------------------------------- (33) Obligation: Proved the lower bound n^1 for the following obligation: Innermost TRS: Rules: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Types: IS_EMPTY :: nil:cons -> c:c1 nil :: nil:cons c :: c:c1 cons :: hd -> nil:cons -> nil:cons c1 :: c:c1 HD :: nil:cons -> c2 c2 :: c2 TL :: nil:cons -> c3 c3 :: c3 APPEND :: nil:cons -> a -> c4 c4 :: c5:c6:c7 -> c:c1 -> c4 IFAPPEND :: nil:cons -> a -> true:false -> c5:c6:c7 is_empty :: nil:cons -> true:false true :: true:false c5 :: c5:c6:c7 false :: true:false c6 :: c2 -> c5:c6:c7 c7 :: c4 -> c3 -> c5:c6:c7 tl :: nil:cons -> nil:cons hd :: nil:cons -> hd append :: nil:cons -> nil:cons -> nil:cons ifappend :: nil:cons -> nil:cons -> true:false -> nil:cons hole_c:c11_8 :: c:c1 hole_nil:cons2_8 :: nil:cons hole_hd3_8 :: hd hole_c24_8 :: c2 hole_c35_8 :: c3 hole_c46_8 :: c4 hole_a7_8 :: a hole_c5:c6:c78_8 :: c5:c6:c7 hole_true:false9_8 :: true:false gen_nil:cons10_8 :: Nat -> nil:cons Generator Equations: gen_nil:cons10_8(0) <=> nil gen_nil:cons10_8(+(x, 1)) <=> cons(hole_hd3_8, gen_nil:cons10_8(x)) The following defined symbols remain to be analysed: APPEND, append ---------------------------------------- (34) LowerBoundPropagationProof (FINISHED) Propagated lower bound. ---------------------------------------- (35) BOUNDS(n^1, INF) ---------------------------------------- (36) Obligation: Innermost TRS: Rules: IS_EMPTY(nil) -> c IS_EMPTY(cons(z0, z1)) -> c1 HD(cons(z0, z1)) -> c2 TL(cons(z0, z1)) -> c3 APPEND(z0, z1) -> c4(IFAPPEND(z0, z1, is_empty(z0)), IS_EMPTY(z0)) IFAPPEND(z0, z1, true) -> c5 IFAPPEND(z0, z1, false) -> c6(HD(z0)) IFAPPEND(z0, z1, false) -> c7(APPEND(tl(z0), z1), TL(z0)) is_empty(nil) -> true is_empty(cons(z0, z1)) -> false hd(cons(z0, z1)) -> z0 tl(cons(z0, z1)) -> z1 append(z0, z1) -> ifappend(z0, z1, is_empty(z0)) ifappend(z0, z1, true) -> z1 ifappend(z0, z1, false) -> cons(hd(z0), append(tl(z0), z1)) Types: IS_EMPTY :: nil:cons -> c:c1 nil :: nil:cons c :: c:c1 cons :: hd -> nil:cons -> nil:cons c1 :: c:c1 HD :: nil:cons -> c2 c2 :: c2 TL :: nil:cons -> c3 c3 :: c3 APPEND :: nil:cons -> a -> c4 c4 :: c5:c6:c7 -> c:c1 -> c4 IFAPPEND :: nil:cons -> a -> true:false -> c5:c6:c7 is_empty :: nil:cons -> true:false true :: true:false c5 :: c5:c6:c7 false :: true:false c6 :: c2 -> c5:c6:c7 c7 :: c4 -> c3 -> c5:c6:c7 tl :: nil:cons -> nil:cons hd :: nil:cons -> hd append :: nil:cons -> nil:cons -> nil:cons ifappend :: nil:cons -> nil:cons -> true:false -> nil:cons hole_c:c11_8 :: c:c1 hole_nil:cons2_8 :: nil:cons hole_hd3_8 :: hd hole_c24_8 :: c2 hole_c35_8 :: c3 hole_c46_8 :: c4 hole_a7_8 :: a hole_c5:c6:c78_8 :: c5:c6:c7 hole_true:false9_8 :: true:false gen_nil:cons10_8 :: Nat -> nil:cons Lemmas: APPEND(gen_nil:cons10_8(n12_8), hole_a7_8) -> *11_8, rt in Omega(n12_8) Generator Equations: gen_nil:cons10_8(0) <=> nil gen_nil:cons10_8(+(x, 1)) <=> cons(hole_hd3_8, gen_nil:cons10_8(x)) The following defined symbols remain to be analysed: append ---------------------------------------- (37) RewriteLemmaProof (LOWER BOUND(ID)) Proved the following rewrite lemma: append(gen_nil:cons10_8(n1460_8), gen_nil:cons10_8(b)) -> gen_nil:cons10_8(+(n1460_8, b)), rt in Omega(0) Induction Base: append(gen_nil:cons10_8(0), gen_nil:cons10_8(b)) ->_R^Omega(0) ifappend(gen_nil:cons10_8(0), gen_nil:cons10_8(b), is_empty(gen_nil:cons10_8(0))) ->_R^Omega(0) ifappend(gen_nil:cons10_8(0), gen_nil:cons10_8(b), true) ->_R^Omega(0) gen_nil:cons10_8(b) Induction Step: append(gen_nil:cons10_8(+(n1460_8, 1)), gen_nil:cons10_8(b)) ->_R^Omega(0) ifappend(gen_nil:cons10_8(+(n1460_8, 1)), gen_nil:cons10_8(b), is_empty(gen_nil:cons10_8(+(n1460_8, 1)))) ->_R^Omega(0) ifappend(gen_nil:cons10_8(+(1, n1460_8)), gen_nil:cons10_8(b), false) ->_R^Omega(0) cons(hd(gen_nil:cons10_8(+(1, n1460_8))), append(tl(gen_nil:cons10_8(+(1, n1460_8))), gen_nil:cons10_8(b))) ->_R^Omega(0) cons(hole_hd3_8, append(tl(gen_nil:cons10_8(+(1, n1460_8))), gen_nil:cons10_8(b))) ->_R^Omega(0) cons(hole_hd3_8, append(gen_nil:cons10_8(n1460_8), gen_nil:cons10_8(b))) ->_IH cons(hole_hd3_8, gen_nil:cons10_8(+(b, c1461_8))) We have rt in Omega(1) and sz in O(n). Thus, we have irc_R in Omega(n^0). ---------------------------------------- (38) BOUNDS(1, INF)