Proof: Proof: STORE Instruction Example

The following example shows what happens when a STORE instruction is executed.

More precisely, we prove that

Let's prove the following theorem:

if the following are true:
  • instruction #0 is store src=5 addr=1 imm=1
  • the PC at time 0 = 0
  • value of cell 1 at time 0 = 3
  • value of cell 5 at time 0 = 9

then value of cell 4 at time 1 = 9

Try out the example in the simulator:

Instructions
Memory Cells
Program Counter Time
0 0
LW Computer Simulator

The computer copies the value in memory cell #5 (9) to cell #4. The destination is calculated by adding the value in cell #1 (3) and the immediate (1).

Proof:

View as a tree | View dependent proofs | Try proving it

Given
1 instruction #0 is store src=5 addr=1 imm=1
2 the PC at time 0 = 0
3 value of cell 1 at time 0 = 3
4 value of cell 5 at time 0 = 9
Proof Table
# Claim Reason
1 value of cell ((value of cell 1 at time 0) + 1) at time (0 + 1) = value of cell 5 at time 0 if instruction #0 is store src=5 addr=1 imm=1 and the PC at time 0 = 0, then value of cell ((value of cell 1 at time 0) + 1) at time (0 + 1) = value of cell 5 at time 0
2 0 + 1 = 1 0 + 1 = 1
3 value of cell ((value of cell 1 at time 0) + 1) at time (0 + 1) = value of cell ((value of cell 1 at time 0) + 1) at time 1 if 0 + 1 = 1, then value of cell ((value of cell 1 at time 0) + 1) at time (0 + 1) = value of cell ((value of cell 1 at time 0) + 1) at time 1
4 (value of cell 1 at time 0) + 1 = 3 + 1 if value of cell 1 at time 0 = 3, then (value of cell 1 at time 0) + 1 = 3 + 1
5 value of cell ((value of cell 1 at time 0) + 1) at time 1 = value of cell (3 + 1) at time 1 if (value of cell 1 at time 0) + 1 = 3 + 1, then value of cell ((value of cell 1 at time 0) + 1) at time 1 = value of cell (3 + 1) at time 1
6 3 + 1 = 4 3 + 1 = 4
7 value of cell (3 + 1) at time 1 = value of cell 4 at time 1 if 3 + 1 = 4, then value of cell (3 + 1) at time 1 = value of cell 4 at time 1
8 value of cell (3 + 1) at time 1 = value of cell 5 at time 0 if value of cell ((value of cell 1 at time 0) + 1) at time (0 + 1) = value of cell ((value of cell 1 at time 0) + 1) at time 1 and value of cell ((value of cell 1 at time 0) + 1) at time 1 = value of cell (3 + 1) at time 1 and value of cell ((value of cell 1 at time 0) + 1) at time (0 + 1) = value of cell 5 at time 0, then value of cell (3 + 1) at time 1 = value of cell 5 at time 0
9 value of cell (3 + 1) at time 1 = 9 if value of cell (3 + 1) at time 1 = value of cell 5 at time 0 and value of cell 5 at time 0 = 9, then value of cell (3 + 1) at time 1 = 9
10 value of cell 4 at time 1 = 9 if value of cell (3 + 1) at time 1 = value of cell 4 at time 1 and value of cell (3 + 1) at time 1 = 9, then value of cell 4 at time 1 = 9

Comments

Please log in to add comments