Proof: Begin Constructor Arguments 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)
- arguments stack at time 9 = [ ]
then arguments stack at time 10 = [ [ "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 | arguments stack at time 9 = [ ] |
# | Claim | Reason |
---|---|---|
1 | arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ] | if expression state at time 9 = "begin_expr" and the expression at time 9 = Person("John", "Smith", 25) , then arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ] |
2 | [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ] = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ] | if arguments stack at time 9 = [ ], then [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ] = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ] |
3 | arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ] | if arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ] and [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ] = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ], then arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ] |
4 | 9 + 1 = 10 | 9 + 1 = 10 |
5 | arguments stack at time (9 + 1) = arguments stack at time 10 | if 9 + 1 = 10, then arguments stack at time (9 + 1) = arguments stack at time 10 |
6 | arguments stack at time 10 = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ] | if arguments stack at time (9 + 1) = arguments stack at time 10 and arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ], then arguments stack at time 10 = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], [ ] ] |
Comments
Please log in to add comments