Negating an All or Any Condition
Negating “all satisfy the rule” yields “some violates the rule.” Negating “some satisfies it” yields “all violate it.”
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Find the witness
If not all invoices are paid, a concrete unpaid invoice can justify the result. In a list with paid, paid, unpaid, the final item is the witness. Universal and existential conditions explain why an empty list cannot supply one.
Implement the complementary query
A validation routine can return the first failing index and format that index for correction. An early-exit scan stops as soon as the witness has been found.[1]
Move negation across the quantifier and into the predicate
Saying that not every shipment arrived on time means at least one shipment failed the on-time predicate. Saying that none arrived on time means all failed. For shipments that arrive on time, late and on time, the first claim holds while the second fails. See De Morgan's laws.
On-time checks: true, false, true
Not all on time: true
Any late under a two-state model: true
All late: false
Preserve the domain and the exact predicate
When delivery status can also be unknown, “failed the on-time check” can include unknown if the predicate is ordinary Boolean. A table using three-valued logic needs its own rule. Test an empty list and a missing status.