YES

We show the termination of the TRS R:

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

-- SCC decomposition.

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

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

and R consists of:

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

The estimated dependency graph contains the following SCCs:

  {p4, p5}
  {p1}


-- Reduction pair.

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

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

and R consists of:

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

The set of usable rules consists of

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

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        g#_A(x1,x2) = x1 + x2
        c_A(x1) = x1 + 5
        s_A(x1) = 1
        g_A(x1,x2) = 4
        f_A(x1) = 2
        |0|_A() = 1
        true_A() = 1
        |1|_A() = 1
        false_A() = 1
        if_A(x1,x2,x3) = x2 + x3 + 1
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        |0| > true > if > false > |1| > f > c > g# > s > g
      
      argument filter:
    
        pi(g#) = [1, 2]
        pi(c) = [1]
        pi(s) = []
        pi(g) = []
        pi(f) = []
        pi(|0|) = []
        pi(true) = []
        pi(|1|) = []
        pi(false) = []
        pi(if) = [2, 3]
    

The next rules are strictly ordered:

  p1, p2

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(),x,y) -> x
r5: if(false(),x,y) -> y
r6: g(s(x),s(y)) -> if(f(x),s(x),s(y))
r7: g(x,c(y)) -> g(x,g(s(c(y)),y))

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

  lexicographic combination of reduction pairs:
  
    1. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        f#_A(x1) = x1
        s_A(x1) = x1 + 1
    
    2. lexicographic path order with precedence:
    
      precedence:
      
        s > f#
      
      argument filter:
    
        pi(f#) = 1
        pi(s) = [1]
    

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.