Log inStart free
LESSON 16.01 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

State and transitions: preconditions, effects and invariants

Watch one robot action pass its checks, change the state and survive a crash.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 16.01 · WAREHOUSE BAYROBOT AT CELL 19 · CARRIES 1 OF 2
01
Stage 1 of 6 · Entities
The entities are a robot, three shelves, a cart and a packing station. The list below names relationships: the robot carries item a.
Explain it simply

You see a small warehouse floor from above. The robot walks on the open cells, and the solid grey blocks are racks it can't enter. Each shelf holds items, and the robot carries what it picked. These things are the entities. The list under the floor names how they relate, their relationships.

A 6 by 4 floor. The robot is on shelf B in cell 19 and carries a. The cart is in cell 20. The order needs items a, b and c.

stateresourcesaction, new state and passed checksfailed checkscart and latent fields
012345station6A78910C111213141516171819B20cart212223Rabccaorder needs a, b, c · packed 0 · clock 5 of 30entityfieldvaluerobotshelvesstationworldcell19carriedabattery19A stock1B stock1C stock2packednoneclock t5relationshipsrobot stands on cell 19robot carries ashelf A holds 1 of item ashelf B holds 1 of item bshelf C holds 2 of item cthe order needs a, b, c at the stationwarehouse floorstate by entity012345station6A78910C111213141516171819B20cart212223Rabccaorder needs a, b, c · packed 0 · clock 5 of 30entityfieldvaluerobotshelvesstationworldcell19carriedabattery19A stock1B stock1C stock2packednoneclock t5relationshipsrobot stands on cell 19robot carries ashelf A holds 1 of item ashelf B holds 1 of item bshelf C holds 2 of item cthe order needs a, b, c at the stationwarehouse floorstate by entity
Toy: the 16.C2 warehouse, a 6 × 4 floor, 1 robot, 3 shelves, 1 cart
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
st=(robot,shelves,station,clock)\sy{s}{data}{s_t} = (\text{robot}, \text{shelves}, \text{station}, \text{clock})
robot: cell 19, carried {a}, battery 19\text{robot: cell } 19,\ \text{carried } \{a\},\ \text{battery } 19

The state lists every entity and its fields.

Common mix-ups

MYTHIf every invariant passes, the step did the right thing.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With hands full, does a pick pass its preconditions?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.