Proof: STORE Instruction Example 3
Let's prove the following theorem:
if the following are true:
- instruction #0 is
store src=5 addr=1 imm=1 - the PC at time 0 = 0
- value of cell 1 at time 0 = 3
then value of cell 2 at time 1 = value of cell 2 at time 0
The following example shows that when a STORE instruction with src = 5, addr = 1, and imm = 1 is executed, memory cell #4 is updated to a new value (9), but other cells, such as cell #2, remain unchanged.
Instructions
| Memory Cells |
|---|
| Program Counter | Time |
|---|---|
| 0 | 0 |
LW Computer Simulator
Proof:
Given
| 1 | instruction #0 is store src=5 addr=1 imm=1 |
|---|---|
| 2 | the PC at time 0 = 0 |
| 3 | value of cell 1 at time 0 = 3 |
| # | Claim | Reason |
|---|---|---|
| 1 | (value of cell 1 at time 0) + 1 = 3 + 1 | if value of cell 1 at time 0 = 3, then (value of cell 1 at time 0) + 1 = 3 + 1 |
| 2 | 3 + 1 = 4 | 3 + 1 = 4 |
| 3 | (value of cell 1 at time 0) + 1 = 4 | if (value of cell 1 at time 0) + 1 = 3 + 1 and 3 + 1 = 4, then (value of cell 1 at time 0) + 1 = 4 |
| 4 | 2 = (value of cell 1 at time 0) + 1 = 2 = 4 | if (value of cell 1 at time 0) + 1 = 4, then 2 = (value of cell 1 at time 0) + 1 = 2 = 4 |
| 5 | not (2 = (value of cell 1 at time 0) + 1) = not (2 = 4) | if 2 = (value of cell 1 at time 0) + 1 = 2 = 4, then not (2 = (value of cell 1 at time 0) + 1) = not (2 = 4) |
| 6 | not (2 = 4) | not (2 = 4) |
| 7 | not (2 = (value of cell 1 at time 0) + 1) | if not (2 = 4) and not (2 = (value of cell 1 at time 0) + 1) = not (2 = 4), then not (2 = (value of cell 1 at time 0) + 1) |
| 8 | value of cell 2 at time (0 + 1) = value of cell 2 at time 0 | if instruction #0 is store src=5 addr=1 imm=1 and the PC at time 0 = 0 and not (2 = (value of cell 1 at time 0) + 1), then value of cell 2 at time (0 + 1) = value of cell 2 at time 0 |
| 9 | 0 + 1 = 1 | 0 + 1 = 1 |
| 10 | value of cell 2 at time (0 + 1) = value of cell 2 at time 1 | if 0 + 1 = 1, then value of cell 2 at time (0 + 1) = value of cell 2 at time 1 |
| 11 | value of cell 2 at time 1 = value of cell 2 at time 0 | if value of cell 2 at time (0 + 1) = value of cell 2 at time 1 and value of cell 2 at time (0 + 1) = value of cell 2 at time 0, then value of cell 2 at time 1 = value of cell 2 at time 0 |
Comments
Please log in to add comments