Module 1 · Lesson 4

Proof Workflow

Learn a repeatable process for building proofs: read the goal, introduce assumptions, simplify, and close with a finishing tactic.

Read the Goal First

Every proof starts with a goal. Before choosing a tactic, identify the shape of the goal and what it expects. The goal appears after the symbol in the Infoview. Understanding the goal's structure—whether it's an implication, a universal statement, an equality, or a conjunction—determines which tactic to use.

Common goal shapes and their meanings:

  • P → Q: An implication—assume P, prove Q
  • ∀ x, P x: A universal—prove P for an arbitrary x
  • a = b: An equality—show both sides are the same
  • P ∧ Q: A conjunction—prove both P and Q
  • P ∨ Q: A disjunction—prove at least one of P or Q
lean
1example : Nat Nat := by
2 -- Goal: Nat → Nat
3 -- This is a function type, so we introduce the input
4 intro n
5 -- Goal: Nat
6 -- Now we just need to produce a Nat
7 exact n + 1

The Infoview updates after each tactic, showing how the goal changes. Watch it like a debugging panel—it tells you exactly what remains to prove.

Introduce, Then Simplify

Most goals become easier once you move assumptions into context and simplify the target. The general strategy is: first use intro to bring universals and implications into your hypothesis list, then use simp orrw to clean up the goal.

This "introduce then simplify" pattern handles the majority of proofs:

lean
1-- Simple simplification
2example (n : Nat) : n + 0 = n := by
3 simp -- simp knows n + 0 = n
4
5-- Reflexivity when both sides are identical
6example (n : Nat) : n = n := by
7 rfl -- Both sides compute to the same thing

When you have hypotheses available, include them in your simplification:

lean
1example (a b : Nat) (h : a = b) : a + 1 = b + 1 := by
2 simp [h] -- Uses h to rewrite a to b, then simplifies
3
4example (n : Nat) (h : n = 5) : n + 0 = 5 := by
5 simp only [Nat.add_zero, h] -- Explicit about which lemmas

Close with a Finisher

If the goal is exactly a hypothesis, use exact orassumption. If it’s a definitional equality, try rfl. These "finisher" tactics close the proof when only the final step remains.

exact requires you to specify exactly which term proves the goal.assumption searches your hypotheses automatically. Useexact when you know what you need; use assumptionwhen the answer is obviously in scope.

lean
1-- exact: specify the proof term
2example (P Q : Prop) (hp : P) : P := by
3 exact hp
4
5-- assumption: auto-search hypotheses
6example (P Q : Prop) (hp : P) (hq : Q) : P := by
7 assumption -- Finds hp automatically
8
9-- rfl: definitional equality
10example : (2 : Nat) = 2 := by
11 rfl
12
13-- trivial: handles True and similar goals
14example : True := by
15 trivial

If none of these work, your goal likely needs further transformation. Go back to simplification or try rewriting with rw.

Pick the Right Tactic

A fast workflow is about choosing the simplest tactic that moves the goal forward. Here's a quick reference for common goal shapes:

Goal ShapePrimary TacticWhat It Does
P → QintroAssume P, prove Q
∀ x, P xintroLet x be arbitrary
P ∧ QconstructorSplit into two goals
P ∨ Qleft or rightPick which to prove
a = brfl, rw, simpMake sides equal
∃ x, P xuseProvide a witness

When in doubt, try simp first. It often cleans up the goal enough that the next step becomes obvious.

💡
Use simp early. It often turns a complicated goal into somethingrfl can close.

Debugging Stuck Proofs

Even experienced users get stuck. Here's how to diagnose and fix common issues:

Check the Goal Carefully

Sometimes the goal looks right but has subtle differences—like implicit arguments or different universes. Hover over terms in the Infoview to see their full types.

Use simp? and exact?

These "?" tactics suggest what to use:

lean
1example (n : Nat) : n + 0 = n := by
2 simp? -- Suggests: Try this: simp only [Nat.add_zero]
3
4example (P : Prop) (hp : P) : P := by
5 exact? -- Suggests: Try this: exact hp

Break Complex Goals Apart

If the goal is overwhelming, use have to prove intermediate steps:

lean
1example (a b c : Nat) : a + b + c = c + b + a := by
2 have h1 : a + b = b + a := Nat.add_comm a b
3 have h2 : b + a + c = c + (b + a) := by ring
4 ring -- Now the goal is simpler
Exercise: The Minimal Proof

Use intro and exact to prove the following:

lean
1example (P Q : Prop) : P Q P := by
2 intro hp hq
3 exact hp
Exercise: Conjunction Goal

Use constructor to prove a conjunction.

lean
1example (P Q : Prop) (hp : P) (hq : Q) : P Q := by
2 constructor
3 · exact hp
4 · exact hq
Key Takeaway
A reliable tactic loop is: read the goal → introduce → simplify → finish. The more you practice, the faster you’ll pick the right tool.