Assignment axiom schema
Statement
The assignment axiom states that, after the assignment, any predicate that was previously true for the right-hand side of the assignment now holds for the variable. Formally, let be an assertion in which the variable is free. Then:
where denotes the assertion in which each free occurrence of has been replaced by the expression .
The assignment axiom scheme means that the truth of is equivalent to the after-assignment truth of . Thus, were true before the assignment, by the assignment axiom, then would be true afterwards. Conversely, were false (i.e. true) prior to the assignment statement, must then be false afterwards.
Examples of valid triples include:
All preconditions that are not modified by the expression can be carried over to the postcondition. In the first example, assigning does not change the fact that , so both statements may appear in the postcondition. Formally, this result is obtained by applying the axiom schema with being ( and ), which yields being ( and ), which can in turn be simplified to the given precondition .
The assignment axiom scheme is equivalent to saying that to find the precondition, first take the post-condition and replace all occurrences of the left-hand side of the assignment with the right-hand side of the assignment. Be careful not to try to do this backwards by following this incorrect way of thinking: ; this rule leads to nonsensical examples like:
Another incorrect rule looking tempting at first glance is ; it leads to nonsensical examples like:
While a given postcondition uniquely determines the precondition , the converse is not true. For example:
- , and
are valid instances of the assignment axiom scheme.
The assignment axiom proposed by Hoare does not apply when more than one name may refer to the same stored value. For example,
is wrong if and refer to the same variable (aliasing), although it is a proper instance of the assignment axiom scheme (with both and being ).
Further reading
- Wikipedia, page 182708, revision 1359292368, Hoare logic, section Rules > Assignment axiom schema. adopted
About this page
| Tag | EDH0T8EKDE |
|---|---|
| URI | m2://EDH0T8EKDE |
| Kind | statement, proposition |
| Writing | W0 stub |
| Status | This copy of the site has no build data. Run m2 status EDH0T8EKDE. |
| Changed | 4 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- edge uses out: each definition that the statement needs (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.
What links here
No page links to this page yet.