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