Back to Program Verification Index | Previous: (y-09) Ultimate Referee | Next: (y-11) Nondeterminism: Havoc and Assume
The 2026 deck covers this material as the Arrays section (pp 246-272). The axioms also appear in §4 First-Order Theories for reference.
Mental Model for Arrays

- Arrays as Maps: In formal verification, an array is not a block of memory; it is a Function (or Map) from indices to values.
- Select and Store: We interact with this map using two operations:
select(a, i)(reading) andstore(a, i, v)(writing). - Immutable Updates:
storedoes not “change” an array. It returns a new array that is identical to the old one except at index . - Axiomatic Reasoning: We reason about arrays using the Read-over-Write axioms, which tell us exactly what happens to an index after a store operation.
The SMT Theory of Arrays ()

The signature includes .
Key Axioms
- Read-over-Write (Hit):
- Intuition: If you write to index and then read from , you are guaranteed to get .
- Read-over-Write (Miss):
- Intuition: Writing to index does not change the value at any other index .
- Extensionality:
- Intuition: Two arrays and are the same array object if and only if they map every index to the same value.
Arrays in Boostan

We extend Boostan to support array assignments like a[i] := expr.
1. Syntax Extension

- Left-hand side (LHS): Can now be a variable
xor an array accessa[i]. - Grammar: .
2. Relational Semantics

The relation for a[i] := expr is defined by:
- For all other variables and arrays, .
Array Assignment in Hoare Logic
We add a new rule to the Hoare Proof System to handle array updates:
Array Assignment Axiom (arrassig)

The formal rule is:
💡 Substitution Example
To prove that { \text{select}(a, 5) = 42 } is a postcondition for a[5] := 42, we find the weakest precondition:
- Postcondition :
- Substitute with :
- Simplify using Read-over-Write (Hit):
- Result: The precondition is simply
True.
Summary
- Verification Arrays are total maps from indices to values.
- Select is for reading; Store is for writing.
- Read-over-Write axioms allow a computer to “calculate” the effect of an array update.
- Extensionality allows us to prove that two arrays are identical.
- Hoare Logic handles arrays by treating the update as a substitution of the entire array object.
Self-Check
- Why does verification model arrays as total maps from indices to values, rather than as blocks of memory?
Answer
Total maps fit cleanly into first-order logic: each array is a function symbol with
selectandstoreas operations, and the read-over-write axioms describe their behavior. The memory-block view would force the logic to talk about addresses, allocation, and aliasing, which is much harder to axiomatize and decide.
- State the two read-over-write axioms and what each one guarantees.
Answer
Hit: says reading the index you just wrote returns the value you wrote. Miss: says writing index leaves every other index unchanged. Together they specify the entire input-output behavior of
storeandselect.
- What does the extensionality axiom let you prove about arrays?
Answer
. Two arrays are equal exactly when they map every index to the same value. This lets you reason about array equality elementwise instead of pointwise on a specific representation.
- State the array-assignment axiom of Hoare logic and explain its substitution.
Answer
. The whole array name
ain the postcondition is replaced by the updated array termstore(a, i, expr). Like ordinary assignment, the rule reads backward: predict the precondition by substituting the updated value into the postcondition.
- Use the array-assignment rule to derive the weakest precondition of
a[5] := 42for the postcondition .
Answer
Substitute with in the postcondition: . Apply read-over-write Hit to simplify the left-hand side to , giving , which is
true. So the weakest precondition istrue.
Back to Program Verification Index | Previous: (y-09) Ultimate Referee | Next: (y-11) Nondeterminism: Havoc and Assume | (y) Return to Notes | (y) Return to Home