Proof: Beq Branch
Let's prove the following theorem:
if the following are true:
- instruction #5 is
beq left=3 right=4 imm=1 - the PC at time 13 = 5
- value of cell 3 at time 13 = 3
- value of cell 4 at time 13 = 3
then the PC at time 14 = 7
Proof:
Given
| 1 | instruction #5 is beq left=3 right=4 imm=1 |
|---|---|
| 2 | the PC at time 13 = 5 |
| 3 | value of cell 3 at time 13 = 3 |
| 4 | value of cell 4 at time 13 = 3 |
| # | Claim | Reason |
|---|---|---|
| 1 | value of cell 3 at time 13 = value of cell 4 at time 13 | if value of cell 3 at time 13 = 3 and value of cell 4 at time 13 = 3, then value of cell 3 at time 13 = value of cell 4 at time 13 |
| 2 | the PC at time (13 + 1) = (5 + 1) + 1 | if instruction #5 is beq left=3 right=4 imm=1 and the PC at time 13 = 5 and value of cell 3 at time 13 = value of cell 4 at time 13, then the PC at time (13 + 1) = (5 + 1) + 1 |
| 3 | (5 + 1) + 1 = 7 | (5 + 1) + 1 = 7 |
| 4 | the PC at time (13 + 1) = 7 | if the PC at time (13 + 1) = (5 + 1) + 1 and (5 + 1) + 1 = 7, then the PC at time (13 + 1) = 7 |
| 5 | 13 + 1 = 14 | 13 + 1 = 14 |
| 6 | the PC at time (13 + 1) = the PC at time 14 | if 13 + 1 = 14, then the PC at time (13 + 1) = the PC at time 14 |
| 7 | the PC at time 14 = 7 | if the PC at time (13 + 1) = the PC at time 14 and the PC at time (13 + 1) = 7, then the PC at time 14 = 7 |
Comments
Please log in to add comments