(VAR N X Y Z)
(STRATEGY CONTEXTSENSITIVE 
  (terms 1)
  (cons 1)
  (recip 1)
  (sqr 1)
  (s 1)
  (0)
  (add 1 2)
  (dbl 1)
  (first 1 2)
  (nil)
)
(RULES 
terms(N) -> cons(recip(sqr(N)),terms(s(N)))
sqr(0) -> 0
sqr(s(X)) -> s(add(sqr(X),dbl(X)))
dbl(0) -> 0
dbl(s(X)) -> s(s(dbl(X)))
add(0,X) -> X
add(s(X),Y) -> s(add(X,Y))
first(0,X) -> nil
first(s(X),cons(Y,Z)) -> cons(Y,first(X,Z))
)

The TRS is orthogonal, thus termination of innermost context-sensitive rewriting is equivalent to termination of context-sensitive rewriting.

Proving termination of context-sensitive rewriting for Ex2_Luc02a:

-> Dependency pairs:
nF_terms(N) -> nF_sqr(N)
nF_sqr(s(X)) -> nF_add(sqr(X),dbl(X))
nF_sqr(s(X)) -> nF_sqr(X)
nF_sqr(s(X)) -> nF_dbl(X)
nF_dbl(s(X)) -> nF_dbl(X)
nF_add(s(X),Y) -> nF_add(X,Y)

-> Proof of termination for Ex2_Luc02a_1_1:
-> -> Dependency pairs in cycle:
nF_sqr(s(X)) -> nF_sqr(X)

Termination proved: Cycles verify subterm criterion.

-> Proof of termination for Ex2_Luc02a_1_2:
-> -> Dependency pairs in cycle:
nF_add(s(X),Y) -> nF_add(X,Y)

Termination proved: Cycles verify subterm criterion.

-> Proof of termination for Ex2_Luc02a_1_3:
-> -> Dependency pairs in cycle:
nF_dbl(s(X)) -> nF_dbl(X)

Termination proved: Cycles verify subterm criterion.

SETTINGS:
Base ordering: Polynomial ordering
Proof mode: SCCs in CSDG + base ordering
Upper bound for coeffs: 1
Rationals below 1 for all non-replacing args: No
Polynomial interpretation: Linear
Coeffs in polynomials: No rationals
Delta: automatic



Termination was proved succesfully.