Runtime Complexity TRS:
The TRS R consists of the following rules:
prime(0) → false
prime(s(0)) → false
prime(s(s(x))) → prime1(s(s(x)), s(x))
prime1(x, 0) → false
prime1(x, s(0)) → true
prime1(x, s(s(y))) → and(not(divp(s(s(y)), x)), prime1(x, s(y)))
divp(x, y) → =(rem(x, y), 0)
Renamed function symbols to avoid clashes with predefined symbol.
Runtime Complexity TRS:
The TRS R consists of the following rules:
prime'(0') → false'
prime'(s'(0')) → false'
prime'(s'(s'(x))) → prime1'(s'(s'(x)), s'(x))
prime1'(x, 0') → false'
prime1'(x, s'(0')) → true'
prime1'(x, s'(s'(y))) → and'(not'(divp'(s'(s'(y)), x)), prime1'(x, s'(y)))
divp'(x, y) → ='(rem'(x, y), 0')
Sliced the following arguments:
prime1'/0
divp'/0
divp'/1
='/0
='/1
rem'/0
rem'/1
Runtime Complexity TRS:
The TRS R consists of the following rules:
prime'(0') → false'
prime'(s'(0')) → false'
prime'(s'(s'(x))) → prime1'(s'(x))
prime1'(0') → false'
prime1'(s'(0')) → true'
prime1'(s'(s'(y))) → and'(not'(divp'), prime1'(s'(y)))
divp' → ='
Infered types.
Rules:
prime'(0') → false'
prime'(s'(0')) → false'
prime'(s'(s'(x))) → prime1'(s'(x))
prime1'(0') → false'
prime1'(s'(0')) → true'
prime1'(s'(s'(y))) → and'(not'(divp'), prime1'(s'(y)))
divp' → ='
Types:
prime' :: 0':s' → false':true':and'
0' :: 0':s'
false' :: false':true':and'
s' :: 0':s' → 0':s'
prime1' :: 0':s' → false':true':and'
true' :: false':true':and'
and' :: not' → false':true':and' → false':true':and'
not' :: =' → not'
divp' :: ='
=' :: ='
_hole_false':true':and'1 :: false':true':and'
_hole_0':s'2 :: 0':s'
_hole_not'3 :: not'
_hole_='4 :: ='
_gen_false':true':and'5 :: Nat → false':true':and'
_gen_0':s'6 :: Nat → 0':s'
Heuristically decided to analyse the following defined symbols:
prime1'
Rules:
prime'(0') → false'
prime'(s'(0')) → false'
prime'(s'(s'(x))) → prime1'(s'(x))
prime1'(0') → false'
prime1'(s'(0')) → true'
prime1'(s'(s'(y))) → and'(not'(divp'), prime1'(s'(y)))
divp' → ='
Types:
prime' :: 0':s' → false':true':and'
0' :: 0':s'
false' :: false':true':and'
s' :: 0':s' → 0':s'
prime1' :: 0':s' → false':true':and'
true' :: false':true':and'
and' :: not' → false':true':and' → false':true':and'
not' :: =' → not'
divp' :: ='
=' :: ='
_hole_false':true':and'1 :: false':true':and'
_hole_0':s'2 :: 0':s'
_hole_not'3 :: not'
_hole_='4 :: ='
_gen_false':true':and'5 :: Nat → false':true':and'
_gen_0':s'6 :: Nat → 0':s'
Generator Equations:
_gen_false':true':and'5(0) ⇔ false'
_gen_false':true':and'5(+(x, 1)) ⇔ and'(not'(='), _gen_false':true':and'5(x))
_gen_0':s'6(0) ⇔ 0'
_gen_0':s'6(+(x, 1)) ⇔ s'(_gen_0':s'6(x))
The following defined symbols remain to be analysed:
prime1'
Proved the following rewrite lemma:
prime1'(_gen_0':s'6(+(1, _n8))) → _*7, rt ∈ Ω(n8)
Induction Base:
prime1'(_gen_0':s'6(+(1, 0)))
Induction Step:
prime1'(_gen_0':s'6(+(1, +(_$n9, 1)))) →RΩ(1)
and'(not'(divp'), prime1'(s'(_gen_0':s'6(_$n9)))) →RΩ(1)
and'(not'(='), prime1'(s'(_gen_0':s'6(_$n9)))) →IH
and'(not'(='), _*7)
We have rt ∈ Ω(n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
Rules:
prime'(0') → false'
prime'(s'(0')) → false'
prime'(s'(s'(x))) → prime1'(s'(x))
prime1'(0') → false'
prime1'(s'(0')) → true'
prime1'(s'(s'(y))) → and'(not'(divp'), prime1'(s'(y)))
divp' → ='
Types:
prime' :: 0':s' → false':true':and'
0' :: 0':s'
false' :: false':true':and'
s' :: 0':s' → 0':s'
prime1' :: 0':s' → false':true':and'
true' :: false':true':and'
and' :: not' → false':true':and' → false':true':and'
not' :: =' → not'
divp' :: ='
=' :: ='
_hole_false':true':and'1 :: false':true':and'
_hole_0':s'2 :: 0':s'
_hole_not'3 :: not'
_hole_='4 :: ='
_gen_false':true':and'5 :: Nat → false':true':and'
_gen_0':s'6 :: Nat → 0':s'
Lemmas:
prime1'(_gen_0':s'6(+(1, _n8))) → _*7, rt ∈ Ω(n8)
Generator Equations:
_gen_false':true':and'5(0) ⇔ false'
_gen_false':true':and'5(+(x, 1)) ⇔ and'(not'(='), _gen_false':true':and'5(x))
_gen_0':s'6(0) ⇔ 0'
_gen_0':s'6(+(x, 1)) ⇔ s'(_gen_0':s'6(x))
No more defined symbols left to analyse.
The lowerbound Ω(n) was proven with the following lemma:
prime1'(_gen_0':s'6(+(1, _n8))) → _*7, rt ∈ Ω(n8)