End Breaking Line Property

If the "break" state is "breaking" and there is a loop (such as "while") statement in "Current Tab" - 1, then "Current Line" is increased by 1. More formally,

if the following are true:
  • the line at time t = i
  • the tab at time t = j
  • "break" state at t = "breaking"
  • value at (j - 1) in map (Control Map at time t) = control_value
  • control_value describes a loop = True

then the line at time (t + 1) = i + 1

If LW Python finds a "while" statement on "Current Tab" - 1, then the "breaking" state is finished, and the "Current Line" is increased by 1.

For example,

  • the line at time 83 = 6
  • the tab at time 83 = 1
  • "break" state at 83 = "breaking"
  • Control Map at time 83 = [ entry 0: (pair ("while", 3)), [ entry 1: (pair ("if", True)), [ ] ] ]

We know that

value at 0 in map [ entry 0: (pair ("while", 3)), [ entry 1: (pair ("if", True)), [ ] ] ] = pair ("while", 3)

We use substitution to conclude that:

value at 0 in map (Control Map at time 83) = pair ("while", 3)

Finally, since 1 - 1 = 0, we conclude that:

value at (1 - 1) in map (Control Map at time 83) = pair ("while", 3)

See the full proof here.

Thus, there is a "While" statement at tab 1 - 1. Then we can conclude the following: the line at time (83 + 1) = 6 + 1

Try stepping through the simulator to see the "Current Line" increase from 6 to 7.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments