(0) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

Q is empty.

(1) Overlay + Local Confluence (EQUIVALENT transformation)

The TRS is overlay and locally confluent. By [NOC] we can switch to innermost.

(2) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

(3) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LPAR04] we result in the following initial DP problem.

(4) Obligation:

Q DP problem:
The TRS P consists of the following rules:

APP(app(max, app(s, x)), app(s, y)) → APP(app(max, x), y)
APP(app(max, app(s, x)), app(s, y)) → APP(max, x)
APP(app(min, app(s, x)), app(s, y)) → APP(app(min, x), y)
APP(app(min, app(s, x)), app(s, y)) → APP(min, x)
APP(app(app(app(insert, f), g), nil), x) → APP(app(cons, x), nil)
APP(app(app(app(insert, f), g), nil), x) → APP(cons, x)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(cons, app(app(f, x), h))
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(f, x), h)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(f, x)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(app(app(insert, f), g), t), app(app(g, x), h))
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(app(insert, f), g), t)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(g, x), h)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(g, x)
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(app(app(insert, f), g), app(app(app(sort, f), g), t))
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(app(insert, f), g)
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(insert, f)
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(app(app(sort, f), g), t)
APP(ascending_sort, l) → APP(app(app(sort, min), max), l)
APP(ascending_sort, l) → APP(app(sort, min), max)
APP(ascending_sort, l) → APP(sort, min)
APP(descending_sort, l) → APP(app(app(sort, max), min), l)
APP(descending_sort, l) → APP(app(sort, max), min)
APP(descending_sort, l) → APP(sort, max)

The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

We have to consider all minimal (P,Q,R)-chains.

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 3 SCCs with 14 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

Q DP problem:
The TRS P consists of the following rules:

APP(app(min, app(s, x)), app(s, y)) → APP(app(min, x), y)

The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

We have to consider all minimal (P,Q,R)-chains.

(8) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04]. Here, we combined the reduction pair processor with the A-transformation [FROCOS05] which results in the following intermediate Q-DP Problem.
The a-transformed P is

min1(s(x), s(y)) → min1(x, y)

The a-transformed usable rules are
none


The following pairs can be oriented strictly and are deleted.


APP(app(min, app(s, x)), app(s, y)) → APP(app(min, x), y)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
min1(x1, x2)  =  x2
s(x1)  =  s(x1)

Lexicographic Path Order [LPO].
Precedence:
trivial

The following usable rules [FROCOS05] were oriented: none

(9) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

We have to consider all minimal (P,Q,R)-chains.

(10) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(11) TRUE

(12) Obligation:

Q DP problem:
The TRS P consists of the following rules:

APP(app(max, app(s, x)), app(s, y)) → APP(app(max, x), y)

The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

We have to consider all minimal (P,Q,R)-chains.

(13) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04]. Here, we combined the reduction pair processor with the A-transformation [FROCOS05] which results in the following intermediate Q-DP Problem.
The a-transformed P is

max1(s(x), s(y)) → max1(x, y)

The a-transformed usable rules are
none


The following pairs can be oriented strictly and are deleted.


APP(app(max, app(s, x)), app(s, y)) → APP(app(max, x), y)
The remaining pairs can at least be oriented weakly.
Used ordering: Combined order from the following AFS and order.
max1(x1, x2)  =  x2
s(x1)  =  s(x1)

Lexicographic Path Order [LPO].
Precedence:
trivial

The following usable rules [FROCOS05] were oriented: none

(14) Obligation:

Q DP problem:
P is empty.
The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

We have to consider all minimal (P,Q,R)-chains.

(15) PisEmptyProof (EQUIVALENT transformation)

The TRS P is empty. Hence, there is no (P,Q,R) chain.

(16) TRUE

(17) Obligation:

Q DP problem:
The TRS P consists of the following rules:

APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(f, x)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(f, x), h)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(app(app(insert, f), g), t), app(app(g, x), h))
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(app(g, x), h)
APP(app(app(app(insert, f), g), app(app(cons, h), t)), x) → APP(g, x)
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
APP(app(app(sort, f), g), app(app(cons, h), t)) → APP(app(app(sort, f), g), t)
APP(ascending_sort, l) → APP(app(app(sort, min), max), l)
APP(descending_sort, l) → APP(app(app(sort, max), min), l)

The TRS R consists of the following rules:

app(app(max, 0), x) → x
app(app(max, x), 0) → x
app(app(max, app(s, x)), app(s, y)) → app(app(max, x), y)
app(app(min, 0), x) → 0
app(app(min, x), 0) → 0
app(app(min, app(s, x)), app(s, y)) → app(app(min, x), y)
app(app(app(app(insert, f), g), nil), x) → app(app(cons, x), nil)
app(app(app(app(insert, f), g), app(app(cons, h), t)), x) → app(app(cons, app(app(f, x), h)), app(app(app(app(insert, f), g), t), app(app(g, x), h)))
app(app(app(sort, f), g), nil) → nil
app(app(app(sort, f), g), app(app(cons, h), t)) → app(app(app(app(insert, f), g), app(app(app(sort, f), g), t)), h)
app(ascending_sort, l) → app(app(app(sort, min), max), l)
app(descending_sort, l) → app(app(app(sort, max), min), l)

The set Q consists of the following terms:

app(app(max, 0), x0)
app(app(max, x0), 0)
app(app(max, app(s, x0)), app(s, x1))
app(app(min, 0), x0)
app(app(min, x0), 0)
app(app(min, app(s, x0)), app(s, x1))
app(app(app(app(insert, x0), x1), nil), x2)
app(app(app(app(insert, x0), x1), app(app(cons, x2), x3)), x4)
app(app(app(sort, x0), x1), nil)
app(app(app(sort, x0), x1), app(app(cons, x2), x3))
app(ascending_sort, x0)
app(descending_sort, x0)

We have to consider all minimal (P,Q,R)-chains.