Problem: app(app(app(if(),true()),xs),ys) -> xs app(app(app(if(),false()),xs),ys) -> ys app(app(lt(),app(s(),x)),app(s(),y)) -> app(app(lt(),x),y) app(app(lt(),0()),app(s(),y)) -> true() app(app(lt(),y),0()) -> false() app(app(eq(),x),x) -> true() app(app(eq(),app(s(),x)),0()) -> false() app(app(eq(),0()),app(s(),x)) -> false() app(app(merge(),xs),nil()) -> xs app(app(merge(),nil()),ys) -> ys app(app(merge(),app(app(cons(),x),xs)),app(app(cons(),y),ys)) -> app(app(app(if(),app(app(lt(),x),y)),app(app(cons(),x),app(app(merge(),xs),app(app(cons(),y),ys)))), app(app(app(if(),app(app(eq(),x),y)),app(app(cons(),x),app(app(merge(),xs),ys))), app(app(cons(),y),app(app(merge(),app(app(cons(),x),xs)),ys)))) app(app(map(),f),nil()) -> nil() app(app(map(),f),app(app(cons(),x),xs)) -> app(app(cons(),app(f,x)),app(app(map(),f),xs)) app(app(mult(),0()),x) -> 0() app(app(mult(),app(s(),x)),y) -> app(app(plus(),y),app(app(mult(),x),y)) app(app(plus(),0()),x) -> 0() app(app(plus(),app(s(),x)),y) -> app(s(),app(app(plus(),x),y)) list1() -> app(app(map(),app(mult(),app(s(),app(s(),0())))),hamming()) list2() -> app(app(map(),app(mult(),app(s(),app(s(),app(s(),0()))))),hamming()) list3() -> app(app(map(),app(mult(),app(s(),app(s(),app(s(),app(s(),app(s(),0()))))))),hamming()) hamming() -> app(app(cons(),app(s(),0())),app(app(merge(),list1()),app(app(merge(),list2()),list3()))) Proof: Uncurry Processor: if3(true(),xs,ys) -> xs if3(false(),xs,ys) -> ys lt2(s1(x),s1(y)) -> lt2(x,y) lt2(0(),s1(y)) -> true() lt2(y,0()) -> false() eq2(x,x) -> true() eq2(s1(x),0()) -> false() eq2(0(),s1(x)) -> false() merge2(xs,nil()) -> xs merge2(nil(),ys) -> ys merge2(cons2(x,xs),cons2(y,ys)) -> if3(lt2(x,y),cons2(x,merge2(xs,cons2(y,ys))),if3(eq2(x,y),cons2(x,merge2(xs,ys)), cons2(y,merge2(cons2(x,xs),ys)))) map2(f,nil()) -> nil() map2(f,cons2(x,xs)) -> cons2(app(f,x),map2(f,xs)) mult2(0(),x) -> 0() mult2(s1(x),y) -> plus2(y,mult2(x,y)) plus2(0(),x) -> 0() plus2(s1(x),y) -> s1(plus2(x,y)) list1() -> map2(mult1(s1(s1(0()))),hamming()) list2() -> map2(mult1(s1(s1(s1(0())))),hamming()) list3() -> map2(mult1(s1(s1(s1(s1(s1(0())))))),hamming()) hamming() -> cons2(s1(0()),merge2(list1(),merge2(list2(),list3()))) app(if2(x6,x5),x7) -> if3(x6,x5,x7) app(if1(x6),x7) -> if2(x6,x7) app(if(),x7) -> if1(x7) app(lt1(x6),x7) -> lt2(x6,x7) app(lt(),x7) -> lt1(x7) app(s(),x7) -> s1(x7) app(eq1(x6),x7) -> eq2(x6,x7) app(eq(),x7) -> eq1(x7) app(merge1(x6),x7) -> merge2(x6,x7) app(merge(),x7) -> merge1(x7) app(cons1(x6),x7) -> cons2(x6,x7) app(cons(),x7) -> cons1(x7) app(map1(x6),x7) -> map2(x6,x7) app(map(),x7) -> map1(x7) app(mult1(x6),x7) -> mult2(x6,x7) app(mult(),x7) -> mult1(x7) app(plus1(x6),x7) -> plus2(x6,x7) app(plus(),x7) -> plus1(x7) Unfolding Processor: loop length: 2 terms: list1() map2(mult1(s1(s1(0()))),hamming()) context: map2(mult1(s1(s1(0()))),cons2(s1(0()),merge2([],merge2(list2(),list3())))) substitution: Qed