Proof: Addi Insn 13
Let's prove the following theorem:
if the following are true:
- instruction #7 is
addi dst=4 src=4 imm=1 - the PC at time 13 = 7
- value of cell 4 at time 13 = 1
then value of cell 4 at time 14 = 2
Instructions
| Memory Cells |
|---|
| Program Counter | Time |
|---|---|
| 0 | 0 |
LW Computer Simulator
Proof:
Given
| 1 | instruction #7 is addi dst=4 src=4 imm=1 |
|---|---|
| 2 | the PC at time 13 = 7 |
| 3 | value of cell 4 at time 13 = 1 |
| # | Claim | Reason |
|---|---|---|
| 1 | value of cell 4 at time (13 + 1) = (value of cell 4 at time 13) + 1 | if instruction #7 is addi dst=4 src=4 imm=1 and the PC at time 13 = 7, then value of cell 4 at time (13 + 1) = (value of cell 4 at time 13) + 1 |
| 2 | 13 + 1 = 14 | 13 + 1 = 14 |
| 3 | value of cell 4 at time (13 + 1) = value of cell 4 at time 14 | if 13 + 1 = 14, then value of cell 4 at time (13 + 1) = value of cell 4 at time 14 |
| 4 | value of cell 4 at time 14 = (value of cell 4 at time 13) + 1 | if value of cell 4 at time (13 + 1) = value of cell 4 at time 14 and value of cell 4 at time (13 + 1) = (value of cell 4 at time 13) + 1, then value of cell 4 at time 14 = (value of cell 4 at time 13) + 1 |
| 5 | value of cell 4 at time 14 = 1 + 1 | if value of cell 4 at time 14 = (value of cell 4 at time 13) + 1 and value of cell 4 at time 13 = 1, then value of cell 4 at time 14 = 1 + 1 |
| 6 | 1 + 1 = 2 | 1 + 1 = 2 |
| 7 | value of cell 4 at time 14 = 2 | if value of cell 4 at time 14 = 1 + 1 and 1 + 1 = 2, then value of cell 4 at time 14 = 2 |
Comments
Please log in to add comments