YES

We show the termination of the TRS R:

  f(|0|()) -> true()
  f(|1|()) -> false()
  f(s(x)) -> f(x)
  if(true(),s(x),s(y)) -> s(x)
  if(false(),s(x),s(y)) -> s(y)
  g(x,c(y)) -> c(g(x,y))
  g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y)))

-- SCC decomposition.

Consider the dependency pair problem (P, R), where P consists of

p1: f#(s(x)) -> f#(x)
p2: g#(x,c(y)) -> g#(x,y)
p3: g#(x,c(y)) -> g#(x,if(f(x),c(g(s(x),y)),c(y)))
p4: g#(x,c(y)) -> if#(f(x),c(g(s(x),y)),c(y))
p5: g#(x,c(y)) -> f#(x)
p6: g#(x,c(y)) -> g#(s(x),y)

and R consists of:

r1: f(|0|()) -> true()
r2: f(|1|()) -> false()
r3: f(s(x)) -> f(x)
r4: if(true(),s(x),s(y)) -> s(x)
r5: if(false(),s(x),s(y)) -> s(y)
r6: g(x,c(y)) -> c(g(x,y))
r7: g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y)))

The estimated dependency graph contains the following SCCs:

  {p2, p6}
  {p1}


-- Reduction pair.

Consider the dependency pair problem (P, R), where P consists of

p1: g#(x,c(y)) -> g#(s(x),y)
p2: g#(x,c(y)) -> g#(x,y)

and R consists of:

r1: f(|0|()) -> true()
r2: f(|1|()) -> false()
r3: f(s(x)) -> f(x)
r4: if(true(),s(x),s(y)) -> s(x)
r5: if(false(),s(x),s(y)) -> s(y)
r6: g(x,c(y)) -> c(g(x,y))
r7: g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y)))

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  matrix interpretations:
  
    carrier: N^2
    order: standard order
    interpretations:
      g#_A(x1,x2) = ((0,1),(0,1)) x1 + ((1,1),(1,1)) x2
      c_A(x1) = ((1,1),(1,1)) x1 + (1,1)
      s_A(x1) = ((1,1),(0,1)) x1 + (1,2)

The next rules are strictly ordered:

  p2

We remove them from the problem.

-- SCC decomposition.

Consider the dependency pair problem (P, R), where P consists of

p1: g#(x,c(y)) -> g#(s(x),y)

and R consists of:

r1: f(|0|()) -> true()
r2: f(|1|()) -> false()
r3: f(s(x)) -> f(x)
r4: if(true(),s(x),s(y)) -> s(x)
r5: if(false(),s(x),s(y)) -> s(y)
r6: g(x,c(y)) -> c(g(x,y))
r7: g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y)))

The estimated dependency graph contains the following SCCs:

  {p1}


-- Reduction pair.

Consider the dependency pair problem (P, R), where P consists of

p1: g#(x,c(y)) -> g#(s(x),y)

and R consists of:

r1: f(|0|()) -> true()
r2: f(|1|()) -> false()
r3: f(s(x)) -> f(x)
r4: if(true(),s(x),s(y)) -> s(x)
r5: if(false(),s(x),s(y)) -> s(y)
r6: g(x,c(y)) -> c(g(x,y))
r7: g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y)))

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  matrix interpretations:
  
    carrier: N^2
    order: standard order
    interpretations:
      g#_A(x1,x2) = x1 + ((1,1),(1,1)) x2
      c_A(x1) = ((1,1),(1,1)) x1 + (1,0)
      s_A(x1) = ((1,1),(0,1)) x1

The next rules are strictly ordered:

  p1

We remove them from the problem.  Then no dependency pair remains.

-- Reduction pair.

Consider the dependency pair problem (P, R), where P consists of

p1: f#(s(x)) -> f#(x)

and R consists of:

r1: f(|0|()) -> true()
r2: f(|1|()) -> false()
r3: f(s(x)) -> f(x)
r4: if(true(),s(x),s(y)) -> s(x)
r5: if(false(),s(x),s(y)) -> s(y)
r6: g(x,c(y)) -> c(g(x,y))
r7: g(x,c(y)) -> g(x,if(f(x),c(g(s(x),y)),c(y)))

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  matrix interpretations:
  
    carrier: N^2
    order: standard order
    interpretations:
      f#_A(x1) = ((1,0),(1,0)) x1
      s_A(x1) = ((1,1),(1,1)) x1 + (1,0)

The next rules are strictly ordered:

  p1
  r1, r2, r3, r4, r5, r6, r7

We remove them from the problem.  Then no dependency pair remains.