Proof: Load 21
Let's prove the following theorem:
if the following are true:
- instruction #21 is
load dst=3 addr=1 imm=0
- the PC at time 21 = 21
- value of cell 1 at time 21 = 123
- value of cell 123 at time 21 = 5
then value of cell 3 at time 22 = 5
Proof:
Given
1 | instruction #21 is load dst=3 addr=1 imm=0 |
---|---|
2 | the PC at time 21 = 21 |
3 | value of cell 1 at time 21 = 123 |
4 | value of cell 123 at time 21 = 5 |
# | Claim | Reason |
---|---|---|
1 | value of cell 3 at time (21 + 1) = value of cell ((value of cell 1 at time 21) + 0) at time 21 | if instruction #21 is load dst=3 addr=1 imm=0 and the PC at time 21 = 21, then value of cell 3 at time (21 + 1) = value of cell ((value of cell 1 at time 21) + 0) at time 21 |
2 | (value of cell 1 at time 21) + 0 = 123 + 0 | if value of cell 1 at time 21 = 123, then (value of cell 1 at time 21) + 0 = 123 + 0 |
3 | 123 + 0 = 123 | 123 + 0 = 123 |
4 | (value of cell 1 at time 21) + 0 = 123 | if (value of cell 1 at time 21) + 0 = 123 + 0 and 123 + 0 = 123, then (value of cell 1 at time 21) + 0 = 123 |
5 | value of cell ((value of cell 1 at time 21) + 0) at time 21 = value of cell 123 at time 21 | if (value of cell 1 at time 21) + 0 = 123, then value of cell ((value of cell 1 at time 21) + 0) at time 21 = value of cell 123 at time 21 |
6 | value of cell ((value of cell 1 at time 21) + 0) at time 21 = 5 | if value of cell ((value of cell 1 at time 21) + 0) at time 21 = value of cell 123 at time 21 and value of cell 123 at time 21 = 5, then value of cell ((value of cell 1 at time 21) + 0) at time 21 = 5 |
7 | value of cell 3 at time (21 + 1) = 5 | if value of cell 3 at time (21 + 1) = value of cell ((value of cell 1 at time 21) + 0) at time 21 and value of cell ((value of cell 1 at time 21) + 0) at time 21 = 5, then value of cell 3 at time (21 + 1) = 5 |
8 | 21 + 1 = 22 | 21 + 1 = 22 |
9 | value of cell 3 at time (21 + 1) = value of cell 3 at time 22 | if 21 + 1 = 22, then value of cell 3 at time (21 + 1) = value of cell 3 at time 22 |
10 | value of cell 3 at time 22 = 5 | if value of cell 3 at time (21 + 1) = value of cell 3 at time 22 and value of cell 3 at time (21 + 1) = 5, then value of cell 3 at time 22 = 5 |
Comments
Please log in to add comments