Proof: Addi Insn 19
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 19 = 7
- value of cell 4 at time 19 = 2
then value of cell 4 at time 20 = 3
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 19 = 7 |
3 | value of cell 4 at time 19 = 2 |
# | Claim | Reason |
---|---|---|
1 | value of cell 4 at time (19 + 1) = (value of cell 4 at time 19) + 1 | if instruction #7 is addi dst=4 src=4 imm=1 and the PC at time 19 = 7, then value of cell 4 at time (19 + 1) = (value of cell 4 at time 19) + 1 |
2 | 19 + 1 = 20 | 19 + 1 = 20 |
3 | value of cell 4 at time (19 + 1) = value of cell 4 at time 20 | if 19 + 1 = 20, then value of cell 4 at time (19 + 1) = value of cell 4 at time 20 |
4 | value of cell 4 at time 20 = (value of cell 4 at time 19) + 1 | if value of cell 4 at time (19 + 1) = value of cell 4 at time 20 and value of cell 4 at time (19 + 1) = (value of cell 4 at time 19) + 1, then value of cell 4 at time 20 = (value of cell 4 at time 19) + 1 |
5 | value of cell 4 at time 20 = 2 + 1 | if value of cell 4 at time 20 = (value of cell 4 at time 19) + 1 and value of cell 4 at time 19 = 2, then value of cell 4 at time 20 = 2 + 1 |
6 | 2 + 1 = 3 | 2 + 1 = 3 |
7 | value of cell 4 at time 20 = 3 | if value of cell 4 at time 20 = 2 + 1 and 2 + 1 = 3, then value of cell 4 at time 20 = 3 |
Comments
Please log in to add comments