Certification Problem

Input (TPDB Runtime_Complexity_Innermost_Rewriting/AG01/#3.48)

The rewrite relation of the following TRS is considered.

f(0) → true (1)
f(1) → false (2)
f(s(x)) → f(x) (3)
if(true,s(x),s(y)) → s(x) (4)
if(false,s(x),s(y)) → s(y) (5)
g(x,c(y)) → c(g(x,y)) (6)
g(x,c(y)) → g(x,if(f(x),c(g(s(x),y)),c(y))) (7)
The evaluation strategy is innermost.

Property / Task

Determine bounds on the runtime complexity.

Answer / Result

An upperbound for the complexity is O(n2).

Proof (by AProVE @ termCOMP 2023)

1 Dependency Tuples

We get the following set of dependency tuples:
f#(0) → c1 (8)
originates from
f(0) → true (1)
f#(1) → c2 (9)
originates from
f(1) → false (2)
f#(s(z0)) → c3(f#(z0)) (11)
originates from
f(s(z0)) → f(z0) (10)
if#(true,s(z0),s(z1)) → c4 (13)
originates from
if(true,s(z0),s(z1)) → s(z0) (12)
if#(false,s(z0),s(z1)) → c5 (15)
originates from
if(false,s(z0),s(z1)) → s(z1) (14)
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
originates from
g(z0,c(z1)) → c(g(z0,z1)) (16)
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)
originates from
g(z0,c(z1)) → g(z0,if(f(z0),c(g(s(z0),z1)),c(z1))) (18)
Moreover, we add the following terms to the innermost strategy.
f#(0)
f#(1)
f#(s(z0))
if#(true,s(z0),s(z1))
if#(false,s(z0),s(z1))
g#(z0,c(z1))
g#(z0,c(z1))

1.1 Usable Rules

We remove the following rules since they are not usable.
if(true,s(z0),s(z1)) → s(z0) (12)
if(false,s(z0),s(z1)) → s(z1) (14)

1.1.1 Rule Shifting

The rules
if#(true,s(z0),s(z1)) → c4 (13)
if#(false,s(z0),s(z1)) → c5 (15)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c1] = 0
[c2] = 0
[c3(x1)] = 1 · x1 + 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[c7(x1,...,x4)] = 1 · x1 + 0 + 1 · x2 + 1 · x3 + 1 · x4
[f(x1)] = 0
[g(x1, x2)] = 0
[f#(x1)] = 0
[if#(x1, x2, x3)] = 1 · x3 + 0
[g#(x1, x2)] = 0
[0] = 1
[true] = 1
[1] = 1
[false] = 1
[s(x1)] = 1 + 1 · x1
[c(x1)] = 0
[if(x1, x2, x3)] = 1 + 1 · x1 + 1 · x3
which has the intended complexity. Here, only the following usable rules have been considered:
f#(0) → c1 (8)
f#(1) → c2 (9)
f#(s(z0)) → c3(f#(z0)) (11)
if#(true,s(z0),s(z1)) → c4 (13)
if#(false,s(z0),s(z1)) → c5 (15)
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)

1.1.1.1 Rule Shifting

The rules
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c1] = 0
[c2] = 0
[c3(x1)] = 1 · x1 + 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[c7(x1,...,x4)] = 1 · x1 + 0 + 1 · x2 + 1 · x3 + 1 · x4
[f(x1)] = 0
[g(x1, x2)] = 1 + 1 · x1 + 1 · x2
[f#(x1)] = 0
[if#(x1, x2, x3)] = 1 · x1 + 0
[g#(x1, x2)] = 1 · x2 + 0
[0] = 1
[true] = 0
[1] = 1
[false] = 0
[s(x1)] = 1 + 1 · x1
[c(x1)] = 1 + 1 · x1
[if(x1, x2, x3)] = 1 + 1 · x1
which has the intended complexity. Here, only the following usable rules have been considered:
f#(0) → c1 (8)
f#(1) → c2 (9)
f#(s(z0)) → c3(f#(z0)) (11)
if#(true,s(z0),s(z1)) → c4 (13)
if#(false,s(z0),s(z1)) → c5 (15)
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)
f(1) → false (2)
f(0) → true (1)
f(s(z0)) → f(z0) (10)

1.1.1.1.1 Rule Shifting

The rules
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c1] = 0
[c2] = 0
[c3(x1)] = 1 · x1 + 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[c7(x1,...,x4)] = 1 · x1 + 0 + 1 · x2 + 1 · x3 + 1 · x4
[f(x1)] = 0
[g(x1, x2)] = 1 + 1 · x1 + 1 · x2
[f#(x1)] = 0
[if#(x1, x2, x3)] = 1 · x1 + 0
[g#(x1, x2)] = 1 · x2 + 0
[0] = 1
[true] = 0
[1] = 1
[false] = 0
[s(x1)] = 1 + 1 · x1
[c(x1)] = 1 + 1 · x1
[if(x1, x2, x3)] = 1 · x1 + 0
which has the intended complexity. Here, only the following usable rules have been considered:
f#(0) → c1 (8)
f#(1) → c2 (9)
f#(s(z0)) → c3(f#(z0)) (11)
if#(true,s(z0),s(z1)) → c4 (13)
if#(false,s(z0),s(z1)) → c5 (15)
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)
f(1) → false (2)
f(0) → true (1)
f(s(z0)) → f(z0) (10)

1.1.1.1.1.1 Rule Shifting

The rules
f#(0) → c1 (8)
f#(1) → c2 (9)
are strictly oriented by the following linear polynomial interpretation over the naturals
[c1] = 0
[c2] = 0
[c3(x1)] = 1 · x1 + 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[c7(x1,...,x4)] = 1 · x1 + 0 + 1 · x2 + 1 · x3 + 1 · x4
[f(x1)] = 0
[g(x1, x2)] = 1 · x1 + 0
[f#(x1)] = 1
[if#(x1, x2, x3)] = 1 · x1 + 0
[g#(x1, x2)] = 1 · x2 + 0
[0] = 1
[true] = 0
[1] = 1
[false] = 0
[s(x1)] = 1 + 1 · x1
[c(x1)] = 1 + 1 · x1
[if(x1, x2, x3)] = 1 · x1 + 0
which has the intended complexity. Here, only the following usable rules have been considered:
f#(0) → c1 (8)
f#(1) → c2 (9)
f#(s(z0)) → c3(f#(z0)) (11)
if#(true,s(z0),s(z1)) → c4 (13)
if#(false,s(z0),s(z1)) → c5 (15)
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)
f(1) → false (2)
f(0) → true (1)
f(s(z0)) → f(z0) (10)

1.1.1.1.1.1.1 Rule Shifting

The rules
f#(s(z0)) → c3(f#(z0)) (11)
are strictly oriented by the following non-linear polynomial interpretation over the naturals
[c1] = 0
[c2] = 0
[c3(x1)] = 1 · x1 + 0
[c4] = 0
[c5] = 0
[c6(x1)] = 1 · x1 + 0
[c7(x1,...,x4)] = 1 · x1 + 0 + 1 · x2 + 1 · x3 + 1 · x4
[f(x1)] = 0
[g(x1, x2)] = 2 + 1 · x2 + 1 · x2 · x2 + 2 · x1 · x2
[f#(x1)] = 2 · x1 + 0
[if#(x1, x2, x3)] = 1
[g#(x1, x2)] = 1 + 2 · x1 + 1 · x2 · x2 + 2 · x1 · x2
[0] = 2
[true] = 1
[1] = 1
[false] = 1
[s(x1)] = 1 + 1 · x1
[c(x1)] = 2 + 1 · x1
[if(x1, x2, x3)] = 0
which has the intended complexity. Here, only the following usable rules have been considered:
f#(0) → c1 (8)
f#(1) → c2 (9)
f#(s(z0)) → c3(f#(z0)) (11)
if#(true,s(z0),s(z1)) → c4 (13)
if#(false,s(z0),s(z1)) → c5 (15)
g#(z0,c(z1)) → c6(g#(z0,z1)) (17)
g#(z0,c(z1)) → c7(g#(z0,if(f(z0),c(g(s(z0),z1)),c(z1))),if#(f(z0),c(g(s(z0),z1)),c(z1)),f#(z0),g#(s(z0),z1)) (19)

1.1.1.1.1.1.1.1 R is empty

There are no rules in the TRS R. Hence, R/S has complexity O(1).