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