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