YES

We show the termination of the TRS R:

  and(false(),false()) -> false()
  and(true(),false()) -> false()
  and(false(),true()) -> false()
  and(true(),true()) -> true()
  eq(nil(),nil()) -> true()
  eq(cons(T,L),nil()) -> false()
  eq(nil(),cons(T,L)) -> false()
  eq(cons(T,L),cons(Tp,Lp)) -> and(eq(T,Tp),eq(L,Lp))
  eq(var(L),var(Lp)) -> eq(L,Lp)
  eq(var(L),apply(T,S)) -> false()
  eq(var(L),lambda(X,T)) -> false()
  eq(apply(T,S),var(L)) -> false()
  eq(apply(T,S),apply(Tp,Sp)) -> and(eq(T,Tp),eq(S,Sp))
  eq(apply(T,S),lambda(X,Tp)) -> false()
  eq(lambda(X,T),var(L)) -> false()
  eq(lambda(X,T),apply(Tp,Sp)) -> false()
  eq(lambda(X,T),lambda(Xp,Tp)) -> and(eq(T,Tp),eq(X,Xp))
  if(true(),var(K),var(L)) -> var(K)
  if(false(),var(K),var(L)) -> var(L)
  ren(var(L),var(K),var(Lp)) -> if(eq(L,Lp),var(K),var(Lp))
  ren(X,Y,apply(T,S)) -> apply(ren(X,Y,T),ren(X,Y,S))
  ren(X,Y,lambda(Z,T)) -> lambda(var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),ren(X,Y,ren(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T)))

-- SCC decomposition.

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

p1: eq#(cons(T,L),cons(Tp,Lp)) -> and#(eq(T,Tp),eq(L,Lp))
p2: eq#(cons(T,L),cons(Tp,Lp)) -> eq#(T,Tp)
p3: eq#(cons(T,L),cons(Tp,Lp)) -> eq#(L,Lp)
p4: eq#(var(L),var(Lp)) -> eq#(L,Lp)
p5: eq#(apply(T,S),apply(Tp,Sp)) -> and#(eq(T,Tp),eq(S,Sp))
p6: eq#(apply(T,S),apply(Tp,Sp)) -> eq#(T,Tp)
p7: eq#(apply(T,S),apply(Tp,Sp)) -> eq#(S,Sp)
p8: eq#(lambda(X,T),lambda(Xp,Tp)) -> and#(eq(T,Tp),eq(X,Xp))
p9: eq#(lambda(X,T),lambda(Xp,Tp)) -> eq#(T,Tp)
p10: eq#(lambda(X,T),lambda(Xp,Tp)) -> eq#(X,Xp)
p11: ren#(var(L),var(K),var(Lp)) -> if#(eq(L,Lp),var(K),var(Lp))
p12: ren#(var(L),var(K),var(Lp)) -> eq#(L,Lp)
p13: ren#(X,Y,apply(T,S)) -> ren#(X,Y,T)
p14: ren#(X,Y,apply(T,S)) -> ren#(X,Y,S)
p15: ren#(X,Y,lambda(Z,T)) -> ren#(X,Y,ren(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T))
p16: ren#(X,Y,lambda(Z,T)) -> ren#(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T)

and R consists of:

r1: and(false(),false()) -> false()
r2: and(true(),false()) -> false()
r3: and(false(),true()) -> false()
r4: and(true(),true()) -> true()
r5: eq(nil(),nil()) -> true()
r6: eq(cons(T,L),nil()) -> false()
r7: eq(nil(),cons(T,L)) -> false()
r8: eq(cons(T,L),cons(Tp,Lp)) -> and(eq(T,Tp),eq(L,Lp))
r9: eq(var(L),var(Lp)) -> eq(L,Lp)
r10: eq(var(L),apply(T,S)) -> false()
r11: eq(var(L),lambda(X,T)) -> false()
r12: eq(apply(T,S),var(L)) -> false()
r13: eq(apply(T,S),apply(Tp,Sp)) -> and(eq(T,Tp),eq(S,Sp))
r14: eq(apply(T,S),lambda(X,Tp)) -> false()
r15: eq(lambda(X,T),var(L)) -> false()
r16: eq(lambda(X,T),apply(Tp,Sp)) -> false()
r17: eq(lambda(X,T),lambda(Xp,Tp)) -> and(eq(T,Tp),eq(X,Xp))
r18: if(true(),var(K),var(L)) -> var(K)
r19: if(false(),var(K),var(L)) -> var(L)
r20: ren(var(L),var(K),var(Lp)) -> if(eq(L,Lp),var(K),var(Lp))
r21: ren(X,Y,apply(T,S)) -> apply(ren(X,Y,T),ren(X,Y,S))
r22: ren(X,Y,lambda(Z,T)) -> lambda(var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),ren(X,Y,ren(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T)))

The estimated dependency graph contains the following SCCs:

  {p13, p14, p15, p16}
  {p2, p3, p4, p6, p7, p9, p10}


-- Reduction pair.

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

p1: ren#(X,Y,lambda(Z,T)) -> ren#(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T)
p2: ren#(X,Y,lambda(Z,T)) -> ren#(X,Y,ren(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T))
p3: ren#(X,Y,apply(T,S)) -> ren#(X,Y,S)
p4: ren#(X,Y,apply(T,S)) -> ren#(X,Y,T)

and R consists of:

r1: and(false(),false()) -> false()
r2: and(true(),false()) -> false()
r3: and(false(),true()) -> false()
r4: and(true(),true()) -> true()
r5: eq(nil(),nil()) -> true()
r6: eq(cons(T,L),nil()) -> false()
r7: eq(nil(),cons(T,L)) -> false()
r8: eq(cons(T,L),cons(Tp,Lp)) -> and(eq(T,Tp),eq(L,Lp))
r9: eq(var(L),var(Lp)) -> eq(L,Lp)
r10: eq(var(L),apply(T,S)) -> false()
r11: eq(var(L),lambda(X,T)) -> false()
r12: eq(apply(T,S),var(L)) -> false()
r13: eq(apply(T,S),apply(Tp,Sp)) -> and(eq(T,Tp),eq(S,Sp))
r14: eq(apply(T,S),lambda(X,Tp)) -> false()
r15: eq(lambda(X,T),var(L)) -> false()
r16: eq(lambda(X,T),apply(Tp,Sp)) -> false()
r17: eq(lambda(X,T),lambda(Xp,Tp)) -> and(eq(T,Tp),eq(X,Xp))
r18: if(true(),var(K),var(L)) -> var(K)
r19: if(false(),var(K),var(L)) -> var(L)
r20: ren(var(L),var(K),var(Lp)) -> if(eq(L,Lp),var(K),var(Lp))
r21: ren(X,Y,apply(T,S)) -> apply(ren(X,Y,T),ren(X,Y,S))
r22: ren(X,Y,lambda(Z,T)) -> lambda(var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),ren(X,Y,ren(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T)))

The set of usable rules consists of

  r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. lexicographic path order with precedence:
    
      precedence:
      
        ren > cons > lambda > var > if > nil > apply > eq > and > true > false > ren#
      
      argument filter:
    
        pi(ren#) = 3
        pi(lambda) = [2]
        pi(var) = []
        pi(cons) = 2
        pi(nil) = []
        pi(ren) = 3
        pi(apply) = [1, 2]
        pi(and) = 2
        pi(false) = []
        pi(true) = []
        pi(eq) = []
        pi(if) = 3
    
    2. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        ren#_A(x1,x2,x3) = x3
        lambda_A(x1,x2) = 1
        var_A(x1) = 1
        cons_A(x1,x2) = 1
        nil_A() = 0
        ren_A(x1,x2,x3) = 3
        apply_A(x1,x2) = 1
        and_A(x1,x2) = 2
        false_A() = 1
        true_A() = 1
        eq_A(x1,x2) = 3
        if_A(x1,x2,x3) = 2
    

The next rules are strictly ordered:

  p1, p2, p3, p4

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: eq#(cons(T,L),cons(Tp,Lp)) -> eq#(T,Tp)
p2: eq#(lambda(X,T),lambda(Xp,Tp)) -> eq#(X,Xp)
p3: eq#(lambda(X,T),lambda(Xp,Tp)) -> eq#(T,Tp)
p4: eq#(apply(T,S),apply(Tp,Sp)) -> eq#(S,Sp)
p5: eq#(apply(T,S),apply(Tp,Sp)) -> eq#(T,Tp)
p6: eq#(var(L),var(Lp)) -> eq#(L,Lp)
p7: eq#(cons(T,L),cons(Tp,Lp)) -> eq#(L,Lp)

and R consists of:

r1: and(false(),false()) -> false()
r2: and(true(),false()) -> false()
r3: and(false(),true()) -> false()
r4: and(true(),true()) -> true()
r5: eq(nil(),nil()) -> true()
r6: eq(cons(T,L),nil()) -> false()
r7: eq(nil(),cons(T,L)) -> false()
r8: eq(cons(T,L),cons(Tp,Lp)) -> and(eq(T,Tp),eq(L,Lp))
r9: eq(var(L),var(Lp)) -> eq(L,Lp)
r10: eq(var(L),apply(T,S)) -> false()
r11: eq(var(L),lambda(X,T)) -> false()
r12: eq(apply(T,S),var(L)) -> false()
r13: eq(apply(T,S),apply(Tp,Sp)) -> and(eq(T,Tp),eq(S,Sp))
r14: eq(apply(T,S),lambda(X,Tp)) -> false()
r15: eq(lambda(X,T),var(L)) -> false()
r16: eq(lambda(X,T),apply(Tp,Sp)) -> false()
r17: eq(lambda(X,T),lambda(Xp,Tp)) -> and(eq(T,Tp),eq(X,Xp))
r18: if(true(),var(K),var(L)) -> var(K)
r19: if(false(),var(K),var(L)) -> var(L)
r20: ren(var(L),var(K),var(Lp)) -> if(eq(L,Lp),var(K),var(Lp))
r21: ren(X,Y,apply(T,S)) -> apply(ren(X,Y,T),ren(X,Y,S))
r22: ren(X,Y,lambda(Z,T)) -> lambda(var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),ren(X,Y,ren(Z,var(cons(X,cons(Y,cons(lambda(Z,T),nil())))),T)))

The set of usable rules consists of

  (no rules)

Take the reduction pair:

  lexicographic combination of reduction pairs:
  
    1. lexicographic path order with precedence:
    
      precedence:
      
        eq# > var > apply > lambda > cons
      
      argument filter:
    
        pi(eq#) = 1
        pi(cons) = [1, 2]
        pi(lambda) = [1, 2]
        pi(apply) = [1, 2]
        pi(var) = 1
    
    2. matrix interpretations:
    
      carrier: N^1
      order: standard order
      interpretations:
        eq#_A(x1,x2) = x1
        cons_A(x1,x2) = x1 + x2 + 1
        lambda_A(x1,x2) = x1 + x2 + 1
        apply_A(x1,x2) = x1 + x2 + 1
        var_A(x1) = x1 + 1
    

The next rules are strictly ordered:

  p1, p2, p3, p4, p5, p6, p7

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