Runtime Complexity TRS:
The TRS R consists of the following rules:

gcd(x, y) → gcd2(x, y, 0)
gcd2(x, y, i) → if1(le(x, 0), le(y, 0), le(x, y), le(y, x), x, y, inc(i))
if1(true, b1, b2, b3, x, y, i) → pair(result(y), neededIterations(i))
if1(false, b1, b2, b3, x, y, i) → if2(b1, b2, b3, x, y, i)
if2(true, b2, b3, x, y, i) → pair(result(x), neededIterations(i))
if2(false, b2, b3, x, y, i) → if3(b2, b3, x, y, i)
if3(false, b3, x, y, i) → gcd2(minus(x, y), y, i)
if3(true, b3, x, y, i) → if4(b3, x, y, i)
if4(false, x, y, i) → gcd2(x, minus(y, x), i)
if4(true, x, y, i) → pair(result(x), neededIterations(i))
inc(0) → 0
inc(s(i)) → s(inc(i))
le(s(x), 0) → false
le(0, y) → true
le(s(x), s(y)) → le(x, y)
minus(x, 0) → x
minus(0, y) → 0
minus(s(x), s(y)) → minus(x, y)
ab
ac

Rewrite Strategy: INNERMOST


Renamed function symbols to avoid clashes with predefined symbol.


Runtime Complexity TRS:
The TRS R consists of the following rules:


gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'(result'(y), neededIterations'(i))
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'(result'(x), neededIterations'(i))
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'(result'(x), neededIterations'(i))
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Rewrite Strategy: INNERMOST


Sliced the following arguments:
pair'/0
pair'/1
result'/0
neededIterations'/0


Runtime Complexity TRS:
The TRS R consists of the following rules:


gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Rewrite Strategy: INNERMOST


Infered types.


Rules:
gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Types:
gcd' :: 0':s' → 0':s' → pair'
gcd2' :: 0':s' → 0':s' → 0':s' → pair'
0' :: 0':s'
if1' :: true':false' → true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
le' :: 0':s' → 0':s' → true':false'
inc' :: 0':s' → 0':s'
true' :: true':false'
pair' :: pair'
false' :: true':false'
if2' :: true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
if3' :: true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
minus' :: 0':s' → 0':s' → 0':s'
if4' :: true':false' → 0':s' → 0':s' → 0':s' → pair'
s' :: 0':s' → 0':s'
a' :: b':c'
b' :: b':c'
c' :: b':c'
_hole_pair'1 :: pair'
_hole_0':s'2 :: 0':s'
_hole_true':false'3 :: true':false'
_hole_b':c'4 :: b':c'
_gen_0':s'5 :: Nat → 0':s'


Heuristically decided to analyse the following defined symbols:
gcd2', le', inc', minus'

They will be analysed ascendingly in the following order:
le' < gcd2'
inc' < gcd2'
minus' < gcd2'


Rules:
gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Types:
gcd' :: 0':s' → 0':s' → pair'
gcd2' :: 0':s' → 0':s' → 0':s' → pair'
0' :: 0':s'
if1' :: true':false' → true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
le' :: 0':s' → 0':s' → true':false'
inc' :: 0':s' → 0':s'
true' :: true':false'
pair' :: pair'
false' :: true':false'
if2' :: true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
if3' :: true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
minus' :: 0':s' → 0':s' → 0':s'
if4' :: true':false' → 0':s' → 0':s' → 0':s' → pair'
s' :: 0':s' → 0':s'
a' :: b':c'
b' :: b':c'
c' :: b':c'
_hole_pair'1 :: pair'
_hole_0':s'2 :: 0':s'
_hole_true':false'3 :: true':false'
_hole_b':c'4 :: b':c'
_gen_0':s'5 :: Nat → 0':s'

Generator Equations:
_gen_0':s'5(0) ⇔ 0'
_gen_0':s'5(+(x, 1)) ⇔ s'(_gen_0':s'5(x))

The following defined symbols remain to be analysed:
le', gcd2', inc', minus'

They will be analysed ascendingly in the following order:
le' < gcd2'
inc' < gcd2'
minus' < gcd2'


Proved the following rewrite lemma:
le'(_gen_0':s'5(+(1, _n7)), _gen_0':s'5(_n7)) → false', rt ∈ Ω(1 + n7)

Induction Base:
le'(_gen_0':s'5(+(1, 0)), _gen_0':s'5(0)) →RΩ(1)
false'

Induction Step:
le'(_gen_0':s'5(+(1, +(_$n8, 1))), _gen_0':s'5(+(_$n8, 1))) →RΩ(1)
le'(_gen_0':s'5(+(1, _$n8)), _gen_0':s'5(_$n8)) →IH
false'

We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).


Rules:
gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Types:
gcd' :: 0':s' → 0':s' → pair'
gcd2' :: 0':s' → 0':s' → 0':s' → pair'
0' :: 0':s'
if1' :: true':false' → true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
le' :: 0':s' → 0':s' → true':false'
inc' :: 0':s' → 0':s'
true' :: true':false'
pair' :: pair'
false' :: true':false'
if2' :: true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
if3' :: true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
minus' :: 0':s' → 0':s' → 0':s'
if4' :: true':false' → 0':s' → 0':s' → 0':s' → pair'
s' :: 0':s' → 0':s'
a' :: b':c'
b' :: b':c'
c' :: b':c'
_hole_pair'1 :: pair'
_hole_0':s'2 :: 0':s'
_hole_true':false'3 :: true':false'
_hole_b':c'4 :: b':c'
_gen_0':s'5 :: Nat → 0':s'

Lemmas:
le'(_gen_0':s'5(+(1, _n7)), _gen_0':s'5(_n7)) → false', rt ∈ Ω(1 + n7)

Generator Equations:
_gen_0':s'5(0) ⇔ 0'
_gen_0':s'5(+(x, 1)) ⇔ s'(_gen_0':s'5(x))

The following defined symbols remain to be analysed:
inc', gcd2', minus'

They will be analysed ascendingly in the following order:
inc' < gcd2'
minus' < gcd2'


Proved the following rewrite lemma:
inc'(_gen_0':s'5(_n1618)) → _gen_0':s'5(_n1618), rt ∈ Ω(1 + n1618)

Induction Base:
inc'(_gen_0':s'5(0)) →RΩ(1)
0'

Induction Step:
inc'(_gen_0':s'5(+(_$n1619, 1))) →RΩ(1)
s'(inc'(_gen_0':s'5(_$n1619))) →IH
s'(_gen_0':s'5(_$n1619))

We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).


Rules:
gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Types:
gcd' :: 0':s' → 0':s' → pair'
gcd2' :: 0':s' → 0':s' → 0':s' → pair'
0' :: 0':s'
if1' :: true':false' → true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
le' :: 0':s' → 0':s' → true':false'
inc' :: 0':s' → 0':s'
true' :: true':false'
pair' :: pair'
false' :: true':false'
if2' :: true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
if3' :: true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
minus' :: 0':s' → 0':s' → 0':s'
if4' :: true':false' → 0':s' → 0':s' → 0':s' → pair'
s' :: 0':s' → 0':s'
a' :: b':c'
b' :: b':c'
c' :: b':c'
_hole_pair'1 :: pair'
_hole_0':s'2 :: 0':s'
_hole_true':false'3 :: true':false'
_hole_b':c'4 :: b':c'
_gen_0':s'5 :: Nat → 0':s'

Lemmas:
le'(_gen_0':s'5(+(1, _n7)), _gen_0':s'5(_n7)) → false', rt ∈ Ω(1 + n7)
inc'(_gen_0':s'5(_n1618)) → _gen_0':s'5(_n1618), rt ∈ Ω(1 + n1618)

Generator Equations:
_gen_0':s'5(0) ⇔ 0'
_gen_0':s'5(+(x, 1)) ⇔ s'(_gen_0':s'5(x))

The following defined symbols remain to be analysed:
minus', gcd2'

They will be analysed ascendingly in the following order:
minus' < gcd2'


Proved the following rewrite lemma:
minus'(_gen_0':s'5(_n2566), _gen_0':s'5(_n2566)) → _gen_0':s'5(0), rt ∈ Ω(1 + n2566)

Induction Base:
minus'(_gen_0':s'5(0), _gen_0':s'5(0)) →RΩ(1)
_gen_0':s'5(0)

Induction Step:
minus'(_gen_0':s'5(+(_$n2567, 1)), _gen_0':s'5(+(_$n2567, 1))) →RΩ(1)
minus'(_gen_0':s'5(_$n2567), _gen_0':s'5(_$n2567)) →IH
_gen_0':s'5(0)

We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).


Rules:
gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Types:
gcd' :: 0':s' → 0':s' → pair'
gcd2' :: 0':s' → 0':s' → 0':s' → pair'
0' :: 0':s'
if1' :: true':false' → true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
le' :: 0':s' → 0':s' → true':false'
inc' :: 0':s' → 0':s'
true' :: true':false'
pair' :: pair'
false' :: true':false'
if2' :: true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
if3' :: true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
minus' :: 0':s' → 0':s' → 0':s'
if4' :: true':false' → 0':s' → 0':s' → 0':s' → pair'
s' :: 0':s' → 0':s'
a' :: b':c'
b' :: b':c'
c' :: b':c'
_hole_pair'1 :: pair'
_hole_0':s'2 :: 0':s'
_hole_true':false'3 :: true':false'
_hole_b':c'4 :: b':c'
_gen_0':s'5 :: Nat → 0':s'

Lemmas:
le'(_gen_0':s'5(+(1, _n7)), _gen_0':s'5(_n7)) → false', rt ∈ Ω(1 + n7)
inc'(_gen_0':s'5(_n1618)) → _gen_0':s'5(_n1618), rt ∈ Ω(1 + n1618)
minus'(_gen_0':s'5(_n2566), _gen_0':s'5(_n2566)) → _gen_0':s'5(0), rt ∈ Ω(1 + n2566)

Generator Equations:
_gen_0':s'5(0) ⇔ 0'
_gen_0':s'5(+(x, 1)) ⇔ s'(_gen_0':s'5(x))

The following defined symbols remain to be analysed:
gcd2'


Could not prove a rewrite lemma for the defined symbol gcd2'.


Rules:
gcd'(x, y) → gcd2'(x, y, 0')
gcd2'(x, y, i) → if1'(le'(x, 0'), le'(y, 0'), le'(x, y), le'(y, x), x, y, inc'(i))
if1'(true', b1, b2, b3, x, y, i) → pair'
if1'(false', b1, b2, b3, x, y, i) → if2'(b1, b2, b3, x, y, i)
if2'(true', b2, b3, x, y, i) → pair'
if2'(false', b2, b3, x, y, i) → if3'(b2, b3, x, y, i)
if3'(false', b3, x, y, i) → gcd2'(minus'(x, y), y, i)
if3'(true', b3, x, y, i) → if4'(b3, x, y, i)
if4'(false', x, y, i) → gcd2'(x, minus'(y, x), i)
if4'(true', x, y, i) → pair'
inc'(0') → 0'
inc'(s'(i)) → s'(inc'(i))
le'(s'(x), 0') → false'
le'(0', y) → true'
le'(s'(x), s'(y)) → le'(x, y)
minus'(x, 0') → x
minus'(0', y) → 0'
minus'(s'(x), s'(y)) → minus'(x, y)
a'b'
a'c'

Types:
gcd' :: 0':s' → 0':s' → pair'
gcd2' :: 0':s' → 0':s' → 0':s' → pair'
0' :: 0':s'
if1' :: true':false' → true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
le' :: 0':s' → 0':s' → true':false'
inc' :: 0':s' → 0':s'
true' :: true':false'
pair' :: pair'
false' :: true':false'
if2' :: true':false' → true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
if3' :: true':false' → true':false' → 0':s' → 0':s' → 0':s' → pair'
minus' :: 0':s' → 0':s' → 0':s'
if4' :: true':false' → 0':s' → 0':s' → 0':s' → pair'
s' :: 0':s' → 0':s'
a' :: b':c'
b' :: b':c'
c' :: b':c'
_hole_pair'1 :: pair'
_hole_0':s'2 :: 0':s'
_hole_true':false'3 :: true':false'
_hole_b':c'4 :: b':c'
_gen_0':s'5 :: Nat → 0':s'

Lemmas:
le'(_gen_0':s'5(+(1, _n7)), _gen_0':s'5(_n7)) → false', rt ∈ Ω(1 + n7)
inc'(_gen_0':s'5(_n1618)) → _gen_0':s'5(_n1618), rt ∈ Ω(1 + n1618)
minus'(_gen_0':s'5(_n2566), _gen_0':s'5(_n2566)) → _gen_0':s'5(0), rt ∈ Ω(1 + n2566)

Generator Equations:
_gen_0':s'5(0) ⇔ 0'
_gen_0':s'5(+(x, 1)) ⇔ s'(_gen_0':s'5(x))

No more defined symbols left to analyse.


The lowerbound Ω(n) was proven with the following lemma:
le'(_gen_0':s'5(+(1, _n7)), _gen_0':s'5(_n7)) → false', rt ∈ Ω(1 + n7)