Proof: LOAD Instruction Example 3
Let's prove the following theorem:
if the following are true:
- instruction #0 is
load dst=5 addr=1 imm=1
- the PC at time 0 = 0
then value of cell 2 at time 1 = value of cell 2 at time 0
The following example shows that when a LOAD instruction with dst = 5 is executed, memory cell #2 stays unchanged.
Instructions
Memory Cells |
---|
Program Counter | Time |
---|---|
0 | 0 |
LW Computer Simulator
Proof:
Given
1 | instruction #0 is load dst=5 addr=1 imm=1 |
---|---|
2 | the PC at time 0 = 0 |
# | Claim | Reason |
---|---|---|
1 | not (2 = 5) | not (2 = 5) |
2 | value of cell 2 at time (0 + 1) = value of cell 2 at time 0 | if instruction #0 is load dst=5 addr=1 imm=1 and the PC at time 0 = 0 and not (2 = 5), then value of cell 2 at time (0 + 1) = value of cell 2 at time 0 |
3 | 0 + 1 = 1 | 0 + 1 = 1 |
4 | 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 |
5 | 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