We consider the system qsort. Alphabet: 0 : [] --> nat app : [list * list] --> list cons : [nat * list] --> list false : [] --> bool filter : [nat -> bool * list] --> list gr : [nat * nat] --> bool if : [bool * list * list] --> list le : [nat * nat] --> bool nil : [] --> list qsort : [list] --> list s : [nat] --> nat true : [] --> bool Rules: if(true, x, y) => x if(false, x, y) => y app(nil, x) => x app(cons(x, y), z) => cons(x, app(y, z)) le(0, x) => true le(s(x), 0) => false le(s(x), s(y)) => le(x, y) gr(0, x) => false gr(s(x), 0) => true gr(s(x), s(y)) => gr(x, y) filter(f, nil) => nil filter(f, cons(x, y)) => if(f x, cons(x, filter(f, y)), filter(f, y)) qsort(nil) => nil qsort(cons(x, y)) => app(qsort(filter(/\z.le(z, x), y)), app(cons(x, nil), qsort(filter(/\u.gr(u, x), y)))) This AFS is converted to an AFSM simply by replacing all free variables by meta-variables (with arity 0). We use the dependency pair framework as described in [Kop12, Ch. 6/7], with static dependency pairs (see [KusIsoSakBla09] and the adaptation for AFSMs and accessible arguments in [Kop13]). We thus obtain the following dependency pair problem (P_0, R_0, static, formative): Dependency Pairs P_0: 0] app#(cons(X, Y), Z) =#> app#(Y, Z) 1] le#(s(X), s(Y)) =#> le#(X, Y) 2] gr#(s(X), s(Y)) =#> gr#(X, Y) 3] filter#(F, cons(X, Y)) =#> if#(F X, cons(X, filter(F, Y)), filter(F, Y)) 4] filter#(F, cons(X, Y)) =#> filter#(F, Y) 5] filter#(F, cons(X, Y)) =#> filter#(F, Y) 6] qsort#(cons(X, Y)) =#> app#(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) 7] qsort#(cons(X, Y)) =#> qsort#(filter(/\x.le(x, X), Y)) 8] qsort#(cons(X, Y)) =#> filter#(/\x.le(x, X), Y) 9] qsort#(cons(X, Y)) =#> le#(Z, X) 10] qsort#(cons(X, Y)) =#> app#(cons(X, nil), qsort(filter(/\x.gr(x, X), Y))) 11] qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) 12] qsort#(cons(X, Y)) =#> filter#(/\x.gr(x, X), Y) 13] qsort#(cons(X, Y)) =#> gr#(Z, X) Rules R_0: if(true, X, Y) => X if(false, X, Y) => Y app(nil, X) => X app(cons(X, Y), Z) => cons(X, app(Y, Z)) le(0, X) => true le(s(X), 0) => false le(s(X), s(Y)) => le(X, Y) gr(0, X) => false gr(s(X), 0) => true gr(s(X), s(Y)) => gr(X, Y) filter(F, nil) => nil filter(F, cons(X, Y)) => if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) => nil qsort(cons(X, Y)) => app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) Thus, the original system is terminating if (P_0, R_0, static, formative) is finite. We consider the dependency pair problem (P_0, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: app#(cons(X, Y), Z) >? app#(Y, Z) le#(s(X), s(Y)) >? le#(X, Y) gr#(s(X), s(Y)) >? gr#(X, Y) filter#(F, cons(X, Y)) >? if#(F X, cons(X, filter(F, Y)), filter(F, Y)) filter#(F, cons(X, Y)) >? filter#(F, Y) filter#(F, cons(X, Y)) >? filter#(F, Y) qsort#(cons(X, Y)) >? app#(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) qsort#(cons(X, Y)) >? qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) >? filter#(/\x.le(x, X), Y) qsort#(cons(X, Y)) >? le#(Z, X) qsort#(cons(X, Y)) >? app#(cons(X, nil), qsort(filter(/\x.gr(x, X), Y))) qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) qsort#(cons(X, Y)) >? filter#(/\x.gr(x, X), Y) qsort#(cons(X, Y)) >? gr#(Z, X) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: 0 = 3 app = \y0y1.y1 app# = \y0y1.0 cons = \y0y1.0 false = 0 filter = \G0y1.2 filter# = \G0y1.1 gr = \y0y1.0 gr# = \y0y1.0 if = \y0y1y2.y1 + y2 if# = \y0y1y2.0 le = \y0y1.0 le# = \y0y1.0 nil = 0 qsort = \y0.0 qsort# = \y0.3 s = \y0.3 true = 0 Using this interpretation, the requirements translate to: [[app#(cons(_x0, _x1), _x2)]] = 0 >= 0 = [[app#(_x1, _x2)]] [[le#(s(_x0), s(_x1))]] = 0 >= 0 = [[le#(_x0, _x1)]] [[gr#(s(_x0), s(_x1))]] = 0 >= 0 = [[gr#(_x0, _x1)]] [[filter#(_F0, cons(_x1, _x2))]] = 1 > 0 = [[if#(_F0 _x1, cons(_x1, filter(_F0, _x2)), filter(_F0, _x2))]] [[filter#(_F0, cons(_x1, _x2))]] = 1 >= 1 = [[filter#(_F0, _x2)]] [[filter#(_F0, cons(_x1, _x2))]] = 1 >= 1 = [[filter#(_F0, _x2)]] [[qsort#(cons(_x0, _x1))]] = 3 > 0 = [[app#(qsort(filter(/\x.le(x, _x0), _x1)), app(cons(_x0, nil), qsort(filter(/\y.gr(y, _x0), _x1))))]] [[qsort#(cons(_x0, _x1))]] = 3 >= 3 = [[qsort#(filter(/\x.le(x, _x0), _x1))]] [[qsort#(cons(_x0, _x1))]] = 3 > 1 = [[filter#(/\x.le(x, _x0), _x1)]] [[qsort#(cons(_x0, _x1))]] = 3 > 0 = [[le#(_x2, _x0)]] [[qsort#(cons(_x0, _x1))]] = 3 > 0 = [[app#(cons(_x0, nil), qsort(filter(/\x.gr(x, _x0), _x1)))]] [[qsort#(cons(_x0, _x1))]] = 3 >= 3 = [[qsort#(filter(/\x.gr(x, _x0), _x1))]] [[qsort#(cons(_x0, _x1))]] = 3 > 1 = [[filter#(/\x.gr(x, _x0), _x1)]] [[qsort#(cons(_x0, _x1))]] = 3 > 0 = [[gr#(_x2, _x0)]] [[if(true, _x0, _x1)]] = x0 + x1 >= x0 = [[_x0]] [[if(false, _x0, _x1)]] = x0 + x1 >= x1 = [[_x1]] [[app(nil, _x0)]] = x0 >= x0 = [[_x0]] [[app(cons(_x0, _x1), _x2)]] = x2 >= 0 = [[cons(_x0, app(_x1, _x2))]] [[le(0, _x0)]] = 0 >= 0 = [[true]] [[le(s(_x0), 0)]] = 0 >= 0 = [[false]] [[le(s(_x0), s(_x1))]] = 0 >= 0 = [[le(_x0, _x1)]] [[gr(0, _x0)]] = 0 >= 0 = [[false]] [[gr(s(_x0), 0)]] = 0 >= 0 = [[true]] [[gr(s(_x0), s(_x1))]] = 0 >= 0 = [[gr(_x0, _x1)]] [[filter(_F0, nil)]] = 2 >= 0 = [[nil]] [[filter(_F0, cons(_x1, _x2))]] = 2 >= 2 = [[if(_F0 _x1, cons(_x1, filter(_F0, _x2)), filter(_F0, _x2))]] [[qsort(nil)]] = 0 >= 0 = [[nil]] [[qsort(cons(_x0, _x1))]] = 0 >= 0 = [[app(qsort(filter(/\x.le(x, _x0), _x1)), app(cons(_x0, nil), qsort(filter(/\y.gr(y, _x0), _x1))))]] By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_0, R_0, static, formative) by (P_1, R_0, static, formative), where P_1 consists of: app#(cons(X, Y), Z) =#> app#(Y, Z) le#(s(X), s(Y)) =#> le#(X, Y) gr#(s(X), s(Y)) =#> gr#(X, Y) filter#(F, cons(X, Y)) =#> filter#(F, Y) filter#(F, cons(X, Y)) =#> filter#(F, Y) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) Thus, the original system is terminating if (P_1, R_0, static, formative) is finite. We consider the dependency pair problem (P_1, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: app#(cons(X, Y), Z) >? app#(Y, Z) le#(s(X), s(Y)) >? le#(X, Y) gr#(s(X), s(Y)) >? gr#(X, Y) filter#(F, cons(X, Y)) >? filter#(F, Y) filter#(F, cons(X, Y)) >? filter#(F, Y) qsort#(cons(X, Y)) >? qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) We orient these requirements with a polynomial interpretation in the natural numbers. The following interpretation satisfies the requirements: 0 = 3 app = \y0y1.y1 app# = \y0y1.0 cons = \y0y1.0 false = 0 filter = \G0y1.0 filter# = \G0y1.0 gr = \y0y1.0 gr# = \y0y1.y0 + y1 if = \y0y1y2.y1 + y2 le = \y0y1.0 le# = \y0y1.y0 + y1 nil = 0 qsort = \y0.0 qsort# = \y0.0 s = \y0.3 + 2y0 true = 0 Using this interpretation, the requirements translate to: [[app#(cons(_x0, _x1), _x2)]] = 0 >= 0 = [[app#(_x1, _x2)]] [[le#(s(_x0), s(_x1))]] = 6 + 2x0 + 2x1 > x0 + x1 = [[le#(_x0, _x1)]] [[gr#(s(_x0), s(_x1))]] = 6 + 2x0 + 2x1 > x0 + x1 = [[gr#(_x0, _x1)]] [[filter#(_F0, cons(_x1, _x2))]] = 0 >= 0 = [[filter#(_F0, _x2)]] [[filter#(_F0, cons(_x1, _x2))]] = 0 >= 0 = [[filter#(_F0, _x2)]] [[qsort#(cons(_x0, _x1))]] = 0 >= 0 = [[qsort#(filter(/\x.le(x, _x0), _x1))]] [[qsort#(cons(_x0, _x1))]] = 0 >= 0 = [[qsort#(filter(/\x.gr(x, _x0), _x1))]] [[if(true, _x0, _x1)]] = x0 + x1 >= x0 = [[_x0]] [[if(false, _x0, _x1)]] = x0 + x1 >= x1 = [[_x1]] [[app(nil, _x0)]] = x0 >= x0 = [[_x0]] [[app(cons(_x0, _x1), _x2)]] = x2 >= 0 = [[cons(_x0, app(_x1, _x2))]] [[le(0, _x0)]] = 0 >= 0 = [[true]] [[le(s(_x0), 0)]] = 0 >= 0 = [[false]] [[le(s(_x0), s(_x1))]] = 0 >= 0 = [[le(_x0, _x1)]] [[gr(0, _x0)]] = 0 >= 0 = [[false]] [[gr(s(_x0), 0)]] = 0 >= 0 = [[true]] [[gr(s(_x0), s(_x1))]] = 0 >= 0 = [[gr(_x0, _x1)]] [[filter(_F0, nil)]] = 0 >= 0 = [[nil]] [[filter(_F0, cons(_x1, _x2))]] = 0 >= 0 = [[if(_F0 _x1, cons(_x1, filter(_F0, _x2)), filter(_F0, _x2))]] [[qsort(nil)]] = 0 >= 0 = [[nil]] [[qsort(cons(_x0, _x1))]] = 0 >= 0 = [[app(qsort(filter(/\x.le(x, _x0), _x1)), app(cons(_x0, nil), qsort(filter(/\y.gr(y, _x0), _x1))))]] By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_1, R_0, static, formative) by (P_2, R_0, static, formative), where P_2 consists of: app#(cons(X, Y), Z) =#> app#(Y, Z) filter#(F, cons(X, Y)) =#> filter#(F, Y) filter#(F, cons(X, Y)) =#> filter#(F, Y) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) Thus, the original system is terminating if (P_2, R_0, static, formative) is finite. We consider the dependency pair problem (P_2, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: app#(cons(X, Y), Z) >? app#(Y, Z) filter#(F, cons(X, Y)) >? filter#(F, Y) filter#(F, cons(X, Y)) >? filter#(F, Y) qsort#(cons(X, Y)) >? qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) Since this representation is not advantageous for the higher-order recursive path ordering, we present the strict requirements in their unextended form, which is not problematic since for any F, s and substituion gamma: (F s)gamma beta-reduces to F(s)gamma.) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[app#(x_1, x_2)]] = x_1 [[false]] = _|_ [[filter(x_1, x_2)]] = filter(x_2) [[filter#(x_1, x_2)]] = x_2 [[gr(x_1, x_2)]] = _|_ [[if(x_1, x_2, x_3)]] = if(x_2, x_3) [[le(x_1, x_2)]] = le(x_1) [[nil]] = _|_ [[true]] = _|_ We choose Lex = {} and Mul = {0, @_{o -> o}, app, cons, filter, if, le, qsort, qsort#, s}, and the following precedence: 0 > @_{o -> o} > qsort > app > cons = filter > if > qsort# > s > le Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: cons(X, Y) > Y cons(X, Y) >= Y cons(X, Y) >= Y qsort#(cons(X, Y)) >= qsort#(filter(Y)) qsort#(cons(X, Y)) >= qsort#(filter(Y)) if(X, Y) >= X if(X, Y) >= Y app(_|_, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0) >= _|_ le(s(X)) >= _|_ le(s(X)) >= le(X) _|_ >= _|_ _|_ >= _|_ _|_ >= _|_ filter(_|_) >= _|_ filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) qsort(_|_) >= _|_ qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) With these choices, we have: 1] cons(X, Y) > Y because [2], by definition 2] cons*(X, Y) >= Y because [3], by (Select) 3] Y >= Y by (Meta) 4] cons(X, Y) >= Y because [5], by (Star) 5] cons*(X, Y) >= Y because [6], by (Select) 6] Y >= Y by (Meta) 7] cons(X, Y) >= Y because [5], by (Star) 8] qsort#(cons(X, Y)) >= qsort#(filter(Y)) because qsort# in Mul and [9], by (Fun) 9] cons(X, Y) >= filter(Y) because [10], by (Star) 10] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) 11] Y >= Y by (Meta) 12] qsort#(cons(X, Y)) >= qsort#(filter(Y)) because [13], by (Star) 13] qsort#*(cons(X, Y)) >= qsort#(filter(Y)) because qsort# in Mul and [14], by (Stat) 14] cons(X, Y) > filter(Y) because [15], by definition 15] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) 16] if(X, Y) >= X because [17], by (Star) 17] if*(X, Y) >= X because [18], by (Select) 18] X >= X by (Meta) 19] if(X, Y) >= Y because [20], by (Star) 20] if*(X, Y) >= Y because [21], by (Select) 21] Y >= Y by (Meta) 22] app(_|_, X) >= X because [23], by (Star) 23] app*(_|_, X) >= X because [24], by (Select) 24] X >= X by (Meta) 25] app(cons(X, Y), Z) >= cons(X, app(Y, Z)) because [26], by (Star) 26] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [27] and [31], by (Copy) 27] app*(cons(X, Y), Z) >= X because [28], by (Select) 28] cons(X, Y) >= X because [29], by (Star) 29] cons*(X, Y) >= X because [30], by (Select) 30] X >= X by (Meta) 31] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [32] and [33], by (Stat) 32] cons(X, Y) > Y because [2], by definition 33] Z >= Z by (Meta) 34] le(0) >= _|_ by (Bot) 35] le(s(X)) >= _|_ by (Bot) 36] le(s(X)) >= le(X) because [37], by (Star) 37] le*(s(X)) >= le(X) because [38], by (Select) 38] s(X) >= le(X) because [39], by (Star) 39] s*(X) >= le(X) because s > le and [40], by (Copy) 40] s*(X) >= X because [41], by (Select) 41] X >= X by (Meta) 42] _|_ >= _|_ by (Bot) 43] _|_ >= _|_ by (Bot) 44] _|_ >= _|_ by (Bot) 45] filter(_|_) >= _|_ by (Bot) 46] filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because [47], by (Star) 47] filter*(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because filter > if, [48] and [55], by (Copy) 48] filter*(cons(X, Y)) >= cons(X, filter(Y)) because filter = cons, filter in Mul, [49] and [52], by (Stat) 49] cons(X, Y) > X because [50], by definition 50] cons*(X, Y) >= X because [51], by (Select) 51] X >= X by (Meta) 52] cons(X, Y) > filter(Y) because [53], by definition 53] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [54], by (Stat) 54] Y >= Y by (Meta) 55] filter*(cons(X, Y)) >= filter(Y) because filter in Mul and [56], by (Stat) 56] cons(X, Y) > Y because [57], by definition 57] cons*(X, Y) >= Y because [54], by (Select) 58] qsort(_|_) >= _|_ by (Bot) 59] qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because [60], by (Star) 60] qsort*(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because qsort > app, [61] and [64], by (Copy) 61] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [62], by (Stat) 62] cons(X, Y) > filter(Y) because [63], by definition 63] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) 64] qsort*(cons(X, Y)) >= app(cons(X, _|_), qsort(filter(Y))) because qsort > app, [65] and [69], by (Copy) 65] qsort*(cons(X, Y)) >= cons(X, _|_) because [66], by (Select) 66] cons(X, Y) >= cons(X, _|_) because cons in Mul, [67] and [68], by (Fun) 67] X >= X by (Meta) 68] Y >= _|_ by (Bot) 69] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [14], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_2, R_0, static, formative) by (P_3, R_0, static, formative), where P_3 consists of: filter#(F, cons(X, Y)) =#> filter#(F, Y) filter#(F, cons(X, Y)) =#> filter#(F, Y) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) Thus, the original system is terminating if (P_3, R_0, static, formative) is finite. We consider the dependency pair problem (P_3, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: filter#(F, cons(X, Y)) >? filter#(F, Y) filter#(F, cons(X, Y)) >? filter#(F, Y) qsort#(cons(X, Y)) >? qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) Since this representation is not advantageous for the higher-order recursive path ordering, we present the strict requirements in their unextended form, which is not problematic since for any F, s and substituion gamma: (F s)gamma beta-reduces to F(s)gamma.) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[false]] = _|_ [[filter(x_1, x_2)]] = filter(x_2) [[gr(x_1, x_2)]] = gr(x_1) [[if(x_1, x_2, x_3)]] = if(x_2, x_3) [[le(x_1, x_2)]] = le(x_1) [[nil]] = _|_ [[true]] = _|_ We choose Lex = {} and Mul = {0, @_{o -> o}, app, cons, filter, filter#, gr, if, le, qsort, qsort#, s}, and the following precedence: 0 > filter# > qsort# > qsort > app > cons = filter > if > gr = le = s > @_{o -> o} Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: filter#(F, cons(X, Y)) > filter#(F, Y) filter#(F, cons(X, Y)) >= filter#(F, Y) qsort#(cons(X, Y)) >= qsort#(filter(Y)) qsort#(cons(X, Y)) >= qsort#(filter(Y)) if(X, Y) >= X if(X, Y) >= Y app(_|_, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0) >= _|_ le(s(X)) >= _|_ le(s(X)) >= le(X) gr(0) >= _|_ gr(s(X)) >= _|_ gr(s(X)) >= gr(X) filter(_|_) >= _|_ filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) qsort(_|_) >= _|_ qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) With these choices, we have: 1] filter#(F, cons(X, Y)) > filter#(F, Y) because [2], by definition 2] filter#*(F, cons(X, Y)) >= filter#(F, Y) because filter# in Mul, [3] and [4], by (Stat) 3] F >= F by (Meta) 4] cons(X, Y) > Y because [5], by definition 5] cons*(X, Y) >= Y because [6], by (Select) 6] Y >= Y by (Meta) 7] filter#(F, cons(X, Y)) >= filter#(F, Y) because [2], by (Star) 8] qsort#(cons(X, Y)) >= qsort#(filter(Y)) because qsort# in Mul and [9], by (Fun) 9] cons(X, Y) >= filter(Y) because [10], by (Star) 10] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) 11] Y >= Y by (Meta) 12] qsort#(cons(X, Y)) >= qsort#(filter(Y)) because qsort# in Mul and [13], by (Fun) 13] cons(X, Y) >= filter(Y) because [14], by (Star) 14] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) 15] if(X, Y) >= X because [16], by (Star) 16] if*(X, Y) >= X because [17], by (Select) 17] X >= X by (Meta) 18] if(X, Y) >= Y because [19], by (Star) 19] if*(X, Y) >= Y because [20], by (Select) 20] Y >= Y by (Meta) 21] app(_|_, X) >= X because [22], by (Star) 22] app*(_|_, X) >= X because [23], by (Select) 23] X >= X by (Meta) 24] app(cons(X, Y), Z) >= cons(X, app(Y, Z)) because [25], by (Star) 25] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [26] and [30], by (Copy) 26] app*(cons(X, Y), Z) >= X because [27], by (Select) 27] cons(X, Y) >= X because [28], by (Star) 28] cons*(X, Y) >= X because [29], by (Select) 29] X >= X by (Meta) 30] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [31] and [34], by (Stat) 31] cons(X, Y) > Y because [32], by definition 32] cons*(X, Y) >= Y because [33], by (Select) 33] Y >= Y by (Meta) 34] Z >= Z by (Meta) 35] le(0) >= _|_ by (Bot) 36] le(s(X)) >= _|_ by (Bot) 37] le(s(X)) >= le(X) because [38], by (Star) 38] le*(s(X)) >= le(X) because [39], by (Select) 39] s(X) >= le(X) because s = le, s in Mul and [40], by (Fun) 40] X >= X by (Meta) 41] gr(0) >= _|_ by (Bot) 42] gr(s(X)) >= _|_ by (Bot) 43] gr(s(X)) >= gr(X) because [44], by (Star) 44] gr*(s(X)) >= gr(X) because gr in Mul and [45], by (Stat) 45] s(X) > X because [46], by definition 46] s*(X) >= X because [47], by (Select) 47] X >= X by (Meta) 48] filter(_|_) >= _|_ by (Bot) 49] filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because [50], by (Star) 50] filter*(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because filter > if, [51] and [58], by (Copy) 51] filter*(cons(X, Y)) >= cons(X, filter(Y)) because filter = cons, filter in Mul, [52] and [55], by (Stat) 52] cons(X, Y) > X because [53], by definition 53] cons*(X, Y) >= X because [54], by (Select) 54] X >= X by (Meta) 55] cons(X, Y) > filter(Y) because [56], by definition 56] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [57], by (Stat) 57] Y >= Y by (Meta) 58] filter*(cons(X, Y)) >= filter(Y) because filter in Mul and [4], by (Stat) 59] qsort(_|_) >= _|_ by (Bot) 60] qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because [61], by (Star) 61] qsort*(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because qsort > app, [62] and [65], by (Copy) 62] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [63], by (Stat) 63] cons(X, Y) > filter(Y) because [64], by definition 64] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) 65] qsort*(cons(X, Y)) >= app(cons(X, _|_), qsort(filter(Y))) because qsort > app, [66] and [70], by (Copy) 66] qsort*(cons(X, Y)) >= cons(X, _|_) because [67], by (Select) 67] cons(X, Y) >= cons(X, _|_) because cons in Mul, [68] and [69], by (Fun) 68] X >= X by (Meta) 69] Y >= _|_ by (Bot) 70] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [71], by (Stat) 71] cons(X, Y) > filter(Y) because [72], by definition 72] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [11], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_3, R_0, static, formative) by (P_4, R_0, static, formative), where P_4 consists of: filter#(F, cons(X, Y)) =#> filter#(F, Y) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) Thus, the original system is terminating if (P_4, R_0, static, formative) is finite. We consider the dependency pair problem (P_4, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: filter#(F, cons(X, Y)) >? filter#(F, Y) qsort#(cons(X, Y)) >? qsort#(filter(/\x.le(x, X), Y)) qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) Since this representation is not advantageous for the higher-order recursive path ordering, we present the strict requirements in their unextended form, which is not problematic since for any F, s and substituion gamma: (F s)gamma beta-reduces to F(s)gamma.) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[false]] = _|_ [[filter(x_1, x_2)]] = filter(x_2) [[if(x_1, x_2, x_3)]] = if(x_2, x_3) [[le(x_1, x_2)]] = x_1 [[nil]] = _|_ [[qsort#(x_1)]] = x_1 [[true]] = _|_ We choose Lex = {} and Mul = {0, @_{o -> o}, app, cons, filter, filter#, gr, if, qsort, s}, and the following precedence: 0 > @_{o -> o} > filter# > gr > qsort > app > cons = filter > if > s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: filter#(F, cons(X, Y)) >= filter#(F, Y) cons(X, Y) > filter(Y) cons(X, Y) >= filter(Y) if(X, Y) >= X if(X, Y) >= Y app(_|_, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) 0 >= _|_ s(X) >= _|_ s(X) >= X gr(0, X) >= _|_ gr(s(X), 0) >= _|_ gr(s(X), s(Y)) >= gr(X, Y) filter(_|_) >= _|_ filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) qsort(_|_) >= _|_ qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) With these choices, we have: 1] filter#(F, cons(X, Y)) >= filter#(F, Y) because filter# in Mul, [2] and [3], by (Fun) 2] F >= F by (Meta) 3] cons(X, Y) >= Y because [4], by (Star) 4] cons*(X, Y) >= Y because [5], by (Select) 5] Y >= Y by (Meta) 6] cons(X, Y) > filter(Y) because [7], by definition 7] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [8], by (Stat) 8] Y >= Y by (Meta) 9] cons(X, Y) >= filter(Y) because [10], by (Star) 10] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [8], by (Stat) 11] if(X, Y) >= X because [12], by (Star) 12] if*(X, Y) >= X because [13], by (Select) 13] X >= X by (Meta) 14] if(X, Y) >= Y because [15], by (Star) 15] if*(X, Y) >= Y because [16], by (Select) 16] Y >= Y by (Meta) 17] app(_|_, X) >= X because [18], by (Star) 18] app*(_|_, X) >= X because [19], by (Select) 19] X >= X by (Meta) 20] app(cons(X, Y), Z) >= cons(X, app(Y, Z)) because [21], by (Star) 21] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [22] and [26], by (Copy) 22] app*(cons(X, Y), Z) >= X because [23], by (Select) 23] cons(X, Y) >= X because [24], by (Star) 24] cons*(X, Y) >= X because [25], by (Select) 25] X >= X by (Meta) 26] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [27] and [30], by (Stat) 27] cons(X, Y) > Y because [28], by definition 28] cons*(X, Y) >= Y because [29], by (Select) 29] Y >= Y by (Meta) 30] Z >= Z by (Meta) 31] 0 >= _|_ by (Bot) 32] s(X) >= _|_ by (Bot) 33] s(X) >= X because [34], by (Star) 34] s*(X) >= X because [35], by (Select) 35] X >= X by (Meta) 36] gr(0, X) >= _|_ by (Bot) 37] gr(s(X), 0) >= _|_ by (Bot) 38] gr(s(X), s(Y)) >= gr(X, Y) because gr in Mul, [39] and [42], by (Fun) 39] s(X) >= X because [40], by (Star) 40] s*(X) >= X because [41], by (Select) 41] X >= X by (Meta) 42] s(Y) >= Y because [43], by (Star) 43] s*(Y) >= Y because [44], by (Select) 44] Y >= Y by (Meta) 45] filter(_|_) >= _|_ by (Bot) 46] filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because [47], by (Star) 47] filter*(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because filter > if, [48] and [55], by (Copy) 48] filter*(cons(X, Y)) >= cons(X, filter(Y)) because filter = cons, filter in Mul, [49] and [52], by (Stat) 49] cons(X, Y) > X because [50], by definition 50] cons*(X, Y) >= X because [51], by (Select) 51] X >= X by (Meta) 52] cons(X, Y) > filter(Y) because [53], by definition 53] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [54], by (Stat) 54] Y >= Y by (Meta) 55] filter*(cons(X, Y)) >= filter(Y) because [56], by (Select) 56] cons(X, Y) >= filter(Y) because [53], by (Star) 57] qsort(_|_) >= _|_ by (Bot) 58] qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because [59], by (Star) 59] qsort*(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because qsort > app, [60] and [62], by (Copy) 60] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [61], by (Stat) 61] cons(X, Y) > filter(Y) because [7], by definition 62] qsort*(cons(X, Y)) >= app(cons(X, _|_), qsort(filter(Y))) because qsort > app, [63] and [67], by (Copy) 63] qsort*(cons(X, Y)) >= cons(X, _|_) because [64], by (Select) 64] cons(X, Y) >= cons(X, _|_) because cons in Mul, [65] and [66], by (Fun) 65] X >= X by (Meta) 66] Y >= _|_ by (Bot) 67] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [68], by (Stat) 68] cons(X, Y) > filter(Y) because [69], by definition 69] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [8], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_4, R_0, static, formative) by (P_5, R_0, static, formative), where P_5 consists of: filter#(F, cons(X, Y)) =#> filter#(F, Y) qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) Thus, the original system is terminating if (P_5, R_0, static, formative) is finite. We consider the dependency pair problem (P_5, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: filter#(F, cons(X, Y)) >? filter#(F, Y) qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) Since this representation is not advantageous for the higher-order recursive path ordering, we present the strict requirements in their unextended form, which is not problematic since for any F, s and substituion gamma: (F s)gamma beta-reduces to F(s)gamma.) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[false]] = _|_ [[filter(x_1, x_2)]] = filter(x_2) [[if(x_1, x_2, x_3)]] = if(x_2, x_3) [[le(x_1, x_2)]] = le(x_1) [[nil]] = _|_ [[true]] = _|_ We choose Lex = {} and Mul = {0, @_{o -> o}, app, cons, filter, filter#, gr, if, le, qsort, qsort#, s}, and the following precedence: 0 > filter# > gr > qsort > app > @_{o -> o} > cons = filter > if > qsort# > le = s Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: filter#(F, cons(X, Y)) > filter#(F, Y) qsort#(cons(X, Y)) >= qsort#(filter(Y)) if(X, Y) >= X if(X, Y) >= Y app(_|_, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0) >= _|_ le(s(X)) >= _|_ le(s(X)) >= le(X) gr(0, X) >= _|_ gr(s(X), 0) >= _|_ gr(s(X), s(Y)) >= gr(X, Y) filter(_|_) >= _|_ filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) qsort(_|_) >= _|_ qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) With these choices, we have: 1] filter#(F, cons(X, Y)) > filter#(F, Y) because [2], by definition 2] filter#*(F, cons(X, Y)) >= filter#(F, Y) because filter# in Mul, [3] and [4], by (Stat) 3] F >= F by (Meta) 4] cons(X, Y) > Y because [5], by definition 5] cons*(X, Y) >= Y because [6], by (Select) 6] Y >= Y by (Meta) 7] qsort#(cons(X, Y)) >= qsort#(filter(Y)) because qsort# in Mul and [8], by (Fun) 8] cons(X, Y) >= filter(Y) because [9], by (Star) 9] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [10], by (Stat) 10] Y >= Y by (Meta) 11] if(X, Y) >= X because [12], by (Star) 12] if*(X, Y) >= X because [13], by (Select) 13] X >= X by (Meta) 14] if(X, Y) >= Y because [15], by (Star) 15] if*(X, Y) >= Y because [16], by (Select) 16] Y >= Y by (Meta) 17] app(_|_, X) >= X because [18], by (Star) 18] app*(_|_, X) >= X because [19], by (Select) 19] X >= X by (Meta) 20] app(cons(X, Y), Z) >= cons(X, app(Y, Z)) because [21], by (Star) 21] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [22] and [26], by (Copy) 22] app*(cons(X, Y), Z) >= X because [23], by (Select) 23] cons(X, Y) >= X because [24], by (Star) 24] cons*(X, Y) >= X because [25], by (Select) 25] X >= X by (Meta) 26] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [27] and [30], by (Stat) 27] cons(X, Y) > Y because [28], by definition 28] cons*(X, Y) >= Y because [29], by (Select) 29] Y >= Y by (Meta) 30] Z >= Z by (Meta) 31] le(0) >= _|_ by (Bot) 32] le(s(X)) >= _|_ by (Bot) 33] le(s(X)) >= le(X) because [34], by (Star) 34] le*(s(X)) >= le(X) because [35], by (Select) 35] s(X) >= le(X) because s = le, s in Mul and [36], by (Fun) 36] X >= X by (Meta) 37] gr(0, X) >= _|_ by (Bot) 38] gr(s(X), 0) >= _|_ by (Bot) 39] gr(s(X), s(Y)) >= gr(X, Y) because [40], by (Star) 40] gr*(s(X), s(Y)) >= gr(X, Y) because gr in Mul, [41] and [44], by (Stat) 41] s(X) >= X because [42], by (Star) 42] s*(X) >= X because [43], by (Select) 43] X >= X by (Meta) 44] s(Y) > Y because [45], by definition 45] s*(Y) >= Y because [46], by (Select) 46] Y >= Y by (Meta) 47] filter(_|_) >= _|_ by (Bot) 48] filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because [49], by (Star) 49] filter*(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because filter > if, [50] and [57], by (Copy) 50] filter*(cons(X, Y)) >= cons(X, filter(Y)) because filter = cons, filter in Mul, [51] and [54], by (Stat) 51] cons(X, Y) > X because [52], by definition 52] cons*(X, Y) >= X because [53], by (Select) 53] X >= X by (Meta) 54] cons(X, Y) > filter(Y) because [55], by definition 55] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [56], by (Stat) 56] Y >= Y by (Meta) 57] filter*(cons(X, Y)) >= filter(Y) because filter in Mul and [4], by (Stat) 58] qsort(_|_) >= _|_ by (Bot) 59] qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because [60], by (Star) 60] qsort*(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because qsort > app, [61] and [64], by (Copy) 61] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [62], by (Stat) 62] cons(X, Y) > filter(Y) because [63], by definition 63] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [10], by (Stat) 64] qsort*(cons(X, Y)) >= app(cons(X, _|_), qsort(filter(Y))) because qsort > app, [65] and [69], by (Copy) 65] qsort*(cons(X, Y)) >= cons(X, _|_) because [66], by (Select) 66] cons(X, Y) >= cons(X, _|_) because cons in Mul, [67] and [68], by (Fun) 67] X >= X by (Meta) 68] Y >= _|_ by (Bot) 69] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [70], by (Stat) 70] cons(X, Y) > filter(Y) because [71], by definition 71] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [10], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace the dependency pair problem (P_5, R_0, static, formative) by (P_6, R_0, static, formative), where P_6 consists of: qsort#(cons(X, Y)) =#> qsort#(filter(/\x.gr(x, X), Y)) Thus, the original system is terminating if (P_6, R_0, static, formative) is finite. We consider the dependency pair problem (P_6, R_0, static, formative). We will use the reduction pair processor [Kop12, Thm. 7.16]. It suffices to find a standard reduction pair [Kop12, Def. 6.69]. Thus, we must orient: qsort#(cons(X, Y)) >? qsort#(filter(/\x.gr(x, X), Y)) if(true, X, Y) >= X if(false, X, Y) >= Y app(nil, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0, X) >= true le(s(X), 0) >= false le(s(X), s(Y)) >= le(X, Y) gr(0, X) >= false gr(s(X), 0) >= true gr(s(X), s(Y)) >= gr(X, Y) filter(F, nil) >= nil filter(F, cons(X, Y)) >= if(F X, cons(X, filter(F, Y)), filter(F, Y)) qsort(nil) >= nil qsort(cons(X, Y)) >= app(qsort(filter(/\x.le(x, X), Y)), app(cons(X, nil), qsort(filter(/\y.gr(y, X), Y)))) Since this representation is not advantageous for the higher-order recursive path ordering, we present the strict requirements in their unextended form, which is not problematic since for any F, s and substituion gamma: (F s)gamma beta-reduces to F(s)gamma.) We use a recursive path ordering as defined in [Kop12, Chapter 5]. Argument functions: [[false]] = _|_ [[filter(x_1, x_2)]] = filter(x_2) [[if(x_1, x_2, x_3)]] = if(x_2, x_3) [[le(x_1, x_2)]] = le(x_1) [[nil]] = _|_ [[true]] = _|_ We choose Lex = {} and Mul = {0, @_{o -> o}, app, cons, filter, gr, if, le, qsort, qsort#, s}, and the following precedence: 0 > @_{o -> o} > gr > qsort > app > qsort# > cons = filter > if > s > le Taking the argument function into account, and fixing the greater / greater equal choices, the constraints can be denoted as follows: qsort#(cons(X, Y)) > qsort#(filter(Y)) if(X, Y) >= X if(X, Y) >= Y app(_|_, X) >= X app(cons(X, Y), Z) >= cons(X, app(Y, Z)) le(0) >= _|_ le(s(X)) >= _|_ le(s(X)) >= le(X) gr(0, X) >= _|_ gr(s(X), 0) >= _|_ gr(s(X), s(Y)) >= gr(X, Y) filter(_|_) >= _|_ filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) qsort(_|_) >= _|_ qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) With these choices, we have: 1] qsort#(cons(X, Y)) > qsort#(filter(Y)) because [2], by definition 2] qsort#*(cons(X, Y)) >= qsort#(filter(Y)) because qsort# in Mul and [3], by (Stat) 3] cons(X, Y) > filter(Y) because [4], by definition 4] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [5], by (Stat) 5] Y >= Y by (Meta) 6] if(X, Y) >= X because [7], by (Star) 7] if*(X, Y) >= X because [8], by (Select) 8] X >= X by (Meta) 9] if(X, Y) >= Y because [10], by (Star) 10] if*(X, Y) >= Y because [11], by (Select) 11] Y >= Y by (Meta) 12] app(_|_, X) >= X because [13], by (Star) 13] app*(_|_, X) >= X because [14], by (Select) 14] X >= X by (Meta) 15] app(cons(X, Y), Z) >= cons(X, app(Y, Z)) because [16], by (Star) 16] app*(cons(X, Y), Z) >= cons(X, app(Y, Z)) because app > cons, [17] and [21], by (Copy) 17] app*(cons(X, Y), Z) >= X because [18], by (Select) 18] cons(X, Y) >= X because [19], by (Star) 19] cons*(X, Y) >= X because [20], by (Select) 20] X >= X by (Meta) 21] app*(cons(X, Y), Z) >= app(Y, Z) because app in Mul, [22] and [25], by (Stat) 22] cons(X, Y) > Y because [23], by definition 23] cons*(X, Y) >= Y because [24], by (Select) 24] Y >= Y by (Meta) 25] Z >= Z by (Meta) 26] le(0) >= _|_ by (Bot) 27] le(s(X)) >= _|_ by (Bot) 28] le(s(X)) >= le(X) because [29], by (Star) 29] le*(s(X)) >= le(X) because [30], by (Select) 30] s(X) >= le(X) because [31], by (Star) 31] s*(X) >= le(X) because s > le and [32], by (Copy) 32] s*(X) >= X because [33], by (Select) 33] X >= X by (Meta) 34] gr(0, X) >= _|_ by (Bot) 35] gr(s(X), 0) >= _|_ by (Bot) 36] gr(s(X), s(Y)) >= gr(X, Y) because [37], by (Star) 37] gr*(s(X), s(Y)) >= gr(X, Y) because gr in Mul, [38] and [41], by (Stat) 38] s(X) >= X because [39], by (Star) 39] s*(X) >= X because [40], by (Select) 40] X >= X by (Meta) 41] s(Y) > Y because [42], by definition 42] s*(Y) >= Y because [43], by (Select) 43] Y >= Y by (Meta) 44] filter(_|_) >= _|_ by (Bot) 45] filter(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because [46], by (Star) 46] filter*(cons(X, Y)) >= if(cons(X, filter(Y)), filter(Y)) because filter > if, [47] and [54], by (Copy) 47] filter*(cons(X, Y)) >= cons(X, filter(Y)) because filter = cons, filter in Mul, [48] and [51], by (Stat) 48] cons(X, Y) > X because [49], by definition 49] cons*(X, Y) >= X because [50], by (Select) 50] X >= X by (Meta) 51] cons(X, Y) > filter(Y) because [52], by definition 52] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [53], by (Stat) 53] Y >= Y by (Meta) 54] filter*(cons(X, Y)) >= filter(Y) because filter in Mul and [55], by (Stat) 55] cons(X, Y) > Y because [56], by definition 56] cons*(X, Y) >= Y because [53], by (Select) 57] qsort(_|_) >= _|_ by (Bot) 58] qsort(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because [59], by (Star) 59] qsort*(cons(X, Y)) >= app(qsort(filter(Y)), app(cons(X, _|_), qsort(filter(Y)))) because qsort > app, [60] and [63], by (Copy) 60] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [61], by (Stat) 61] cons(X, Y) > filter(Y) because [62], by definition 62] cons*(X, Y) >= filter(Y) because cons = filter, cons in Mul and [5], by (Stat) 63] qsort*(cons(X, Y)) >= app(cons(X, _|_), qsort(filter(Y))) because qsort > app, [64] and [70], by (Copy) 64] qsort*(cons(X, Y)) >= cons(X, _|_) because qsort > cons, [65] and [69], by (Copy) 65] qsort*(cons(X, Y)) >= X because [66], by (Select) 66] cons(X, Y) >= X because [67], by (Star) 67] cons*(X, Y) >= X because [68], by (Select) 68] X >= X by (Meta) 69] qsort*(cons(X, Y)) >= _|_ by (Bot) 70] qsort*(cons(X, Y)) >= qsort(filter(Y)) because qsort in Mul and [3], by (Stat) By the observations in [Kop12, Sec. 6.6], this reduction pair suffices; we may thus replace a dependency pair problem (P_6, R_0) by ({}, R_0). By the empty set processor [Kop12, Thm. 7.15] this problem may be immediately removed. As all dependency pair problems were succesfully simplified with sound (and complete) processors until nothing remained, we conclude termination. +++ Citations +++ [Kop12] C. Kop. Higher Order Termination. PhD Thesis, 2012. [Kop13] C. Kop. Static Dependency Pairs with Accessibility. Unpublished manuscript, http://cl-informatik.uibk.ac.at/users/kop/static.pdf, 2013. [KusIsoSakBla09] K. Kusakari, Y. Isogai, M. Sakai, and F. Blanqui. Static Dependency Pair Method Based On Strong Computability for Higher-Order Rewrite Systems. In volume 92(10) of IEICE Transactions on Information and Systems. 2007--2015, 2009.