Proof: Byte 4 Stays the Same 16
Let's prove the following theorem:
if the following are true:
- instruction #4 is
add dst=3 src1=1 src2=2
- the PC at time 16 = 4
- value of cell 4 at time 16 = 2
then value of cell 4 at time 17 = 2
Instructions
Memory Cells |
---|
Program Counter | Time |
---|---|
0 | 0 |
LW Computer Simulator
Proof:
Given
1 | instruction #4 is add dst=3 src1=1 src2=2 |
---|---|
2 | the PC at time 16 = 4 |
3 | value of cell 4 at time 16 = 2 |
# | Claim | Reason |
---|---|---|
1 | not (4 = 3) | not (4 = 3) |
2 | value of cell 4 at time (16 + 1) = value of cell 4 at time 16 | if instruction #4 is add dst=3 src1=1 src2=2 and the PC at time 16 = 4 and not (4 = 3), then value of cell 4 at time (16 + 1) = value of cell 4 at time 16 |
3 | 16 + 1 = 17 | 16 + 1 = 17 |
4 | value of cell 4 at time (16 + 1) = value of cell 4 at time 17 | if 16 + 1 = 17, then value of cell 4 at time (16 + 1) = value of cell 4 at time 17 |
5 | value of cell 4 at time 17 = value of cell 4 at time 16 | if value of cell 4 at time (16 + 1) = value of cell 4 at time 17 and value of cell 4 at time (16 + 1) = value of cell 4 at time 16, then value of cell 4 at time 17 = value of cell 4 at time 16 |
6 | value of cell 4 at time 17 = 2 | if value of cell 4 at time 17 = value of cell 4 at time 16 and value of cell 4 at time 16 = 2, then value of cell 4 at time 17 = 2 |
Comments
Please log in to add comments