Proof: Assign Constructor to Variable Property Example
Let's prove the following theorem:
if the following are true:
- the line at time 52 = 8
- the tab at time 52 = 0
- statement at line 8, tab 0 =
p = Person("John", "Smith", 25)
- expression state at time 52 = "end_expr"
- Variables Map at time 52 = [ ]
- Return Value at time 52 = Python reference 0
then Variables Map at time 53 = [ entry p: (Python reference 0), [ ] ]
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Proof:
Given
1 | the line at time 52 = 8 |
---|---|
2 | the tab at time 52 = 0 |
3 | statement at line 8, tab 0 = p = Person("John", "Smith", 25) |
4 | expression state at time 52 = "end_expr" |
5 | Variables Map at time 52 = [ ] |
6 | Return Value at time 52 = Python reference 0 |
# | Claim | Reason |
---|---|---|
1 | Variables Map at time (52 + 1) = result of storing (Return Value at time 52) at key: p in map: (Variables Map at time 52) | if the line at time 52 = 8 and the tab at time 52 = 0 and statement at line 8, tab 0 = p = Person("John", "Smith", 25) and expression state at time 52 = "end_expr", then Variables Map at time (52 + 1) = result of storing (Return Value at time 52) at key: p in map: (Variables Map at time 52) |
2 | result of storing (Return Value at time 52) at key: p in map: (Variables Map at time 52) = result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) | if Return Value at time 52 = Python reference 0, then result of storing (Return Value at time 52) at key: p in map: (Variables Map at time 52) = result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) |
3 | Variables Map at time (52 + 1) = result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) | if Variables Map at time (52 + 1) = result of storing (Return Value at time 52) at key: p in map: (Variables Map at time 52) and result of storing (Return Value at time 52) at key: p in map: (Variables Map at time 52) = result of storing (Python reference 0) at key: p in map: (Variables Map at time 52), then Variables Map at time (52 + 1) = result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) |
4 | result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) = result of storing (Python reference 0) at key: p in map: [ ] | if Variables Map at time 52 = [ ], then result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) = result of storing (Python reference 0) at key: p in map: [ ] |
5 | result of storing (Python reference 0) at key: p in map: [ ] = [ entry p: (Python reference 0), [ ] ] | result of storing (Python reference 0) at key: p in map: [ ] = [ entry p: (Python reference 0), [ ] ] |
6 | result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) = [ entry p: (Python reference 0), [ ] ] | if result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) = result of storing (Python reference 0) at key: p in map: [ ] and result of storing (Python reference 0) at key: p in map: [ ] = [ entry p: (Python reference 0), [ ] ], then result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) = [ entry p: (Python reference 0), [ ] ] |
7 | Variables Map at time (52 + 1) = [ entry p: (Python reference 0), [ ] ] | if Variables Map at time (52 + 1) = result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) and result of storing (Python reference 0) at key: p in map: (Variables Map at time 52) = [ entry p: (Python reference 0), [ ] ], then Variables Map at time (52 + 1) = [ entry p: (Python reference 0), [ ] ] |
8 | 52 + 1 = 53 | 52 + 1 = 53 |
9 | Variables Map at time (52 + 1) = Variables Map at time 53 | if 52 + 1 = 53, then Variables Map at time (52 + 1) = Variables Map at time 53 |
10 | Variables Map at time 53 = [ entry p: (Python reference 0), [ ] ] | if Variables Map at time (52 + 1) = Variables Map at time 53 and Variables Map at time (52 + 1) = [ entry p: (Python reference 0), [ ] ], then Variables Map at time 53 = [ entry p: (Python reference 0), [ ] ] |
Comments
Please log in to add comments