Proof: Subtracti Insn 3
Let's prove the following theorem:
if the following are true:
- subtract immediate instruction with dst: 1 src: 1 and immediate: 1 at 9
- the PC at time 3 = 9
- value of cell 1 at time 3 = 128
then value of cell 1 at time 4 = 127
Proof:
Given
| 1 | subtract immediate instruction with dst: 1 src: 1 and immediate: 1 at 9 |
|---|---|
| 2 | the PC at time 3 = 9 |
| 3 | value of cell 1 at time 3 = 128 |
| # | Claim | Reason |
|---|---|---|
| 1 | value of cell 1 at time (3 + 1) = (value of cell 1 at time 3) - 1 | if subtract immediate instruction with dst: 1 src: 1 and immediate: 1 at 9 and the PC at time 3 = 9, then value of cell 1 at time (3 + 1) = (value of cell 1 at time 3) - 1 |
| 2 | 3 + 1 = 4 | 3 + 1 = 4 |
| 3 | value of cell 1 at time (3 + 1) = value of cell 1 at time 4 | if 3 + 1 = 4, then value of cell 1 at time (3 + 1) = value of cell 1 at time 4 |
| 4 | value of cell 1 at time 4 = (value of cell 1 at time 3) - 1 | if value of cell 1 at time (3 + 1) = value of cell 1 at time 4 and value of cell 1 at time (3 + 1) = (value of cell 1 at time 3) - 1, then value of cell 1 at time 4 = (value of cell 1 at time 3) - 1 |
| 5 | (value of cell 1 at time 3) - 1 = 128 - 1 | if value of cell 1 at time 3 = 128, then (value of cell 1 at time 3) - 1 = 128 - 1 |
| 6 | value of cell 1 at time 4 = 128 - 1 | if value of cell 1 at time 4 = (value of cell 1 at time 3) - 1 and (value of cell 1 at time 3) - 1 = 128 - 1, then value of cell 1 at time 4 = 128 - 1 |
| 7 | 128 - 1 = 127 | 128 - 1 = 127 |
| 8 | value of cell 1 at time 4 = 127 | if value of cell 1 at time 4 = 128 - 1 and 128 - 1 = 127, then value of cell 1 at time 4 = 127 |
Comments
Please log in to add comments