Partial correctness Created 2026-10-18 Updated 2026-10-24
Partial correctness means that every terminating execution begun in a program state satisfying the precondition finishes in a program state satisfying the postcondition . For a sequential program , the usual Hoare triple notation is
Here the notation expresses partial correctness; it makes no promise that finishes. The precondition and postcondition describe permitted starting circumstances and required final circumstances, rather than tests performed automatically by the program.[ref]
For a sharp example, take the precondition and the following sequential program over mathematical integers:
i = 0
s = 0
while i < n:
    i = i
The condition remains true, so execution never reaches the instruction after the loop. Consequently its partial correctness claim holds for the postcondition , and even for the impossible postcondition : there is no terminating execution with a wrong final result. This is vacuous truth, not evidence that the loop computes a sum. The same program fails total correctness for this permitted input.
The distinction is useful in a proof: first show that an answer, whenever produced, is right; then establish algorithm termination. The summation loop verification supplies both arguments for a loop that actually progresses. Its finite trace illustrates one execution, while its loop invariant covers every permitted input.
Under any Boolean valuation there are two possibilities. If is false, the outer logical implication is true by vacuous truth. If it is true, then is false, which forces true and false. In that case is true, so the outer logical implication is again true. These possibilities exhaust the truth values of its antecedent; therefore
Inequality on a domain containing at least two people is not a Euclidean relation. Choose distinct people and put , . Both premises hold, but the conclusion would be . Thus
The possibility matters: the defining universal quantifiers do not require distinct arguments. On a domain with at most one element the inequality binary relation is empty and the condition holds by vacuous truth.
On the nonempty set take the empty binary relation . There are no triples for which holds. The defining implication is therefore true for every triple by vacuous truth, making a Euclidean relation.
But is false, so is not a reflexive relation and hence is not an equivalence relation:
The displayed relation is not a partial order on the printed . Since the empty set belongs to , vacuous truth makes
hold for every finite , including nonempty . This violates the defining condition of an antisymmetric relation. It also violates transitivity: holds, but . Consequently the usual unique-maximum and unique-least upper bound terminology for a partially ordered set does not apply as claimed.
The available inputs still determine what happens if one applies the formulas in (b) literally to this relation:
FamilyElements satisfying the maximum formulaElements satisfying the least-upper-bound formula
None
and and
None and
For , no nonempty finite set can lie above all triples of arbitrarily large numbers, while does so vacuously. Thus is its sole literal upper bound, but is not a member of . For each of the two bounded families, the literal upper bounds are and all nonempty finite sets whose elements are at least . Among these, exactly and lie below every such upper bound. Both belong to , but neither belongs to its three-element subfamily.
For comparison, a natural correction is to retain the given rule for nonempty sets and declare to be a bottom element: no nonempty set is then below . Under this explicitly corrected partial order, has neither a maximum nor a least upper bound; has maximum and least upper bound ; and has no maximum but has least upper bound . A nonempty upper bound must have every element at least as large as every element of the bounded family. These corrected answers are conditional on the stated repair, not answers obtained by silently excluding the empty set from the source.
Relational division Created 2026-10-31 Updated 2026-11-05
Relational division expresses an all-required-matches query. Let be a database relation, the required values and an explicit candidate database relation. The desired result is
It can be constructed using Cartesian product, relational projection and relational difference:
The inner relational difference contains missing required pairs. Its relational projection identifies failing candidates; removing them from proves the formula.
For example, can record scientific instrument/test pairs and the required tests. An scientific instrument with both pairs passes; one with only the heat pair does not. This is a universal quantifier requirement, unlike an ordinary relational join asking for some match.
When is empty, vacuous truth gives . Choosing is conventional but cannot recover candidates absent from ; use an independently stored scientific instrument database relation if those candidates must be included. Stating the candidate universe makes this edge case unambiguous.