Proof: Assign Constant Example 2
Let's prove the following theorem:
if the following are true:
- the line at time 0 = 1
- the tab at time 0 = 0
- statement at line 1, tab 0 =
c = 16
- 16 is constant
then the line at time 1 = 2
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Line is initially 1. Using Constant Assignment Property 2, we claim that at time 0+1, line is 1+1. After some algebra, we conclude that the line at time 1 = 2.
Proof:
Given
1 | the line at time 0 = 1 |
---|---|
2 | the tab at time 0 = 0 |
3 | statement at line 1, tab 0 = c = 16 |
4 | 16 is constant |
# | Claim | Reason |
---|---|---|
1 | the line at time (0 + 1) = 1 + 1 | if the line at time 0 = 1 and the tab at time 0 = 0 and statement at line 1, tab 0 = c = 16 and 16 is constant, then the line at time (0 + 1) = 1 + 1 |
2 | 1 + 1 = 2 | 1 + 1 = 2 |
3 | the line at time (0 + 1) = 2 | if the line at time (0 + 1) = 1 + 1 and 1 + 1 = 2, then the line at time (0 + 1) = 2 |
4 | 0 + 1 = 1 | 0 + 1 = 1 |
5 | the line at time (0 + 1) = the line at time 1 | if 0 + 1 = 1, then the line at time (0 + 1) = the line at time 1 |
6 | the line at time 1 = 2 | if the line at time (0 + 1) = the line at time 1 and the line at time (0 + 1) = 2, then the line at time 1 = 2 |
Comments
Please log in to add comments