Weakest Preconditions
Weakest Preconditions
Adjoint quantum operations transform postconditions backward, with distinct weakest and weakest liberal preconditions for total and partial correctness.
A weakest-precondition transformer computes an input predicate from a desired output predicate. Let be a completely positive, trace-nonincreasing map between finite-dimensional state spaces, and let be an output effect. The trace adjoint is characterized by
This relation turns the forward state transformation of denotational semantics into backward reasoning about observations.
Total and partial correctness
For total correctness, the weakest precondition is
For partial correctness, where missing output trace represents nontermination, the weakest liberal precondition is
The identities inside and outside act on the output and input spaces respectively. Trace nonincrease ensures , so both transformers return effects. If the map preserves trace, and the two transformers agree.
Under the quantitative convention used in quantum Hoare logic, a valid total triple satisfies ; a valid partial triple satisfies . Here means is positive semidefinite. Consequently, the conventionally named weakest precondition is the greatest admissible precondition effect in this operator order; the term should not be interpreted through an unstated Boolean implication order.
Examples: gates, measurement, and sequencing
For a unitary , . With and , the result is .
If a measurement discards its outcome, its transformer is
Computational-basis measurement therefore transforms the postcondition into : after dephasing, the probability of a subsequent outcome is one half for every normalized input.
For C1; C2, backward calculation reverses execution order:
A never-terminating program has but , demonstrating the role of liberal correctness.
Limitations
Retained measurement results and classical control require outcome-dependent predicates or an explicit classical-quantum state space. Loops generally need fixed-point reasoning; a closed expression need not be available. Numerical matrix comparisons require justified error bounds, especially near zero eigenvalues. This introductory calculation method does not automatically generate invariants or provide a machine-checked proof.
References
- Ellie D'Hondt and Prakash Panangaden. Quantum Weakest Preconditions. Mathematical Structures in Computer Science (2006). arXiv:quant-ph/0501157.
- Mingsheng Ying. Floyd-Hoare logic for quantum programs. ACM Transactions on Programming Languages and Systems 33(6), 1-49 (2011). DOI: 10.1145/2049706.2049708.