Review: pick the right tool
Mixed proofs about lights and fees, with no step checklist.
In this course 8 / 8
No new material: each exercise mixes the tools of this course, and none has a checklist. Before each one, ask which tool fits the goal: unfold to look inside a definition, simp to simplify, omega for arithmetic, cases to split a value of an inductive type, contradiction for impossible branches.
The traffic light from Lean foundations is given above the editor: next moves red to green, green to yellow and yellow to red, and canGo is true only for green.
Worked example
example (l : Light) (h : l = Light.red) : canGo (next l) = true := by
rw [h]
rfl
At the start of the proof on line 1. Everything above ⊢ may be used; the line below it is what must be proved.
With h the light is known, so after rewriting everything computes.
Match the tool to the goal: unfold to look inside, simp to simplify, omega for arithmetic, cases to split, contradiction for the impossible.
Prove that after three steps a light is back where it started.
\to in the editor, or click:Where you start. Everything above ⊢ may be assumed; the line below it is what you must prove.
Knowledge check
Answer without looking back, then check your reasoning.
correct