Proof: Beq No Branch 12
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 12 = 5
- value of cell 3 at time 12 = 3
- value of cell 4 at time 12 = 2
then the PC at time 13 = 6
Proof:
Given
| 1 | instruction #5 is beq left=3 right=4 imm=1 |
|---|---|
| 2 | the PC at time 12 = 5 |
| 3 | value of cell 3 at time 12 = 3 |
| 4 | value of cell 4 at time 12 = 2 |
| # | Claim | Reason |
|---|---|---|
| 1 | value of cell 3 at time 12 = 2 = 3 = 2 | if value of cell 3 at time 12 = 3, then value of cell 3 at time 12 = 2 = 3 = 2 |
| 2 | not (value of cell 3 at time 12 = 2) = not (3 = 2) | if value of cell 3 at time 12 = 2 = 3 = 2, then not (value of cell 3 at time 12 = 2) = not (3 = 2) |
| 3 | not (3 = 2) | not (3 = 2) |
| 4 | not (value of cell 3 at time 12 = 2) | if not (3 = 2) and not (value of cell 3 at time 12 = 2) = not (3 = 2), then not (value of cell 3 at time 12 = 2) |
| 5 | value of cell 3 at time 12 = value of cell 4 at time 12 = value of cell 3 at time 12 = 2 | if value of cell 4 at time 12 = 2, then value of cell 3 at time 12 = value of cell 4 at time 12 = value of cell 3 at time 12 = 2 |
| 6 | not (value of cell 3 at time 12 = value of cell 4 at time 12) = not (value of cell 3 at time 12 = 2) | if value of cell 3 at time 12 = value of cell 4 at time 12 = value of cell 3 at time 12 = 2, then not (value of cell 3 at time 12 = value of cell 4 at time 12) = not (value of cell 3 at time 12 = 2) |
| 7 | not (value of cell 3 at time 12 = value of cell 4 at time 12) | if not (value of cell 3 at time 12 = 2) and not (value of cell 3 at time 12 = value of cell 4 at time 12) = not (value of cell 3 at time 12 = 2), then not (value of cell 3 at time 12 = value of cell 4 at time 12) |
| 8 | the PC at time (12 + 1) = 5 + 1 | if instruction #5 is beq left=3 right=4 imm=1 and the PC at time 12 = 5 and not (value of cell 3 at time 12 = value of cell 4 at time 12), then the PC at time (12 + 1) = 5 + 1 |
| 9 | 12 + 1 = 13 | 12 + 1 = 13 |
| 10 | the PC at time (12 + 1) = the PC at time 13 | if 12 + 1 = 13, then the PC at time (12 + 1) = the PC at time 13 |
| 11 | 5 + 1 = 6 | 5 + 1 = 6 |
| 12 | the PC at time 13 = 6 | if the PC at time (12 + 1) = 5 + 1 and the PC at time (12 + 1) = the PC at time 13 and 5 + 1 = 6, then the PC at time 13 = 6 |
Comments
Please log in to add comments