Stage 03 · Step 11 of 50

If this, then that.

Core Lean8 minutesLean 4.36.0

01The idea

A promise can say, “Give me a ticket, and I will let you in.” An implication describes what follows from an assumption. To prove one, temporarily accept its premise.

Tacto · Your guide for this idea
Tacto pointing

02In maths

For every proposition P, P implies P.

Picture it

Proving an implication: accept the premise, then use itTop: an implication is a promise machine. Put a proof of P in, and a proof of P comes out. Bottom: three goal cards. First the goal is P implies P. The tactic intro h puts h, a proof of P, into what you have, and the goal becomes P. The tactic exact h hands over h, leaving no goals.Pif you give me…P → PP…I give you thisSTARTP : Prop⊢ P → Pintro hACCEPT THE PREMISEP : Proph : P⊢ Pexact hUSE ITno goals

Swipe sideways to see the whole picture.

An implication P → P is a promise: “give me a proof of P, and I’ll give you a proof of P.” To prove a promise, pretend you were just handed the input. intro h names it h and puts it in your backpack. Now the goal is only P, and h is exactly that.

03In Lean

This code comes directly from the file checked by Lean.

E11.leanTry it live (opens official Lean editor)
example (P : Prop) : P → P := by
  intro h
  exact h

The symbol → means “implies” between propositions. Type it with \to.

The left side is the premise. The right side is the conclusion. A proof of the implication must work for any proof of its premise.

The tactic intro names the assumed proof. It changes the goal from an implication to its conclusion.

04Step by step

Choose a line to see Lean’s recorded goal state after that line.

After line 1
P : Prop
⊢ P → P
After line 1: example (P : Prop) : P → P := by
P : Prop
⊢ P → P
After line 2: intro h
P : Prop
h : P
⊢ P
After line 3: exact h
no goals

05Lean says

Captured from Lean 4.36.0
no goals

A goal is what remains to prove. The symbol ⊢ points to it. Meet the turnstile.

07Your turn

sorry is a placeholder for unfinished work. Replace it as you solve each task. A finished proof has no placeholders.

  1. Warm-up

    Prove that P implies that Q implies P.

  2. A little stretch

    Chain a proof from P to Q with one from Q to R.

Exercises/E11.leanTry it live (opens official Lean editor)
example (P Q : Prop) : P → Q → P := by
  sorry

example (P Q R : Prop) (f : P → Q) (g : Q → R) : P → R := by
  sorry

08A quick check

1. How do you read P → Q?

Read the answer and explanation

P implies Q. An implication converts a proof of P into a proof of Q.

2. What does intro do here?

Read the answer and explanation

Adds the premise to the context. You may assume the premise while proving the conclusion.

One more idea in your toolkit.

Take your time. Progress is yours to mark.