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