We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Weak Trs:
{ #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x))) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We add the following dependency tuples:
Strict DPs:
{ firstline#1^#(nil()) -> c_1()
, firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29() }
Weak DPs:
{ #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
and mark the set of starting terms.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(nil()) -> c_1()
, firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29() }
Weak DPs:
{ #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We estimate the number of application of
{1,3,4,5,6,8,10,17,22,26,28,29,33,34,38,39} by applications of
Pre({1,3,4,5,6,8,10,17,22,26,28,29,33,34,38,39}) =
{2,7,9,12,13,19,20,23,25,27,32,35,37}. Here rules are labeled as
follows:
DPs:
{ 1: firstline#1^#(nil()) -> c_1()
, 2: firstline#1^#(::(@x, @xs)) ->
c_2(#abs^#(#0()), firstline^#(@xs))
, 3: #abs^#(#pos(@x)) -> c_32()
, 4: #abs^#(#0()) -> c_33()
, 5: #abs^#(#neg(@x)) -> c_34()
, 6: #abs^#(#s(@x)) -> c_35()
, 7: firstline^#(@l) -> c_20(firstline#1^#(@l))
, 8: #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, 9: lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, 10: lcs#3^#(::(@len, @_@1)) -> c_5()
, 11: lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, 12: lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, 13: lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, 14: lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, 15: lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, 16: lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 17: lcstable#3^#(nil(), @l2, @x) -> c_8()
, 18: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_9(newline^#(@x, @l, @l2))
, 19: newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, 20: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, 21: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, 22: +^#(@x, @y) -> c_30(#add^#(@x, @y))
, 23: max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, 24: lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, 25: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, 26: newline#6^#(@elem, @nl) -> c_37()
, 27: right#1^#(nil()) -> c_16(#abs^#(#0()))
, 28: right#1^#(::(@x, @xs)) -> c_17()
, 29: newline#2^#(nil(), @x, @xs, @y) -> c_18()
, 30: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, 31: newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, 32: lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, 33: #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, 34: newline#1^#(nil(), @lastline, @y) -> c_38()
, 35: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, 36: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, 37: right^#(@l) -> c_27(right#1^#(@l))
, 38: max#1^#(#true(), @a, @b) -> c_28()
, 39: max#1^#(#false(), @a, @b) -> c_29()
, 40: #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, 41: #eq^#(#pos(@x), #0()) -> c_41()
, 42: #eq^#(#pos(@x), #neg(@y)) -> c_42()
, 43: #eq^#(nil(), nil()) -> c_43()
, 44: #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, 45: #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, 46: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, 47: #eq^#(#0(), #pos(@y)) -> c_47()
, 48: #eq^#(#0(), #0()) -> c_48()
, 49: #eq^#(#0(), #neg(@y)) -> c_49()
, 50: #eq^#(#0(), #s(@y)) -> c_50()
, 51: #eq^#(#neg(@x), #pos(@y)) -> c_51()
, 52: #eq^#(#neg(@x), #0()) -> c_52()
, 53: #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, 54: #eq^#(#s(@x), #0()) -> c_54()
, 55: #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, 56: #ckgt^#(#EQ()) -> c_56()
, 57: #ckgt^#(#LT()) -> c_57()
, 58: #ckgt^#(#GT()) -> c_58()
, 59: #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, 60: #compare^#(#pos(@x), #0()) -> c_69()
, 61: #compare^#(#pos(@x), #neg(@y)) -> c_70()
, 62: #compare^#(#0(), #pos(@y)) -> c_71()
, 63: #compare^#(#0(), #0()) -> c_72()
, 64: #compare^#(#0(), #neg(@y)) -> c_73()
, 65: #compare^#(#0(), #s(@y)) -> c_74()
, 66: #compare^#(#neg(@x), #pos(@y)) -> c_75()
, 67: #compare^#(#neg(@x), #0()) -> c_76()
, 68: #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, 69: #compare^#(#s(@x), #0()) -> c_78()
, 70: #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, 71: #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, 72: #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 73: #add^#(#0(), @y) -> c_61()
, 74: #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, 75: #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 76: #and^#(#true(), #true()) -> c_64()
, 77: #and^#(#true(), #false()) -> c_65()
, 78: #and^#(#false(), #true()) -> c_66()
, 79: #and^#(#false(), #false()) -> c_67()
, 80: #succ^#(#pos(#s(@x))) -> c_80()
, 81: #succ^#(#0()) -> c_81()
, 82: #succ^#(#neg(#s(#0()))) -> c_82()
, 83: #succ^#(#neg(#s(#s(@x)))) -> c_83()
, 84: #pred^#(#pos(#s(#0()))) -> c_84()
, 85: #pred^#(#pos(#s(#s(@x)))) -> c_85()
, 86: #pred^#(#0()) -> c_86()
, 87: #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l)) }
Weak DPs:
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We estimate the number of application of {3,5,12,14,17} by
applications of Pre({3,5,12,14,17}) = {4,6,13,16,23}. Here rules
are labeled as follows:
DPs:
{ 1: firstline#1^#(::(@x, @xs)) ->
c_2(#abs^#(#0()), firstline^#(@xs))
, 2: firstline^#(@l) -> c_20(firstline#1^#(@l))
, 3: lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, 4: lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, 5: lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, 6: lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, 7: lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, 8: lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, 9: lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 10: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_9(newline^#(@x, @l, @l2))
, 11: newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, 12: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, 13: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, 14: max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, 15: lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, 16: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, 17: right#1^#(nil()) -> c_16(#abs^#(#0()))
, 18: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, 19: newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, 20: lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, 21: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, 22: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, 23: right^#(@l) -> c_27(right#1^#(@l))
, 24: firstline#1^#(nil()) -> c_1()
, 25: #abs^#(#pos(@x)) -> c_32()
, 26: #abs^#(#0()) -> c_33()
, 27: #abs^#(#neg(@x)) -> c_34()
, 28: #abs^#(#s(@x)) -> c_35()
, 29: #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, 30: #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, 31: #eq^#(#pos(@x), #0()) -> c_41()
, 32: #eq^#(#pos(@x), #neg(@y)) -> c_42()
, 33: #eq^#(nil(), nil()) -> c_43()
, 34: #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, 35: #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, 36: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, 37: #eq^#(#0(), #pos(@y)) -> c_47()
, 38: #eq^#(#0(), #0()) -> c_48()
, 39: #eq^#(#0(), #neg(@y)) -> c_49()
, 40: #eq^#(#0(), #s(@y)) -> c_50()
, 41: #eq^#(#neg(@x), #pos(@y)) -> c_51()
, 42: #eq^#(#neg(@x), #0()) -> c_52()
, 43: #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, 44: #eq^#(#s(@x), #0()) -> c_54()
, 45: #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, 46: lcs#3^#(::(@len, @_@1)) -> c_5()
, 47: lcstable#3^#(nil(), @l2, @x) -> c_8()
, 48: +^#(@x, @y) -> c_30(#add^#(@x, @y))
, 49: newline#6^#(@elem, @nl) -> c_37()
, 50: right#1^#(::(@x, @xs)) -> c_17()
, 51: newline#2^#(nil(), @x, @xs, @y) -> c_18()
, 52: #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, 53: #ckgt^#(#EQ()) -> c_56()
, 54: #ckgt^#(#LT()) -> c_57()
, 55: #ckgt^#(#GT()) -> c_58()
, 56: #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, 57: #compare^#(#pos(@x), #0()) -> c_69()
, 58: #compare^#(#pos(@x), #neg(@y)) -> c_70()
, 59: #compare^#(#0(), #pos(@y)) -> c_71()
, 60: #compare^#(#0(), #0()) -> c_72()
, 61: #compare^#(#0(), #neg(@y)) -> c_73()
, 62: #compare^#(#0(), #s(@y)) -> c_74()
, 63: #compare^#(#neg(@x), #pos(@y)) -> c_75()
, 64: #compare^#(#neg(@x), #0()) -> c_76()
, 65: #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, 66: #compare^#(#s(@x), #0()) -> c_78()
, 67: #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, 68: newline#1^#(nil(), @lastline, @y) -> c_38()
, 69: max#1^#(#true(), @a, @b) -> c_28()
, 70: max#1^#(#false(), @a, @b) -> c_29()
, 71: #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, 72: #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 73: #add^#(#0(), @y) -> c_61()
, 74: #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, 75: #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 76: #and^#(#true(), #true()) -> c_64()
, 77: #and^#(#true(), #false()) -> c_65()
, 78: #and^#(#false(), #true()) -> c_66()
, 79: #and^#(#false(), #false()) -> c_67()
, 80: #succ^#(#pos(#s(@x))) -> c_80()
, 81: #succ^#(#0()) -> c_81()
, 82: #succ^#(#neg(#s(#0()))) -> c_82()
, 83: #succ^#(#neg(#s(#s(@x)))) -> c_83()
, 84: #pred^#(#pos(#s(#0()))) -> c_84()
, 85: #pred^#(#pos(#s(#s(@x)))) -> c_85()
, 86: #pred^#(#0()) -> c_86()
, 87: #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l)) }
Weak DPs:
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We estimate the number of application of {4,10,18} by applications
of Pre({4,10,18}) = {3,12,14,17}. Here rules are labeled as
follows:
DPs:
{ 1: firstline#1^#(::(@x, @xs)) ->
c_2(#abs^#(#0()), firstline^#(@xs))
, 2: firstline^#(@l) -> c_20(firstline#1^#(@l))
, 3: lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, 4: lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, 5: lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, 6: lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, 7: lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 8: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_9(newline^#(@x, @l, @l2))
, 9: newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, 10: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, 11: lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, 12: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, 13: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, 14: newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, 15: lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, 16: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, 17: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, 18: right^#(@l) -> c_27(right#1^#(@l))
, 19: firstline#1^#(nil()) -> c_1()
, 20: #abs^#(#pos(@x)) -> c_32()
, 21: #abs^#(#0()) -> c_33()
, 22: #abs^#(#neg(@x)) -> c_34()
, 23: #abs^#(#s(@x)) -> c_35()
, 24: #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, 25: #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, 26: #eq^#(#pos(@x), #0()) -> c_41()
, 27: #eq^#(#pos(@x), #neg(@y)) -> c_42()
, 28: #eq^#(nil(), nil()) -> c_43()
, 29: #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, 30: #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, 31: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, 32: #eq^#(#0(), #pos(@y)) -> c_47()
, 33: #eq^#(#0(), #0()) -> c_48()
, 34: #eq^#(#0(), #neg(@y)) -> c_49()
, 35: #eq^#(#0(), #s(@y)) -> c_50()
, 36: #eq^#(#neg(@x), #pos(@y)) -> c_51()
, 37: #eq^#(#neg(@x), #0()) -> c_52()
, 38: #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, 39: #eq^#(#s(@x), #0()) -> c_54()
, 40: #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, 41: lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, 42: lcs#3^#(::(@len, @_@1)) -> c_5()
, 43: lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, 44: lcstable#3^#(nil(), @l2, @x) -> c_8()
, 45: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, 46: +^#(@x, @y) -> c_30(#add^#(@x, @y))
, 47: max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, 48: newline#6^#(@elem, @nl) -> c_37()
, 49: right#1^#(nil()) -> c_16(#abs^#(#0()))
, 50: right#1^#(::(@x, @xs)) -> c_17()
, 51: newline#2^#(nil(), @x, @xs, @y) -> c_18()
, 52: #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, 53: #ckgt^#(#EQ()) -> c_56()
, 54: #ckgt^#(#LT()) -> c_57()
, 55: #ckgt^#(#GT()) -> c_58()
, 56: #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, 57: #compare^#(#pos(@x), #0()) -> c_69()
, 58: #compare^#(#pos(@x), #neg(@y)) -> c_70()
, 59: #compare^#(#0(), #pos(@y)) -> c_71()
, 60: #compare^#(#0(), #0()) -> c_72()
, 61: #compare^#(#0(), #neg(@y)) -> c_73()
, 62: #compare^#(#0(), #s(@y)) -> c_74()
, 63: #compare^#(#neg(@x), #pos(@y)) -> c_75()
, 64: #compare^#(#neg(@x), #0()) -> c_76()
, 65: #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, 66: #compare^#(#s(@x), #0()) -> c_78()
, 67: #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, 68: newline#1^#(nil(), @lastline, @y) -> c_38()
, 69: max#1^#(#true(), @a, @b) -> c_28()
, 70: max#1^#(#false(), @a, @b) -> c_29()
, 71: #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, 72: #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 73: #add^#(#0(), @y) -> c_61()
, 74: #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, 75: #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 76: #and^#(#true(), #true()) -> c_64()
, 77: #and^#(#true(), #false()) -> c_65()
, 78: #and^#(#false(), #true()) -> c_66()
, 79: #and^#(#false(), #false()) -> c_67()
, 80: #succ^#(#pos(#s(@x))) -> c_80()
, 81: #succ^#(#0()) -> c_81()
, 82: #succ^#(#neg(#s(#0()))) -> c_82()
, 83: #succ^#(#neg(#s(#s(@x)))) -> c_83()
, 84: #pred^#(#pos(#s(#0()))) -> c_84()
, 85: #pred^#(#pos(#s(#s(@x)))) -> c_85()
, 86: #pred^#(#0()) -> c_86()
, 87: #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline')) }
Weak DPs:
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We estimate the number of application of {3,10} by applications of
Pre({3,10}) = {9,15}. Here rules are labeled as follows:
DPs:
{ 1: firstline#1^#(::(@x, @xs)) ->
c_2(#abs^#(#0()), firstline^#(@xs))
, 2: firstline^#(@l) -> c_20(firstline#1^#(@l))
, 3: lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, 4: lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, 5: lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, 6: lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 7: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_9(newline^#(@x, @l, @l2))
, 8: newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, 9: lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, 10: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, 11: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, 12: newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, 13: lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, 14: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, 15: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, 16: firstline#1^#(nil()) -> c_1()
, 17: #abs^#(#pos(@x)) -> c_32()
, 18: #abs^#(#0()) -> c_33()
, 19: #abs^#(#neg(@x)) -> c_34()
, 20: #abs^#(#s(@x)) -> c_35()
, 21: #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, 22: #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, 23: #eq^#(#pos(@x), #0()) -> c_41()
, 24: #eq^#(#pos(@x), #neg(@y)) -> c_42()
, 25: #eq^#(nil(), nil()) -> c_43()
, 26: #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, 27: #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, 28: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, 29: #eq^#(#0(), #pos(@y)) -> c_47()
, 30: #eq^#(#0(), #0()) -> c_48()
, 31: #eq^#(#0(), #neg(@y)) -> c_49()
, 32: #eq^#(#0(), #s(@y)) -> c_50()
, 33: #eq^#(#neg(@x), #pos(@y)) -> c_51()
, 34: #eq^#(#neg(@x), #0()) -> c_52()
, 35: #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, 36: #eq^#(#s(@x), #0()) -> c_54()
, 37: #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, 38: lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, 39: lcs#3^#(::(@len, @_@1)) -> c_5()
, 40: lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, 41: lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, 42: lcstable#3^#(nil(), @l2, @x) -> c_8()
, 43: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, 44: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, 45: +^#(@x, @y) -> c_30(#add^#(@x, @y))
, 46: max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, 47: newline#6^#(@elem, @nl) -> c_37()
, 48: right#1^#(nil()) -> c_16(#abs^#(#0()))
, 49: right#1^#(::(@x, @xs)) -> c_17()
, 50: newline#2^#(nil(), @x, @xs, @y) -> c_18()
, 51: #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, 52: #ckgt^#(#EQ()) -> c_56()
, 53: #ckgt^#(#LT()) -> c_57()
, 54: #ckgt^#(#GT()) -> c_58()
, 55: #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, 56: #compare^#(#pos(@x), #0()) -> c_69()
, 57: #compare^#(#pos(@x), #neg(@y)) -> c_70()
, 58: #compare^#(#0(), #pos(@y)) -> c_71()
, 59: #compare^#(#0(), #0()) -> c_72()
, 60: #compare^#(#0(), #neg(@y)) -> c_73()
, 61: #compare^#(#0(), #s(@y)) -> c_74()
, 62: #compare^#(#neg(@x), #pos(@y)) -> c_75()
, 63: #compare^#(#neg(@x), #0()) -> c_76()
, 64: #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, 65: #compare^#(#s(@x), #0()) -> c_78()
, 66: #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, 67: newline#1^#(nil(), @lastline, @y) -> c_38()
, 68: right^#(@l) -> c_27(right#1^#(@l))
, 69: max#1^#(#true(), @a, @b) -> c_28()
, 70: max#1^#(#false(), @a, @b) -> c_29()
, 71: #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, 72: #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 73: #add^#(#0(), @y) -> c_61()
, 74: #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, 75: #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 76: #and^#(#true(), #true()) -> c_64()
, 77: #and^#(#true(), #false()) -> c_65()
, 78: #and^#(#false(), #true()) -> c_66()
, 79: #and^#(#false(), #false()) -> c_67()
, 80: #succ^#(#pos(#s(@x))) -> c_80()
, 81: #succ^#(#0()) -> c_81()
, 82: #succ^#(#neg(#s(#0()))) -> c_82()
, 83: #succ^#(#neg(#s(#s(@x)))) -> c_83()
, 84: #pred^#(#pos(#s(#0()))) -> c_84()
, 85: #pred^#(#pos(#s(#s(@x)))) -> c_85()
, 86: #pred^#(#0()) -> c_86()
, 87: #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline')) }
Weak DPs:
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We estimate the number of application of {13} by applications of
Pre({13}) = {10}. Here rules are labeled as follows:
DPs:
{ 1: firstline#1^#(::(@x, @xs)) ->
c_2(#abs^#(#0()), firstline^#(@xs))
, 2: firstline^#(@l) -> c_20(firstline#1^#(@l))
, 3: lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, 4: lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, 5: lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 6: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_9(newline^#(@x, @l, @l2))
, 7: newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, 8: lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, 9: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, 10: newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, 11: lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, 12: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, 13: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, 14: firstline#1^#(nil()) -> c_1()
, 15: #abs^#(#pos(@x)) -> c_32()
, 16: #abs^#(#0()) -> c_33()
, 17: #abs^#(#neg(@x)) -> c_34()
, 18: #abs^#(#s(@x)) -> c_35()
, 19: #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, 20: #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, 21: #eq^#(#pos(@x), #0()) -> c_41()
, 22: #eq^#(#pos(@x), #neg(@y)) -> c_42()
, 23: #eq^#(nil(), nil()) -> c_43()
, 24: #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, 25: #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, 26: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, 27: #eq^#(#0(), #pos(@y)) -> c_47()
, 28: #eq^#(#0(), #0()) -> c_48()
, 29: #eq^#(#0(), #neg(@y)) -> c_49()
, 30: #eq^#(#0(), #s(@y)) -> c_50()
, 31: #eq^#(#neg(@x), #pos(@y)) -> c_51()
, 32: #eq^#(#neg(@x), #0()) -> c_52()
, 33: #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, 34: #eq^#(#s(@x), #0()) -> c_54()
, 35: #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, 36: lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, 37: lcs#3^#(::(@len, @_@1)) -> c_5()
, 38: lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, 39: lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, 40: lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, 41: lcstable#3^#(nil(), @l2, @x) -> c_8()
, 42: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, 43: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, 44: +^#(@x, @y) -> c_30(#add^#(@x, @y))
, 45: max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, 46: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, 47: newline#6^#(@elem, @nl) -> c_37()
, 48: right#1^#(nil()) -> c_16(#abs^#(#0()))
, 49: right#1^#(::(@x, @xs)) -> c_17()
, 50: newline#2^#(nil(), @x, @xs, @y) -> c_18()
, 51: #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, 52: #ckgt^#(#EQ()) -> c_56()
, 53: #ckgt^#(#LT()) -> c_57()
, 54: #ckgt^#(#GT()) -> c_58()
, 55: #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, 56: #compare^#(#pos(@x), #0()) -> c_69()
, 57: #compare^#(#pos(@x), #neg(@y)) -> c_70()
, 58: #compare^#(#0(), #pos(@y)) -> c_71()
, 59: #compare^#(#0(), #0()) -> c_72()
, 60: #compare^#(#0(), #neg(@y)) -> c_73()
, 61: #compare^#(#0(), #s(@y)) -> c_74()
, 62: #compare^#(#neg(@x), #pos(@y)) -> c_75()
, 63: #compare^#(#neg(@x), #0()) -> c_76()
, 64: #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, 65: #compare^#(#s(@x), #0()) -> c_78()
, 66: #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, 67: newline#1^#(nil(), @lastline, @y) -> c_38()
, 68: right^#(@l) -> c_27(right#1^#(@l))
, 69: max#1^#(#true(), @a, @b) -> c_28()
, 70: max#1^#(#false(), @a, @b) -> c_29()
, 71: #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, 72: #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 73: #add^#(#0(), @y) -> c_61()
, 74: #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, 75: #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 76: #and^#(#true(), #true()) -> c_64()
, 77: #and^#(#true(), #false()) -> c_65()
, 78: #and^#(#false(), #true()) -> c_66()
, 79: #and^#(#false(), #false()) -> c_67()
, 80: #succ^#(#pos(#s(@x))) -> c_80()
, 81: #succ^#(#0()) -> c_81()
, 82: #succ^#(#neg(#s(#0()))) -> c_82()
, 83: #succ^#(#neg(#s(#s(@x)))) -> c_83()
, 84: #pred^#(#pos(#s(#0()))) -> c_84()
, 85: #pred^#(#pos(#s(#s(@x)))) -> c_85()
, 86: #pred^#(#0()) -> c_86()
, 87: #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y)) }
Weak DPs:
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We estimate the number of application of {10} by applications of
Pre({10}) = {9}. Here rules are labeled as follows:
DPs:
{ 1: firstline#1^#(::(@x, @xs)) ->
c_2(#abs^#(#0()), firstline^#(@xs))
, 2: firstline^#(@l) -> c_20(firstline#1^#(@l))
, 3: lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, 4: lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, 5: lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 6: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_9(newline^#(@x, @l, @l2))
, 7: newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, 8: lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, 9: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, 10: newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, 11: lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, 12: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y))
, 13: firstline#1^#(nil()) -> c_1()
, 14: #abs^#(#pos(@x)) -> c_32()
, 15: #abs^#(#0()) -> c_33()
, 16: #abs^#(#neg(@x)) -> c_34()
, 17: #abs^#(#s(@x)) -> c_35()
, 18: #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, 19: #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, 20: #eq^#(#pos(@x), #0()) -> c_41()
, 21: #eq^#(#pos(@x), #neg(@y)) -> c_42()
, 22: #eq^#(nil(), nil()) -> c_43()
, 23: #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, 24: #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, 25: #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, 26: #eq^#(#0(), #pos(@y)) -> c_47()
, 27: #eq^#(#0(), #0()) -> c_48()
, 28: #eq^#(#0(), #neg(@y)) -> c_49()
, 29: #eq^#(#0(), #s(@y)) -> c_50()
, 30: #eq^#(#neg(@x), #pos(@y)) -> c_51()
, 31: #eq^#(#neg(@x), #0()) -> c_52()
, 32: #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, 33: #eq^#(#s(@x), #0()) -> c_54()
, 34: #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, 35: lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, 36: lcs#3^#(::(@len, @_@1)) -> c_5()
, 37: lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, 38: lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, 39: lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, 40: lcstable#3^#(nil(), @l2, @x) -> c_8()
, 41: newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, 42: newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, 43: +^#(@x, @y) -> c_30(#add^#(@x, @y))
, 44: max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, 45: newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, 46: newline#6^#(@elem, @nl) -> c_37()
, 47: right#1^#(nil()) -> c_16(#abs^#(#0()))
, 48: right#1^#(::(@x, @xs)) -> c_17()
, 49: newline#2^#(nil(), @x, @xs, @y) -> c_18()
, 50: #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, 51: #ckgt^#(#EQ()) -> c_56()
, 52: #ckgt^#(#LT()) -> c_57()
, 53: #ckgt^#(#GT()) -> c_58()
, 54: #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, 55: #compare^#(#pos(@x), #0()) -> c_69()
, 56: #compare^#(#pos(@x), #neg(@y)) -> c_70()
, 57: #compare^#(#0(), #pos(@y)) -> c_71()
, 58: #compare^#(#0(), #0()) -> c_72()
, 59: #compare^#(#0(), #neg(@y)) -> c_73()
, 60: #compare^#(#0(), #s(@y)) -> c_74()
, 61: #compare^#(#neg(@x), #pos(@y)) -> c_75()
, 62: #compare^#(#neg(@x), #0()) -> c_76()
, 63: #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, 64: #compare^#(#s(@x), #0()) -> c_78()
, 65: #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, 66: newline#1^#(nil(), @lastline, @y) -> c_38()
, 67: newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, 68: right^#(@l) -> c_27(right#1^#(@l))
, 69: max#1^#(#true(), @a, @b) -> c_28()
, 70: max#1^#(#false(), @a, @b) -> c_29()
, 71: #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, 72: #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 73: #add^#(#0(), @y) -> c_61()
, 74: #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, 75: #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, 76: #and^#(#true(), #true()) -> c_64()
, 77: #and^#(#true(), #false()) -> c_65()
, 78: #and^#(#false(), #true()) -> c_66()
, 79: #and^#(#false(), #false()) -> c_67()
, 80: #succ^#(#pos(#s(@x))) -> c_80()
, 81: #succ^#(#0()) -> c_81()
, 82: #succ^#(#neg(#s(#0()))) -> c_82()
, 83: #succ^#(#neg(#s(#s(@x)))) -> c_83()
, 84: #pred^#(#pos(#s(#0()))) -> c_84()
, 85: #pred^#(#pos(#s(#s(@x)))) -> c_85()
, 86: #pred^#(#0()) -> c_86()
, 87: #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y)) }
Weak DPs:
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.
{ firstline#1^#(nil()) -> c_1()
, #abs^#(#pos(@x)) -> c_32()
, #abs^#(#0()) -> c_33()
, #abs^#(#neg(@x)) -> c_34()
, #abs^#(#s(@x)) -> c_35()
, #equal^#(@x, @y) -> c_3(#eq^#(@x, @y))
, #eq^#(#pos(@x), #pos(@y)) -> c_40(#eq^#(@x, @y))
, #eq^#(#pos(@x), #0()) -> c_41()
, #eq^#(#pos(@x), #neg(@y)) -> c_42()
, #eq^#(nil(), nil()) -> c_43()
, #eq^#(nil(), ::(@y_1, @y_2)) -> c_44()
, #eq^#(::(@x_1, @x_2), nil()) -> c_45()
, #eq^#(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
c_46(#and^#(#eq(@x_1, @y_1), #eq(@x_2, @y_2)),
#eq^#(@x_1, @y_1),
#eq^#(@x_2, @y_2))
, #eq^#(#0(), #pos(@y)) -> c_47()
, #eq^#(#0(), #0()) -> c_48()
, #eq^#(#0(), #neg(@y)) -> c_49()
, #eq^#(#0(), #s(@y)) -> c_50()
, #eq^#(#neg(@x), #pos(@y)) -> c_51()
, #eq^#(#neg(@x), #0()) -> c_52()
, #eq^#(#neg(@x), #neg(@y)) -> c_53(#eq^#(@x, @y))
, #eq^#(#s(@x), #0()) -> c_54()
, #eq^#(#s(@x), #s(@y)) -> c_55(#eq^#(@x, @y))
, lcs#3^#(nil()) -> c_4(#abs^#(#0()))
, lcs#3^#(::(@len, @_@1)) -> c_5()
, lcs#1^#(@m) -> c_6(lcs#2^#(@m))
, lcs#2^#(nil()) -> c_12(#abs^#(#0()))
, lcs#2^#(::(@l1, @_@2)) -> c_13(lcs#3^#(@l1))
, lcstable#3^#(nil(), @l2, @x) -> c_8()
, newline#7^#(#true(), @belowVal, @diagVal, @rightVal) ->
c_10(+^#(@diagVal, #pos(#s(#0()))))
, newline#7^#(#false(), @belowVal, @diagVal, @rightVal) ->
c_11(max^#(@belowVal, @rightVal))
, +^#(@x, @y) -> c_30(#add^#(@x, @y))
, max^#(@a, @b) ->
c_26(max#1^#(#greater(@a, @b), @a, @b), #greater^#(@a, @b))
, newline#5^#(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
c_15(newline#6^#(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl),
newline#7^#(#equal(@x, @y), @belowVal, @diagVal, @rightVal),
#equal^#(@x, @y))
, newline#6^#(@elem, @nl) -> c_37()
, right#1^#(nil()) -> c_16(#abs^#(#0()))
, right#1^#(::(@x, @xs)) -> c_17()
, newline#2^#(nil(), @x, @xs, @y) -> c_18()
, newline#3^#(@nl, @belowVal, @lastline', @x, @y) ->
c_31(newline#4^#(right(@nl), @belowVal, @lastline', @nl, @x, @y),
right^#(@nl))
, #greater^#(@x, @y) ->
c_23(#ckgt^#(#compare(@x, @y)), #compare^#(@x, @y))
, #ckgt^#(#EQ()) -> c_56()
, #ckgt^#(#LT()) -> c_57()
, #ckgt^#(#GT()) -> c_58()
, #compare^#(#pos(@x), #pos(@y)) -> c_68(#compare^#(@x, @y))
, #compare^#(#pos(@x), #0()) -> c_69()
, #compare^#(#pos(@x), #neg(@y)) -> c_70()
, #compare^#(#0(), #pos(@y)) -> c_71()
, #compare^#(#0(), #0()) -> c_72()
, #compare^#(#0(), #neg(@y)) -> c_73()
, #compare^#(#0(), #s(@y)) -> c_74()
, #compare^#(#neg(@x), #pos(@y)) -> c_75()
, #compare^#(#neg(@x), #0()) -> c_76()
, #compare^#(#neg(@x), #neg(@y)) -> c_77(#compare^#(@y, @x))
, #compare^#(#s(@x), #0()) -> c_78()
, #compare^#(#s(@x), #s(@y)) -> c_79(#compare^#(@x, @y))
, newline#1^#(nil(), @lastline, @y) -> c_38()
, newline#4^#(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
c_25(newline#5^#(right(@lastline'),
@belowVal,
@nl,
@rightVal,
@x,
@y),
right^#(@lastline'))
, right^#(@l) -> c_27(right#1^#(@l))
, max#1^#(#true(), @a, @b) -> c_28()
, max#1^#(#false(), @a, @b) -> c_29()
, #add^#(#pos(#s(#0())), @y) -> c_59(#succ^#(@y))
, #add^#(#pos(#s(#s(@x))), @y) ->
c_60(#succ^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #add^#(#0(), @y) -> c_61()
, #add^#(#neg(#s(#0())), @y) -> c_62(#pred^#(@y))
, #add^#(#neg(#s(#s(@x))), @y) ->
c_63(#pred^#(#add(#pos(#s(@x)), @y)), #add^#(#pos(#s(@x)), @y))
, #and^#(#true(), #true()) -> c_64()
, #and^#(#true(), #false()) -> c_65()
, #and^#(#false(), #true()) -> c_66()
, #and^#(#false(), #false()) -> c_67()
, #succ^#(#pos(#s(@x))) -> c_80()
, #succ^#(#0()) -> c_81()
, #succ^#(#neg(#s(#0()))) -> c_82()
, #succ^#(#neg(#s(#s(@x)))) -> c_83()
, #pred^#(#pos(#s(#0()))) -> c_84()
, #pred^#(#pos(#s(#s(@x)))) -> c_85()
, #pred^#(#0()) -> c_86()
, #pred^#(#neg(#s(@x))) -> c_87() }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, firstline^#(@l) -> c_20(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_7(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_21(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_22(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_9(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_24(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_36(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_39(newline#2^#(@lastline, @x, @xs, @y)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
Due to missing edges in the dependency-graph, the right-hand sides
of following rules could be simplified:
{ firstline#1^#(::(@x, @xs)) -> c_2(#abs^#(#0()), firstline^#(@xs))
, lcs^#(@l1, @l2) ->
c_14(lcs#1^#(lcstable(@l1, @l2)), lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_19(newline#3^#(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y),
newline^#(@y, @lastline', @xs)) }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, firstline^#(@l) -> c_2(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) -> c_8(lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcs#3(nil()) -> #abs(#0())
, lcs#3(::(@len, @_@1)) -> @len
, lcs#1(@m) -> lcs#2(@m)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, lcs#2(nil()) -> #abs(#0())
, lcs#2(::(@l1, @_@2)) -> lcs#3(@l1)
, lcs(@l1, @l2) -> lcs#1(lcstable(@l1, @l2))
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We replace rewrite rules by usable rules:
Weak Usable Rules:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, firstline^#(@l) -> c_2(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, lcs^#(@l1, @l2) -> c_8(lcstable^#(@l1, @l2))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
Consider the dependency graph
1: firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
-->_1 firstline^#(@l) -> c_2(firstline#1^#(@l)) :2
2: firstline^#(@l) -> c_2(firstline#1^#(@l))
-->_1 firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs)) :1
3: lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
-->_1 lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) :5
-->_1 lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2)) :4
4: lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
-->_1 firstline^#(@l) -> c_2(firstline#1^#(@l)) :2
5: lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
-->_1 lcstable#2^#(@m, @l2, @x) ->
c_10(lcstable#3^#(@m, @l2, @x)) :10
-->_2 lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2)) :3
6: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_6(newline^#(@x, @l, @l2))
-->_1 newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y)) :7
7: newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
-->_1 newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) :11
8: lcs^#(@l1, @l2) -> c_8(lcstable^#(@l1, @l2))
-->_1 lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2)) :3
9: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
-->_1 newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y)) :7
10: lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
-->_1 lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_6(newline^#(@x, @l, @l2)) :6
11: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y))
-->_1 newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs)) :9
Following roots of the dependency graph are removed, as the
considered set of starting terms is closed under reduction with
respect to these rules (modulo compound contexts).
{ lcs^#(@l1, @l2) -> c_8(lcstable^#(@l1, @l2)) }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, firstline^#(@l) -> c_2(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We use the processor 'matrix interpretation of dimension 1' to
orient following rules strictly.
DPs:
{ 1: firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, 2: firstline^#(@l) -> c_2(firstline#1^#(@l))
, 3: lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, 4: lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
, 5: lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) }
Trs:
{ firstline#1(nil()) -> nil()
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Sub-proof:
----------
The following argument positions are usable:
Uargs(c_1) = {1}, Uargs(c_2) = {1}, Uargs(c_3) = {1},
Uargs(c_4) = {1}, Uargs(c_5) = {1, 2}, Uargs(c_6) = {1},
Uargs(c_7) = {1}, Uargs(c_9) = {1}, Uargs(c_10) = {1},
Uargs(c_11) = {1}
TcT has computed the following constructor-based matrix
interpretation satisfying not(EDA).
[firstline#1](x1) = [1] x1 + [2]
[#equal](x1, x2) = [3] x1 + [1] x2 + [1]
[#eq](x1, x2) = [3] x1 + [1] x2 + [1]
[lcstable](x1, x2) = [2] x1 + [7]
[lcstable#3](x1, x2, x3) = [1] x1 + [2]
[newline#7](x1, x2, x3, x4) = [4] x1 + [1] x2 + [6] x3 + [3] x4 + [3]
[#true] = [3]
[newline#5](x1, x2, x3, x4, x5, x6) = [4]
[right#1](x1) = [0]
[newline#2](x1, x2, x3, x4) = [0]
[firstline](x1) = [1] x1 + [7]
[#ckgt](x1) = [2] x1 + [2]
[#add](x1, x2) = [3] x1 + [1] x2 + [0]
[#pos](x1) = [1] x1 + [1]
[#EQ] = [1]
[#and](x1, x2) = [3]
[#compare](x1, x2) = [2]
[lcstable#1](x1, x2) = [2] x1 + [7]
[nil] = [2]
[#greater](x1, x2) = [2] x2 + [7]
[newline](x1, x2, x3) = [2]
[newline#4](x1, x2, x3, x4, x5, x6) = [4] x2 + [4]
[max](x1, x2) = [1] x1 + [3] x2 + [7]
[right](x1) = [0]
[#false] = [2]
[::](x1, x2) = [1] x2 + [1]
[#LT] = [0]
[max#1](x1, x2, x3) = [1] x1 + [1] x2 + [1] x3 + [0]
[+](x1, x2) = [3] x1 + [2] x2 + [4]
[#succ](x1) = [1] x1 + [4]
[newline#3](x1, x2, x3, x4, x5) = [4]
[#0] = [2]
[#neg](x1) = [1] x1 + [0]
[#abs](x1) = [1] x1 + [1]
[lcstable#2](x1, x2, x3) = [1] x1 + [2]
[#pred](x1) = [1] x1 + [2]
[newline#6](x1, x2) = [0]
[newline#1](x1, x2, x3) = [2]
[#s](x1) = [1] x1 + [2]
[#GT] = [2]
[firstline#1^#](x1) = [4] x1 + [0]
[firstline^#](x1) = [4] x1 + [2]
[lcstable^#](x1, x2) = [3] x1 + [7] x2 + [1]
[lcstable#1^#](x1, x2) = [3] x1 + [7] x2 + [0]
[lcstable#3^#](x1, x2, x3) = [0]
[newline^#](x1, x2, x3) = [0]
[newline#2^#](x1, x2, x3, x4) = [0]
[lcstable#2^#](x1, x2, x3) = [0]
[newline#1^#](x1, x2, x3) = [0]
[c_1](x1) = [1] x1 + [1]
[c_2](x1) = [1] x1 + [0]
[c_3](x1) = [1] x1 + [0]
[c_4](x1) = [1] x1 + [1]
[c_5](x1, x2) = [1] x1 + [1] x2 + [1]
[c_6](x1) = [4] x1 + [0]
[c_7](x1) = [4] x1 + [0]
[c_9](x1) = [1] x1 + [0]
[c_10](x1) = [2] x1 + [0]
[c_11](x1) = [1] x1 + [0]
The order satisfies the following ordering constraints:
[firstline#1(nil())] = [4]
> [2]
= [nil()]
[firstline#1(::(@x, @xs))] = [1] @xs + [3]
? [1] @xs + [8]
= [::(#abs(#0()), firstline(@xs))]
[#equal(@x, @y)] = [3] @x + [1] @y + [1]
>= [3] @x + [1] @y + [1]
= [#eq(@x, @y)]
[#eq(#pos(@x), #pos(@y))] = [3] @x + [1] @y + [5]
> [3] @x + [1] @y + [1]
= [#eq(@x, @y)]
[#eq(#pos(@x), #0())] = [3] @x + [6]
> [2]
= [#false()]
[#eq(#pos(@x), #neg(@y))] = [3] @x + [1] @y + [4]
> [2]
= [#false()]
[#eq(nil(), nil())] = [9]
> [3]
= [#true()]
[#eq(nil(), ::(@y_1, @y_2))] = [1] @y_2 + [8]
> [2]
= [#false()]
[#eq(::(@x_1, @x_2), nil())] = [3] @x_2 + [6]
> [2]
= [#false()]
[#eq(::(@x_1, @x_2), ::(@y_1, @y_2))] = [3] @x_2 + [1] @y_2 + [5]
> [3]
= [#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))]
[#eq(#0(), #pos(@y))] = [1] @y + [8]
> [2]
= [#false()]
[#eq(#0(), #0())] = [9]
> [3]
= [#true()]
[#eq(#0(), #neg(@y))] = [1] @y + [7]
> [2]
= [#false()]
[#eq(#0(), #s(@y))] = [1] @y + [9]
> [2]
= [#false()]
[#eq(#neg(@x), #pos(@y))] = [3] @x + [1] @y + [2]
>= [2]
= [#false()]
[#eq(#neg(@x), #0())] = [3] @x + [3]
> [2]
= [#false()]
[#eq(#neg(@x), #neg(@y))] = [3] @x + [1] @y + [1]
>= [3] @x + [1] @y + [1]
= [#eq(@x, @y)]
[#eq(#s(@x), #0())] = [3] @x + [9]
> [2]
= [#false()]
[#eq(#s(@x), #s(@y))] = [3] @x + [1] @y + [9]
> [3] @x + [1] @y + [1]
= [#eq(@x, @y)]
[lcstable(@l1, @l2)] = [2] @l1 + [7]
>= [2] @l1 + [7]
= [lcstable#1(@l1, @l2)]
[lcstable#3(nil(), @l2, @x)] = [4]
> [2]
= [nil()]
[lcstable#3(::(@l, @ls), @l2, @x)] = [1] @ls + [3]
> [1] @ls + [2]
= [::(newline(@x, @l, @l2), ::(@l, @ls))]
[newline#7(#true(), @belowVal, @diagVal, @rightVal)] = [1] @belowVal + [3] @rightVal + [6] @diagVal + [15]
> [3] @diagVal + [14]
= [+(@diagVal, #pos(#s(#0())))]
[newline#7(#false(), @belowVal, @diagVal, @rightVal)] = [1] @belowVal + [3] @rightVal + [6] @diagVal + [11]
> [1] @belowVal + [3] @rightVal + [7]
= [max(@belowVal, @rightVal)]
[newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y)] = [4]
> [0]
= [newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)]
[right#1(nil())] = [0]
? [3]
= [#abs(#0())]
[right#1(::(@x, @xs))] = [0]
? [1] @x + [0]
= [@x]
[newline#2(nil(), @x, @xs, @y)] = [0]
? [2]
= [nil()]
[newline#2(::(@belowVal, @lastline'), @x, @xs, @y)] = [0]
? [4]
= [newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)]
[firstline(@l)] = [1] @l + [7]
> [1] @l + [2]
= [firstline#1(@l)]
[#ckgt(#EQ())] = [4]
> [2]
= [#false()]
[#ckgt(#LT())] = [2]
>= [2]
= [#false()]
[#ckgt(#GT())] = [6]
> [3]
= [#true()]
[#add(#pos(#s(#0())), @y)] = [1] @y + [15]
> [1] @y + [4]
= [#succ(@y)]
[#add(#pos(#s(#s(@x))), @y)] = [3] @x + [1] @y + [15]
> [3] @x + [1] @y + [13]
= [#succ(#add(#pos(#s(@x)), @y))]
[#add(#0(), @y)] = [1] @y + [6]
> [1] @y + [0]
= [@y]
[#add(#neg(#s(#0())), @y)] = [1] @y + [12]
> [1] @y + [2]
= [#pred(@y)]
[#add(#neg(#s(#s(@x))), @y)] = [3] @x + [1] @y + [12]
> [3] @x + [1] @y + [11]
= [#pred(#add(#pos(#s(@x)), @y))]
[#and(#true(), #true())] = [3]
>= [3]
= [#true()]
[#and(#true(), #false())] = [3]
> [2]
= [#false()]
[#and(#false(), #true())] = [3]
> [2]
= [#false()]
[#and(#false(), #false())] = [3]
> [2]
= [#false()]
[#compare(#pos(@x), #pos(@y))] = [2]
>= [2]
= [#compare(@x, @y)]
[#compare(#pos(@x), #0())] = [2]
>= [2]
= [#GT()]
[#compare(#pos(@x), #neg(@y))] = [2]
>= [2]
= [#GT()]
[#compare(#0(), #pos(@y))] = [2]
> [0]
= [#LT()]
[#compare(#0(), #0())] = [2]
> [1]
= [#EQ()]
[#compare(#0(), #neg(@y))] = [2]
>= [2]
= [#GT()]
[#compare(#0(), #s(@y))] = [2]
> [0]
= [#LT()]
[#compare(#neg(@x), #pos(@y))] = [2]
> [0]
= [#LT()]
[#compare(#neg(@x), #0())] = [2]
> [0]
= [#LT()]
[#compare(#neg(@x), #neg(@y))] = [2]
>= [2]
= [#compare(@y, @x)]
[#compare(#s(@x), #0())] = [2]
>= [2]
= [#GT()]
[#compare(#s(@x), #s(@y))] = [2]
>= [2]
= [#compare(@x, @y)]
[lcstable#1(nil(), @l2)] = [11]
> [3]
= [::(firstline(@l2), nil())]
[lcstable#1(::(@x, @xs), @l2)] = [2] @xs + [9]
>= [2] @xs + [9]
= [lcstable#2(lcstable(@xs, @l2), @l2, @x)]
[#greater(@x, @y)] = [2] @y + [7]
> [6]
= [#ckgt(#compare(@x, @y))]
[newline(@y, @lastline, @l)] = [2]
>= [2]
= [newline#1(@l, @lastline, @y)]
[newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y)] = [4] @belowVal + [4]
>= [4]
= [newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)]
[max(@a, @b)] = [1] @a + [3] @b + [7]
>= [1] @a + [3] @b + [7]
= [max#1(#greater(@a, @b), @a, @b)]
[right(@l)] = [0]
>= [0]
= [right#1(@l)]
[max#1(#true(), @a, @b)] = [1] @a + [1] @b + [3]
> [1] @a + [0]
= [@a]
[max#1(#false(), @a, @b)] = [1] @a + [1] @b + [2]
> [1] @b + [0]
= [@b]
[+(@x, @y)] = [3] @x + [2] @y + [4]
> [3] @x + [1] @y + [0]
= [#add(@x, @y)]
[#succ(#pos(#s(@x)))] = [1] @x + [7]
> [1] @x + [5]
= [#pos(#s(#s(@x)))]
[#succ(#0())] = [6]
> [5]
= [#pos(#s(#0()))]
[#succ(#neg(#s(#0())))] = [8]
> [2]
= [#0()]
[#succ(#neg(#s(#s(@x))))] = [1] @x + [8]
> [1] @x + [2]
= [#neg(#s(@x))]
[newline#3(@nl, @belowVal, @lastline', @x, @y)] = [4]
? [4] @belowVal + [4]
= [newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)]
[#abs(#pos(@x))] = [1] @x + [2]
> [1] @x + [1]
= [#pos(@x)]
[#abs(#0())] = [3]
> [2]
= [#0()]
[#abs(#neg(@x))] = [1] @x + [1]
>= [1] @x + [1]
= [#pos(@x)]
[#abs(#s(@x))] = [1] @x + [3]
>= [1] @x + [3]
= [#pos(#s(@x))]
[lcstable#2(@m, @l2, @x)] = [1] @m + [2]
>= [1] @m + [2]
= [lcstable#3(@m, @l2, @x)]
[#pred(#pos(#s(#0())))] = [7]
> [2]
= [#0()]
[#pred(#pos(#s(#s(@x))))] = [1] @x + [7]
> [1] @x + [3]
= [#pos(#s(@x))]
[#pred(#0())] = [4]
>= [4]
= [#neg(#s(#0()))]
[#pred(#neg(#s(@x)))] = [1] @x + [4]
>= [1] @x + [4]
= [#neg(#s(#s(@x)))]
[newline#6(@elem, @nl)] = [0]
? [1] @nl + [1]
= [::(@elem, @nl)]
[newline#1(nil(), @lastline, @y)] = [2]
>= [2]
= [nil()]
[newline#1(::(@x, @xs), @lastline, @y)] = [2]
> [0]
= [newline#2(@lastline, @x, @xs, @y)]
[firstline#1^#(::(@x, @xs))] = [4] @xs + [4]
> [4] @xs + [3]
= [c_1(firstline^#(@xs))]
[firstline^#(@l)] = [4] @l + [2]
> [4] @l + [0]
= [c_2(firstline#1^#(@l))]
[lcstable^#(@l1, @l2)] = [3] @l1 + [7] @l2 + [1]
> [3] @l1 + [7] @l2 + [0]
= [c_3(lcstable#1^#(@l1, @l2))]
[lcstable#1^#(nil(), @l2)] = [7] @l2 + [6]
> [4] @l2 + [3]
= [c_4(firstline^#(@l2))]
[lcstable#1^#(::(@x, @xs), @l2)] = [3] @xs + [7] @l2 + [3]
> [3] @xs + [7] @l2 + [2]
= [c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))]
[lcstable#3^#(::(@l, @ls), @l2, @x)] = [0]
>= [0]
= [c_6(newline^#(@x, @l, @l2))]
[newline^#(@y, @lastline, @l)] = [0]
>= [0]
= [c_7(newline#1^#(@l, @lastline, @y))]
[newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y)] = [0]
>= [0]
= [c_9(newline^#(@y, @lastline', @xs))]
[lcstable#2^#(@m, @l2, @x)] = [0]
>= [0]
= [c_10(lcstable#3^#(@m, @l2, @x))]
[newline#1^#(::(@x, @xs), @lastline, @y)] = [0]
>= [0]
= [c_11(newline#2^#(@lastline, @x, @xs, @y))]
We return to the main proof. Consider the set of all dependency
pairs
:
{ 1: firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, 2: firstline^#(@l) -> c_2(firstline#1^#(@l))
, 3: lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, 4: lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
, 5: lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 6: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_6(newline^#(@x, @l, @l2))
, 7: newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, 8: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, 9: lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, 10: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Processor 'matrix interpretation of dimension 1' induces the
complexity certificate YES(?,O(n^1)) on application of dependency
pairs {1,2,3,4,5}. These cover all (indirect) predecessors of
dependency pairs {1,2,3,4,5,6,9}, their number of application is
equally bounded. The dependency pairs are shifted into the weak
component.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak DPs:
{ firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, firstline^#(@l) -> c_2(firstline#1^#(@l))
, lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.
{ firstline#1^#(::(@x, @xs)) -> c_1(firstline^#(@xs))
, firstline^#(@l) -> c_2(firstline#1^#(@l))
, lcstable#1^#(nil(), @l2) -> c_4(firstline^#(@l2)) }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^2)).
Strict DPs:
{ newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak DPs:
{ lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^2))
We decompose the input problem according to the dependency graph
into the upper component
{ lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) }
and lower component
{ lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Further, following extension rules are added to the lower
component.
{ lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2)
, lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2)
, lcstable#1^#(::(@x, @xs), @l2) ->
lcstable#2^#(lcstable(@xs, @l2), @l2, @x) }
TcT solves the upper component with certificate YES(O(1),O(n^1)).
Sub-proof:
----------
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^1)).
Strict DPs:
{ lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) }
Weak DPs: { lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^1))
We use the processor 'matrix interpretation of dimension 1' to
orient following rules strictly.
DPs:
{ 1: lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) }
Sub-proof:
----------
The following argument positions are usable:
Uargs(c_3) = {1}, Uargs(c_5) = {1, 2}
TcT has computed the following constructor-based matrix
interpretation satisfying not(EDA).
[firstline#1](x1) = [0]
[#equal](x1, x2) = [0]
[#eq](x1, x2) = [0]
[lcstable](x1, x2) = [0]
[lcstable#3](x1, x2, x3) = [0]
[newline#7](x1, x2, x3, x4) = [0]
[#true] = [0]
[newline#5](x1, x2, x3, x4, x5, x6) = [0]
[right#1](x1) = [0]
[newline#2](x1, x2, x3, x4) = [0]
[firstline](x1) = [0]
[#ckgt](x1) = [0]
[#add](x1, x2) = [0]
[#pos](x1) = [0]
[#EQ] = [0]
[#and](x1, x2) = [0]
[#compare](x1, x2) = [0]
[lcstable#1](x1, x2) = [3] x2 + [0]
[nil] = [0]
[#greater](x1, x2) = [0]
[newline](x1, x2, x3) = [0]
[newline#4](x1, x2, x3, x4, x5, x6) = [1] x4 + [0]
[max](x1, x2) = [1]
[right](x1) = [0]
[#false] = [0]
[::](x1, x2) = [1] x2 + [4]
[#LT] = [0]
[max#1](x1, x2, x3) = [1] x2 + [1] x3 + [0]
[+](x1, x2) = [0]
[#succ](x1) = [0]
[newline#3](x1, x2, x3, x4, x5) = [4] x2 + [0]
[#0] = [0]
[#neg](x1) = [0]
[#abs](x1) = [0]
[lcstable#2](x1, x2, x3) = [0]
[#pred](x1) = [0]
[newline#6](x1, x2) = [0]
[newline#1](x1, x2, x3) = [0]
[#s](x1) = [0]
[#GT] = [0]
[lcstable^#](x1, x2) = [1] x1 + [0]
[lcstable#1^#](x1, x2) = [1] x1 + [0]
[lcstable#2^#](x1, x2, x3) = [0]
[c_3](x1) = [1] x1 + [0]
[c_5](x1, x2) = [4] x1 + [1] x2 + [1]
The order satisfies the following ordering constraints:
[firstline#1(nil())] = [0]
>= [0]
= [nil()]
[firstline#1(::(@x, @xs))] = [0]
? [4]
= [::(#abs(#0()), firstline(@xs))]
[#equal(@x, @y)] = [0]
>= [0]
= [#eq(@x, @y)]
[#eq(#pos(@x), #pos(@y))] = [0]
>= [0]
= [#eq(@x, @y)]
[#eq(#pos(@x), #0())] = [0]
>= [0]
= [#false()]
[#eq(#pos(@x), #neg(@y))] = [0]
>= [0]
= [#false()]
[#eq(nil(), nil())] = [0]
>= [0]
= [#true()]
[#eq(nil(), ::(@y_1, @y_2))] = [0]
>= [0]
= [#false()]
[#eq(::(@x_1, @x_2), nil())] = [0]
>= [0]
= [#false()]
[#eq(::(@x_1, @x_2), ::(@y_1, @y_2))] = [0]
>= [0]
= [#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))]
[#eq(#0(), #pos(@y))] = [0]
>= [0]
= [#false()]
[#eq(#0(), #0())] = [0]
>= [0]
= [#true()]
[#eq(#0(), #neg(@y))] = [0]
>= [0]
= [#false()]
[#eq(#0(), #s(@y))] = [0]
>= [0]
= [#false()]
[#eq(#neg(@x), #pos(@y))] = [0]
>= [0]
= [#false()]
[#eq(#neg(@x), #0())] = [0]
>= [0]
= [#false()]
[#eq(#neg(@x), #neg(@y))] = [0]
>= [0]
= [#eq(@x, @y)]
[#eq(#s(@x), #0())] = [0]
>= [0]
= [#false()]
[#eq(#s(@x), #s(@y))] = [0]
>= [0]
= [#eq(@x, @y)]
[lcstable(@l1, @l2)] = [0]
? [3] @l2 + [0]
= [lcstable#1(@l1, @l2)]
[lcstable#3(nil(), @l2, @x)] = [0]
>= [0]
= [nil()]
[lcstable#3(::(@l, @ls), @l2, @x)] = [0]
? [1] @ls + [8]
= [::(newline(@x, @l, @l2), ::(@l, @ls))]
[newline#7(#true(), @belowVal, @diagVal, @rightVal)] = [0]
>= [0]
= [+(@diagVal, #pos(#s(#0())))]
[newline#7(#false(), @belowVal, @diagVal, @rightVal)] = [0]
? [1]
= [max(@belowVal, @rightVal)]
[newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y)] = [0]
>= [0]
= [newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)]
[right#1(nil())] = [0]
>= [0]
= [#abs(#0())]
[right#1(::(@x, @xs))] = [0]
? [1] @x + [0]
= [@x]
[newline#2(nil(), @x, @xs, @y)] = [0]
>= [0]
= [nil()]
[newline#2(::(@belowVal, @lastline'), @x, @xs, @y)] = [0]
? [4] @belowVal + [0]
= [newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)]
[firstline(@l)] = [0]
>= [0]
= [firstline#1(@l)]
[#ckgt(#EQ())] = [0]
>= [0]
= [#false()]
[#ckgt(#LT())] = [0]
>= [0]
= [#false()]
[#ckgt(#GT())] = [0]
>= [0]
= [#true()]
[#add(#pos(#s(#0())), @y)] = [0]
>= [0]
= [#succ(@y)]
[#add(#pos(#s(#s(@x))), @y)] = [0]
>= [0]
= [#succ(#add(#pos(#s(@x)), @y))]
[#add(#0(), @y)] = [0]
? [1] @y + [0]
= [@y]
[#add(#neg(#s(#0())), @y)] = [0]
>= [0]
= [#pred(@y)]
[#add(#neg(#s(#s(@x))), @y)] = [0]
>= [0]
= [#pred(#add(#pos(#s(@x)), @y))]
[#and(#true(), #true())] = [0]
>= [0]
= [#true()]
[#and(#true(), #false())] = [0]
>= [0]
= [#false()]
[#and(#false(), #true())] = [0]
>= [0]
= [#false()]
[#and(#false(), #false())] = [0]
>= [0]
= [#false()]
[#compare(#pos(@x), #pos(@y))] = [0]
>= [0]
= [#compare(@x, @y)]
[#compare(#pos(@x), #0())] = [0]
>= [0]
= [#GT()]
[#compare(#pos(@x), #neg(@y))] = [0]
>= [0]
= [#GT()]
[#compare(#0(), #pos(@y))] = [0]
>= [0]
= [#LT()]
[#compare(#0(), #0())] = [0]
>= [0]
= [#EQ()]
[#compare(#0(), #neg(@y))] = [0]
>= [0]
= [#GT()]
[#compare(#0(), #s(@y))] = [0]
>= [0]
= [#LT()]
[#compare(#neg(@x), #pos(@y))] = [0]
>= [0]
= [#LT()]
[#compare(#neg(@x), #0())] = [0]
>= [0]
= [#LT()]
[#compare(#neg(@x), #neg(@y))] = [0]
>= [0]
= [#compare(@y, @x)]
[#compare(#s(@x), #0())] = [0]
>= [0]
= [#GT()]
[#compare(#s(@x), #s(@y))] = [0]
>= [0]
= [#compare(@x, @y)]
[lcstable#1(nil(), @l2)] = [3] @l2 + [0]
? [4]
= [::(firstline(@l2), nil())]
[lcstable#1(::(@x, @xs), @l2)] = [3] @l2 + [0]
>= [0]
= [lcstable#2(lcstable(@xs, @l2), @l2, @x)]
[#greater(@x, @y)] = [0]
>= [0]
= [#ckgt(#compare(@x, @y))]
[newline(@y, @lastline, @l)] = [0]
>= [0]
= [newline#1(@l, @lastline, @y)]
[newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y)] = [1] @nl + [0]
>= [0]
= [newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)]
[max(@a, @b)] = [1]
? [1] @a + [1] @b + [0]
= [max#1(#greater(@a, @b), @a, @b)]
[right(@l)] = [0]
>= [0]
= [right#1(@l)]
[max#1(#true(), @a, @b)] = [1] @a + [1] @b + [0]
>= [1] @a + [0]
= [@a]
[max#1(#false(), @a, @b)] = [1] @a + [1] @b + [0]
>= [1] @b + [0]
= [@b]
[+(@x, @y)] = [0]
>= [0]
= [#add(@x, @y)]
[#succ(#pos(#s(@x)))] = [0]
>= [0]
= [#pos(#s(#s(@x)))]
[#succ(#0())] = [0]
>= [0]
= [#pos(#s(#0()))]
[#succ(#neg(#s(#0())))] = [0]
>= [0]
= [#0()]
[#succ(#neg(#s(#s(@x))))] = [0]
>= [0]
= [#neg(#s(@x))]
[newline#3(@nl, @belowVal, @lastline', @x, @y)] = [4] @belowVal + [0]
? [1] @nl + [0]
= [newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)]
[#abs(#pos(@x))] = [0]
>= [0]
= [#pos(@x)]
[#abs(#0())] = [0]
>= [0]
= [#0()]
[#abs(#neg(@x))] = [0]
>= [0]
= [#pos(@x)]
[#abs(#s(@x))] = [0]
>= [0]
= [#pos(#s(@x))]
[lcstable#2(@m, @l2, @x)] = [0]
>= [0]
= [lcstable#3(@m, @l2, @x)]
[#pred(#pos(#s(#0())))] = [0]
>= [0]
= [#0()]
[#pred(#pos(#s(#s(@x))))] = [0]
>= [0]
= [#pos(#s(@x))]
[#pred(#0())] = [0]
>= [0]
= [#neg(#s(#0()))]
[#pred(#neg(#s(@x)))] = [0]
>= [0]
= [#neg(#s(#s(@x)))]
[newline#6(@elem, @nl)] = [0]
? [1] @nl + [4]
= [::(@elem, @nl)]
[newline#1(nil(), @lastline, @y)] = [0]
>= [0]
= [nil()]
[newline#1(::(@x, @xs), @lastline, @y)] = [0]
>= [0]
= [newline#2(@lastline, @x, @xs, @y)]
[lcstable^#(@l1, @l2)] = [1] @l1 + [0]
>= [1] @l1 + [0]
= [c_3(lcstable#1^#(@l1, @l2))]
[lcstable#1^#(::(@x, @xs), @l2)] = [1] @xs + [4]
> [1] @xs + [1]
= [c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))]
We return to the main proof. Consider the set of all dependency
pairs
:
{ 1: lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2))
, 2: lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2)) }
Processor 'matrix interpretation of dimension 1' induces the
complexity certificate YES(?,O(n^1)) on application of dependency
pairs {1}. These cover all (indirect) predecessors of dependency
pairs {1,2}, their number of application is equally bounded. The
dependency pairs are shifted into the weak component.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).
Weak DPs:
{ lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(1))
The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.
{ lcstable^#(@l1, @l2) -> c_3(lcstable#1^#(@l1, @l2))
, lcstable#1^#(::(@x, @xs), @l2) ->
c_5(lcstable#2^#(lcstable(@xs, @l2), @l2, @x),
lcstable^#(@xs, @l2)) }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(1))
No rule is usable, rules are removed from the input problem.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).
Rules: Empty
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(1))
Empty rules are trivially bounded
We return to the main proof.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(n^1)).
Strict DPs:
{ newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak DPs:
{ lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2)
, lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2)
, lcstable#1^#(::(@x, @xs), @l2) ->
lcstable#2^#(lcstable(@xs, @l2), @l2, @x)
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(n^1))
We use the processor 'matrix interpretation of dimension 1' to
orient following rules strictly.
DPs:
{ 2: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, 3: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y))
, 4: lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2)
, 5: lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2)
, 6: lcstable#1^#(::(@x, @xs), @l2) ->
lcstable#2^#(lcstable(@xs, @l2), @l2, @x) }
Sub-proof:
----------
The following argument positions are usable:
Uargs(c_6) = {1}, Uargs(c_7) = {1}, Uargs(c_9) = {1},
Uargs(c_10) = {1}, Uargs(c_11) = {1}
TcT has computed the following constructor-based matrix
interpretation satisfying not(EDA).
[firstline#1](x1) = [0]
[#equal](x1, x2) = [0]
[#eq](x1, x2) = [0]
[lcstable](x1, x2) = [0]
[lcstable#3](x1, x2, x3) = [0]
[newline#7](x1, x2, x3, x4) = [0]
[#true] = [0]
[newline#5](x1, x2, x3, x4, x5, x6) = [0]
[right#1](x1) = [0]
[newline#2](x1, x2, x3, x4) = [0]
[firstline](x1) = [0]
[#ckgt](x1) = [0]
[#add](x1, x2) = [0]
[#pos](x1) = [0]
[#EQ] = [0]
[#and](x1, x2) = [0]
[#compare](x1, x2) = [0]
[lcstable#1](x1, x2) = [3] x2 + [0]
[nil] = [0]
[#greater](x1, x2) = [0]
[newline](x1, x2, x3) = [0]
[newline#4](x1, x2, x3, x4, x5, x6) = [4] x2 + [1] x4 + [0]
[max](x1, x2) = [1]
[right](x1) = [0]
[#false] = [0]
[::](x1, x2) = [1] x1 + [1] x2 + [7]
[#LT] = [0]
[max#1](x1, x2, x3) = [1] x2 + [1] x3 + [0]
[+](x1, x2) = [0]
[#succ](x1) = [0]
[newline#3](x1, x2, x3, x4, x5) = [0]
[#0] = [0]
[#neg](x1) = [0]
[#abs](x1) = [0]
[lcstable#2](x1, x2, x3) = [0]
[#pred](x1) = [0]
[newline#6](x1, x2) = [0]
[newline#1](x1, x2, x3) = [0]
[#s](x1) = [0]
[#GT] = [0]
[lcstable^#](x1, x2) = [2] x1 + [7] x2 + [7]
[lcstable#1^#](x1, x2) = [2] x1 + [7] x2 + [0]
[lcstable#3^#](x1, x2, x3) = [4] x2 + [4]
[newline^#](x1, x2, x3) = [1] x3 + [1]
[newline#2^#](x1, x2, x3, x4) = [1] x3 + [7]
[lcstable#2^#](x1, x2, x3) = [7] x2 + [4]
[newline#1^#](x1, x2, x3) = [1] x1 + [1]
[c_6](x1) = [4] x1 + [0]
[c_7](x1) = [1] x1 + [0]
[c_9](x1) = [1] x1 + [0]
[c_10](x1) = [1] x1 + [0]
[c_11](x1) = [1] x1 + [0]
The order satisfies the following ordering constraints:
[firstline#1(nil())] = [0]
>= [0]
= [nil()]
[firstline#1(::(@x, @xs))] = [0]
? [7]
= [::(#abs(#0()), firstline(@xs))]
[#equal(@x, @y)] = [0]
>= [0]
= [#eq(@x, @y)]
[#eq(#pos(@x), #pos(@y))] = [0]
>= [0]
= [#eq(@x, @y)]
[#eq(#pos(@x), #0())] = [0]
>= [0]
= [#false()]
[#eq(#pos(@x), #neg(@y))] = [0]
>= [0]
= [#false()]
[#eq(nil(), nil())] = [0]
>= [0]
= [#true()]
[#eq(nil(), ::(@y_1, @y_2))] = [0]
>= [0]
= [#false()]
[#eq(::(@x_1, @x_2), nil())] = [0]
>= [0]
= [#false()]
[#eq(::(@x_1, @x_2), ::(@y_1, @y_2))] = [0]
>= [0]
= [#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))]
[#eq(#0(), #pos(@y))] = [0]
>= [0]
= [#false()]
[#eq(#0(), #0())] = [0]
>= [0]
= [#true()]
[#eq(#0(), #neg(@y))] = [0]
>= [0]
= [#false()]
[#eq(#0(), #s(@y))] = [0]
>= [0]
= [#false()]
[#eq(#neg(@x), #pos(@y))] = [0]
>= [0]
= [#false()]
[#eq(#neg(@x), #0())] = [0]
>= [0]
= [#false()]
[#eq(#neg(@x), #neg(@y))] = [0]
>= [0]
= [#eq(@x, @y)]
[#eq(#s(@x), #0())] = [0]
>= [0]
= [#false()]
[#eq(#s(@x), #s(@y))] = [0]
>= [0]
= [#eq(@x, @y)]
[lcstable(@l1, @l2)] = [0]
? [3] @l2 + [0]
= [lcstable#1(@l1, @l2)]
[lcstable#3(nil(), @l2, @x)] = [0]
>= [0]
= [nil()]
[lcstable#3(::(@l, @ls), @l2, @x)] = [0]
? [1] @l + [1] @ls + [14]
= [::(newline(@x, @l, @l2), ::(@l, @ls))]
[newline#7(#true(), @belowVal, @diagVal, @rightVal)] = [0]
>= [0]
= [+(@diagVal, #pos(#s(#0())))]
[newline#7(#false(), @belowVal, @diagVal, @rightVal)] = [0]
? [1]
= [max(@belowVal, @rightVal)]
[newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y)] = [0]
>= [0]
= [newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)]
[right#1(nil())] = [0]
>= [0]
= [#abs(#0())]
[right#1(::(@x, @xs))] = [0]
? [1] @x + [0]
= [@x]
[newline#2(nil(), @x, @xs, @y)] = [0]
>= [0]
= [nil()]
[newline#2(::(@belowVal, @lastline'), @x, @xs, @y)] = [0]
>= [0]
= [newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)]
[firstline(@l)] = [0]
>= [0]
= [firstline#1(@l)]
[#ckgt(#EQ())] = [0]
>= [0]
= [#false()]
[#ckgt(#LT())] = [0]
>= [0]
= [#false()]
[#ckgt(#GT())] = [0]
>= [0]
= [#true()]
[#add(#pos(#s(#0())), @y)] = [0]
>= [0]
= [#succ(@y)]
[#add(#pos(#s(#s(@x))), @y)] = [0]
>= [0]
= [#succ(#add(#pos(#s(@x)), @y))]
[#add(#0(), @y)] = [0]
? [1] @y + [0]
= [@y]
[#add(#neg(#s(#0())), @y)] = [0]
>= [0]
= [#pred(@y)]
[#add(#neg(#s(#s(@x))), @y)] = [0]
>= [0]
= [#pred(#add(#pos(#s(@x)), @y))]
[#and(#true(), #true())] = [0]
>= [0]
= [#true()]
[#and(#true(), #false())] = [0]
>= [0]
= [#false()]
[#and(#false(), #true())] = [0]
>= [0]
= [#false()]
[#and(#false(), #false())] = [0]
>= [0]
= [#false()]
[#compare(#pos(@x), #pos(@y))] = [0]
>= [0]
= [#compare(@x, @y)]
[#compare(#pos(@x), #0())] = [0]
>= [0]
= [#GT()]
[#compare(#pos(@x), #neg(@y))] = [0]
>= [0]
= [#GT()]
[#compare(#0(), #pos(@y))] = [0]
>= [0]
= [#LT()]
[#compare(#0(), #0())] = [0]
>= [0]
= [#EQ()]
[#compare(#0(), #neg(@y))] = [0]
>= [0]
= [#GT()]
[#compare(#0(), #s(@y))] = [0]
>= [0]
= [#LT()]
[#compare(#neg(@x), #pos(@y))] = [0]
>= [0]
= [#LT()]
[#compare(#neg(@x), #0())] = [0]
>= [0]
= [#LT()]
[#compare(#neg(@x), #neg(@y))] = [0]
>= [0]
= [#compare(@y, @x)]
[#compare(#s(@x), #0())] = [0]
>= [0]
= [#GT()]
[#compare(#s(@x), #s(@y))] = [0]
>= [0]
= [#compare(@x, @y)]
[lcstable#1(nil(), @l2)] = [3] @l2 + [0]
? [7]
= [::(firstline(@l2), nil())]
[lcstable#1(::(@x, @xs), @l2)] = [3] @l2 + [0]
>= [0]
= [lcstable#2(lcstable(@xs, @l2), @l2, @x)]
[#greater(@x, @y)] = [0]
>= [0]
= [#ckgt(#compare(@x, @y))]
[newline(@y, @lastline, @l)] = [0]
>= [0]
= [newline#1(@l, @lastline, @y)]
[newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y)] = [4] @belowVal + [1] @nl + [0]
>= [0]
= [newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)]
[max(@a, @b)] = [1]
? [1] @a + [1] @b + [0]
= [max#1(#greater(@a, @b), @a, @b)]
[right(@l)] = [0]
>= [0]
= [right#1(@l)]
[max#1(#true(), @a, @b)] = [1] @a + [1] @b + [0]
>= [1] @a + [0]
= [@a]
[max#1(#false(), @a, @b)] = [1] @a + [1] @b + [0]
>= [1] @b + [0]
= [@b]
[+(@x, @y)] = [0]
>= [0]
= [#add(@x, @y)]
[#succ(#pos(#s(@x)))] = [0]
>= [0]
= [#pos(#s(#s(@x)))]
[#succ(#0())] = [0]
>= [0]
= [#pos(#s(#0()))]
[#succ(#neg(#s(#0())))] = [0]
>= [0]
= [#0()]
[#succ(#neg(#s(#s(@x))))] = [0]
>= [0]
= [#neg(#s(@x))]
[newline#3(@nl, @belowVal, @lastline', @x, @y)] = [0]
? [4] @belowVal + [1] @nl + [0]
= [newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)]
[#abs(#pos(@x))] = [0]
>= [0]
= [#pos(@x)]
[#abs(#0())] = [0]
>= [0]
= [#0()]
[#abs(#neg(@x))] = [0]
>= [0]
= [#pos(@x)]
[#abs(#s(@x))] = [0]
>= [0]
= [#pos(#s(@x))]
[lcstable#2(@m, @l2, @x)] = [0]
>= [0]
= [lcstable#3(@m, @l2, @x)]
[#pred(#pos(#s(#0())))] = [0]
>= [0]
= [#0()]
[#pred(#pos(#s(#s(@x))))] = [0]
>= [0]
= [#pos(#s(@x))]
[#pred(#0())] = [0]
>= [0]
= [#neg(#s(#0()))]
[#pred(#neg(#s(@x)))] = [0]
>= [0]
= [#neg(#s(#s(@x)))]
[newline#6(@elem, @nl)] = [0]
? [1] @nl + [1] @elem + [7]
= [::(@elem, @nl)]
[newline#1(nil(), @lastline, @y)] = [0]
>= [0]
= [nil()]
[newline#1(::(@x, @xs), @lastline, @y)] = [0]
>= [0]
= [newline#2(@lastline, @x, @xs, @y)]
[lcstable^#(@l1, @l2)] = [2] @l1 + [7] @l2 + [7]
> [2] @l1 + [7] @l2 + [0]
= [lcstable#1^#(@l1, @l2)]
[lcstable#1^#(::(@x, @xs), @l2)] = [2] @x + [2] @xs + [7] @l2 + [14]
> [2] @xs + [7] @l2 + [7]
= [lcstable^#(@xs, @l2)]
[lcstable#1^#(::(@x, @xs), @l2)] = [2] @x + [2] @xs + [7] @l2 + [14]
> [7] @l2 + [4]
= [lcstable#2^#(lcstable(@xs, @l2), @l2, @x)]
[lcstable#3^#(::(@l, @ls), @l2, @x)] = [4] @l2 + [4]
>= [4] @l2 + [4]
= [c_6(newline^#(@x, @l, @l2))]
[newline^#(@y, @lastline, @l)] = [1] @l + [1]
>= [1] @l + [1]
= [c_7(newline#1^#(@l, @lastline, @y))]
[newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y)] = [1] @xs + [7]
> [1] @xs + [1]
= [c_9(newline^#(@y, @lastline', @xs))]
[lcstable#2^#(@m, @l2, @x)] = [7] @l2 + [4]
>= [4] @l2 + [4]
= [c_10(lcstable#3^#(@m, @l2, @x))]
[newline#1^#(::(@x, @xs), @lastline, @y)] = [1] @x + [1] @xs + [8]
> [1] @xs + [7]
= [c_11(newline#2^#(@lastline, @x, @xs, @y))]
We return to the main proof. Consider the set of all dependency
pairs
:
{ 1: newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, 2: newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, 3: newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y))
, 4: lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2)
, 5: lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2)
, 6: lcstable#1^#(::(@x, @xs), @l2) ->
lcstable#2^#(lcstable(@xs, @l2), @l2, @x)
, 7: lcstable#3^#(::(@l, @ls), @l2, @x) ->
c_6(newline^#(@x, @l, @l2))
, 8: lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x)) }
Processor 'matrix interpretation of dimension 1' induces the
complexity certificate YES(?,O(n^1)) on application of dependency
pairs {2,3,4,5,6}. These cover all (indirect) predecessors of
dependency pairs {1,2,3,4,5,6,7,8}, their number of application is
equally bounded. The dependency pairs are shifted into the weak
component.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).
Weak DPs:
{ lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2)
, lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2)
, lcstable#1^#(::(@x, @xs), @l2) ->
lcstable#2^#(lcstable(@xs, @l2), @l2, @x)
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(1))
The following weak DPs constitute a sub-graph of the DG that is
closed under successors. The DPs are removed.
{ lcstable^#(@l1, @l2) -> lcstable#1^#(@l1, @l2)
, lcstable#1^#(::(@x, @xs), @l2) -> lcstable^#(@xs, @l2)
, lcstable#1^#(::(@x, @xs), @l2) ->
lcstable#2^#(lcstable(@xs, @l2), @l2, @x)
, lcstable#3^#(::(@l, @ls), @l2, @x) -> c_6(newline^#(@x, @l, @l2))
, newline^#(@y, @lastline, @l) ->
c_7(newline#1^#(@l, @lastline, @y))
, newline#2^#(::(@belowVal, @lastline'), @x, @xs, @y) ->
c_9(newline^#(@y, @lastline', @xs))
, lcstable#2^#(@m, @l2, @x) -> c_10(lcstable#3^#(@m, @l2, @x))
, newline#1^#(::(@x, @xs), @lastline, @y) ->
c_11(newline#2^#(@lastline, @x, @xs, @y)) }
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).
Weak Trs:
{ firstline#1(nil()) -> nil()
, firstline#1(::(@x, @xs)) -> ::(#abs(#0()), firstline(@xs))
, #equal(@x, @y) -> #eq(@x, @y)
, #eq(#pos(@x), #pos(@y)) -> #eq(@x, @y)
, #eq(#pos(@x), #0()) -> #false()
, #eq(#pos(@x), #neg(@y)) -> #false()
, #eq(nil(), nil()) -> #true()
, #eq(nil(), ::(@y_1, @y_2)) -> #false()
, #eq(::(@x_1, @x_2), nil()) -> #false()
, #eq(::(@x_1, @x_2), ::(@y_1, @y_2)) ->
#and(#eq(@x_1, @y_1), #eq(@x_2, @y_2))
, #eq(#0(), #pos(@y)) -> #false()
, #eq(#0(), #0()) -> #true()
, #eq(#0(), #neg(@y)) -> #false()
, #eq(#0(), #s(@y)) -> #false()
, #eq(#neg(@x), #pos(@y)) -> #false()
, #eq(#neg(@x), #0()) -> #false()
, #eq(#neg(@x), #neg(@y)) -> #eq(@x, @y)
, #eq(#s(@x), #0()) -> #false()
, #eq(#s(@x), #s(@y)) -> #eq(@x, @y)
, lcstable(@l1, @l2) -> lcstable#1(@l1, @l2)
, lcstable#3(nil(), @l2, @x) -> nil()
, lcstable#3(::(@l, @ls), @l2, @x) ->
::(newline(@x, @l, @l2), ::(@l, @ls))
, newline#7(#true(), @belowVal, @diagVal, @rightVal) ->
+(@diagVal, #pos(#s(#0())))
, newline#7(#false(), @belowVal, @diagVal, @rightVal) ->
max(@belowVal, @rightVal)
, newline#5(@diagVal, @belowVal, @nl, @rightVal, @x, @y) ->
newline#6(newline#7(#equal(@x, @y),
@belowVal,
@diagVal,
@rightVal),
@nl)
, right#1(nil()) -> #abs(#0())
, right#1(::(@x, @xs)) -> @x
, newline#2(nil(), @x, @xs, @y) -> nil()
, newline#2(::(@belowVal, @lastline'), @x, @xs, @y) ->
newline#3(newline(@y, @lastline', @xs),
@belowVal,
@lastline',
@x,
@y)
, firstline(@l) -> firstline#1(@l)
, #ckgt(#EQ()) -> #false()
, #ckgt(#LT()) -> #false()
, #ckgt(#GT()) -> #true()
, #add(#pos(#s(#0())), @y) -> #succ(@y)
, #add(#pos(#s(#s(@x))), @y) -> #succ(#add(#pos(#s(@x)), @y))
, #add(#0(), @y) -> @y
, #add(#neg(#s(#0())), @y) -> #pred(@y)
, #add(#neg(#s(#s(@x))), @y) -> #pred(#add(#pos(#s(@x)), @y))
, #and(#true(), #true()) -> #true()
, #and(#true(), #false()) -> #false()
, #and(#false(), #true()) -> #false()
, #and(#false(), #false()) -> #false()
, #compare(#pos(@x), #pos(@y)) -> #compare(@x, @y)
, #compare(#pos(@x), #0()) -> #GT()
, #compare(#pos(@x), #neg(@y)) -> #GT()
, #compare(#0(), #pos(@y)) -> #LT()
, #compare(#0(), #0()) -> #EQ()
, #compare(#0(), #neg(@y)) -> #GT()
, #compare(#0(), #s(@y)) -> #LT()
, #compare(#neg(@x), #pos(@y)) -> #LT()
, #compare(#neg(@x), #0()) -> #LT()
, #compare(#neg(@x), #neg(@y)) -> #compare(@y, @x)
, #compare(#s(@x), #0()) -> #GT()
, #compare(#s(@x), #s(@y)) -> #compare(@x, @y)
, lcstable#1(nil(), @l2) -> ::(firstline(@l2), nil())
, lcstable#1(::(@x, @xs), @l2) ->
lcstable#2(lcstable(@xs, @l2), @l2, @x)
, #greater(@x, @y) -> #ckgt(#compare(@x, @y))
, newline(@y, @lastline, @l) -> newline#1(@l, @lastline, @y)
, newline#4(@rightVal, @belowVal, @lastline', @nl, @x, @y) ->
newline#5(right(@lastline'), @belowVal, @nl, @rightVal, @x, @y)
, max(@a, @b) -> max#1(#greater(@a, @b), @a, @b)
, right(@l) -> right#1(@l)
, max#1(#true(), @a, @b) -> @a
, max#1(#false(), @a, @b) -> @b
, +(@x, @y) -> #add(@x, @y)
, #succ(#pos(#s(@x))) -> #pos(#s(#s(@x)))
, #succ(#0()) -> #pos(#s(#0()))
, #succ(#neg(#s(#0()))) -> #0()
, #succ(#neg(#s(#s(@x)))) -> #neg(#s(@x))
, newline#3(@nl, @belowVal, @lastline', @x, @y) ->
newline#4(right(@nl), @belowVal, @lastline', @nl, @x, @y)
, #abs(#pos(@x)) -> #pos(@x)
, #abs(#0()) -> #0()
, #abs(#neg(@x)) -> #pos(@x)
, #abs(#s(@x)) -> #pos(#s(@x))
, lcstable#2(@m, @l2, @x) -> lcstable#3(@m, @l2, @x)
, #pred(#pos(#s(#0()))) -> #0()
, #pred(#pos(#s(#s(@x)))) -> #pos(#s(@x))
, #pred(#0()) -> #neg(#s(#0()))
, #pred(#neg(#s(@x))) -> #neg(#s(#s(@x)))
, newline#6(@elem, @nl) -> ::(@elem, @nl)
, newline#1(nil(), @lastline, @y) -> nil()
, newline#1(::(@x, @xs), @lastline, @y) ->
newline#2(@lastline, @x, @xs, @y) }
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(1))
No rule is usable, rules are removed from the input problem.
We are left with following problem, upon which TcT provides the
certificate YES(O(1),O(1)).
Rules: Empty
Obligation:
innermost runtime complexity
Answer:
YES(O(1),O(1))
Empty rules are trivially bounded
Hurray, we answered YES(O(1),O(n^2))