Recognizing Monotone Predicates

On an ordered domain, a monotone Boolean predicate changes truth value at most once in the relevant direction.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
2 min
In this article4 chapters
  1. Check a capacity example
  2. Find a counterexample to an assumption
  3. Prove that the test has at most one boundary
  4. Make the proof match the actual condition

Check a capacity example

Given papers requiring 37 pages, a capacity check is false at 36 and true at 37 and every larger capacity. That monotonicity follows because increasing permitted capacity cannot invalidate a fitting job. Inclusive comparisons identify the first true position.

Find a counterexample to an assumption

A predicate saying a capacity is an exact multiple of five goes from true at five to false at six and back to true at ten. A search for a single boundary would be invalid. Use sample inputs from well-separated portions of the order to expose this issue.[1][2]

Prove that the test has at most one boundary

Let fits(capacity) say whether a fixed job requiring 37 units fits in the offered capacity. If it is true at a particular number, every larger number is also true since the requirements are fixed and additional capacity cannot prevent fitting. Test 36, 37, and 38 to see one boundary. A predicate like “even capacity” has repeated changes from false to true and back. Binary boundary search requires the former structure. See finding the first true value.

Make the proof match the actual condition

A scheduling rule can lose monotonicity if a larger capacity also changes which jobs are loaded or introduces a separate penalty. Inspect the complete predicate, not just one inequality in it. One counterexample at two ordered inputs is enough to show the proposed monotonic direction fails. Conversely a passing test at two values does not prove it.

Include all-false and all-true cases if the stated domain permits them. A boundary routine needs a documented result in either extreme. See a worked binary search for the range convention used when no element meets a threshold.

References

  1. Python Software Foundation, Python Tutorial: Control Flow ↩
  2. Python Software Foundation, Python Language Reference: Expressions ↩