Proof: Push Method Arguments Example
Let's prove the following theorem:
if the following are true:
- expression state at time 54 = "begin_expr"
- the expression at time 54 =
p.age_in_months()
- arguments stack at time 54 = [ ]
then arguments stack at time 55 = [ [ ], [ ] ]
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Proof:
Given
1 | expression state at time 54 = "begin_expr" |
---|---|
2 | the expression at time 54 = p.age_in_months() |
3 | arguments stack at time 54 = [ ] |
# | Claim | Reason |
---|---|---|
1 | arguments stack at time (54 + 1) = [ [ ], arguments stack at time 54 ] | if expression state at time 54 = "begin_expr" and the expression at time 54 = p.age_in_months() , then arguments stack at time (54 + 1) = [ [ ], arguments stack at time 54 ] |
2 | [ [ ], arguments stack at time 54 ] = [ [ ], [ ] ] | if arguments stack at time 54 = [ ], then [ [ ], arguments stack at time 54 ] = [ [ ], [ ] ] |
3 | arguments stack at time (54 + 1) = [ [ ], [ ] ] | if arguments stack at time (54 + 1) = [ [ ], arguments stack at time 54 ] and [ [ ], arguments stack at time 54 ] = [ [ ], [ ] ], then arguments stack at time (54 + 1) = [ [ ], [ ] ] |
4 | 54 + 1 = 55 | 54 + 1 = 55 |
5 | arguments stack at time (54 + 1) = arguments stack at time 55 | if 54 + 1 = 55, then arguments stack at time (54 + 1) = arguments stack at time 55 |
6 | arguments stack at time 55 = [ [ ], [ ] ] | if arguments stack at time (54 + 1) = arguments stack at time 55 and arguments stack at time (54 + 1) = [ [ ], [ ] ], then arguments stack at time 55 = [ [ ], [ ] ] |
Comments
Please log in to add comments