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