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