Proof: Begin Constructor Parent Property Example
Let's prove the following theorem:
if the following are true:
- expression state at time 9 = "begin_expr"
- the expression at time 9 =
Person("John", "Smith", 25)
- parent stack at time 9 = [ ]
then parent stack at time 10 = [ Person("John", "Smith", 25)
, [ ] ]
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Proof:
Given
1 | expression state at time 9 = "begin_expr" |
---|---|
2 | the expression at time 9 = Person("John", "Smith", 25) |
3 | parent stack at time 9 = [ ] |
# | Claim | Reason |
---|---|---|
1 | parent stack at time (9 + 1) = [ Person("John", "Smith", 25) , parent stack at time 9 ] |
if expression state at time 9 = "begin_expr" and the expression at time 9 = Person("John", "Smith", 25) , then parent stack at time (9 + 1) = [ Person("John", "Smith", 25) , parent stack at time 9 ] |
2 | [ Person("John", "Smith", 25) , parent stack at time 9 ] = [ Person("John", "Smith", 25) , [ ] ] |
if parent stack at time 9 = [ ], then [ Person("John", "Smith", 25) , parent stack at time 9 ] = [ Person("John", "Smith", 25) , [ ] ] |
3 | parent stack at time (9 + 1) = [ Person("John", "Smith", 25) , [ ] ] |
if parent stack at time (9 + 1) = [ Person("John", "Smith", 25) , parent stack at time 9 ] and [ Person("John", "Smith", 25) , parent stack at time 9 ] = [ Person("John", "Smith", 25) , [ ] ], then parent stack at time (9 + 1) = [ Person("John", "Smith", 25) , [ ] ] |
4 | 9 + 1 = 10 | 9 + 1 = 10 |
5 | parent stack at time (9 + 1) = parent stack at time 10 | if 9 + 1 = 10, then parent stack at time (9 + 1) = parent stack at time 10 |
6 | parent stack at time 10 = [ Person("John", "Smith", 25) , [ ] ] |
if parent stack at time (9 + 1) = parent stack at time 10 and parent stack at time (9 + 1) = [ Person("John", "Smith", 25) , [ ] ], then parent stack at time 10 = [ Person("John", "Smith", 25) , [ ] ] |
Comments
Please log in to add comments