Stage 03 · Step 12 of 50

Prove both halves.

Core Lean8 minutesLean 4.36.0

01The idea

A two-item checklist needs two ticks. To prove an “and” statement, prove both parts.

Tacto · Your guide for this idea
Tacto pointing

Lean makes one goal for each part.

02In maths

Given P and Q separately, conclude P ∧ Q.

Picture it

Proving an “and”: a lock with two keyholesTop: a padlock labelled P and Q has two keyholes. Key hP, a proof of P, goes into the left keyhole and key hQ, a proof of Q, goes into the right one. The lock needs both keys. Bottom: the starting goal card has P Q : Prop, hP : P and hQ : Q, with goal P and Q. The tactic constructor splits it into two goals: case left with goal P, and case right with goal Q. exact hP closes the first and exact hQ closes the second, each shown with a green tick.P ∧ QhP : PhQ : Qopens only with BOTH keysSTARTP Q : ProphP : PhQ : Q⊢ P ∧ Qconstructorcase left⊢ Pexact hPcase right⊢ Qexact hQ

Swipe sideways to see the whole picture.

An “and” is a lock with two keyholes: you need a proof of P and a proof of Q. constructor splits the goal P ∧ Q into two goals, one per keyhole. Each gets its own key, exact hP and exact hQ, and the proof is finished only when both goals are closed.

03In Lean

This code comes directly from the file checked by Lean.

E12.leanTry it live (opens official Lean editor)
example (P Q : Prop) (hP : P) (hQ : Q) : P ∧ Q := by
  constructor
  · exact hP
  · exact hQ

The symbol ∧ means “and.” Type it with \and. Its technical name is conjunction.

The tactic constructor uses a way of building a value of the goal’s type. For a conjunction, it asks for both component proofs.

Each bullet · focuses one goal. Type that bullet with \cdot.

04Step by step

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

After line 1
P Q : Prop
hP : P
hQ : Q
⊢ P ∧ Q
After line 1: example (P Q : Prop) (hP : P) (hQ : Q) : P ∧ Q := by
P Q : Prop
hP : P
hQ : Q
⊢ P ∧ Q
After line 2: constructor
case left
P Q : Prop
hP : P
hQ : Q
⊢ P

case right
P Q : Prop
hP : P
hQ : Q
⊢ Q
After line 3: · exact hP
no goals
After line 4: · exact hQ
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

    Build a proof of P and P from a single proof of P.

  2. A little stretch

    Build P and (Q and R) from the three supplied proofs.

Exercises/E12.leanTry it live (opens official Lean editor)
example (P : Prop) (h : P) : P ∧ P := by
  sorry

example (P Q R : Prop) (hP : P) (hQ : Q) (hR : R) : P ∧ (Q ∧ R) := by
  sorry

08A quick check

1. What does ∧ mean?

Read the answer and explanation

And. Both propositions must have proofs. Type it with \and.

2. How many goals does constructor create for P ∧ Q?

Read the answer and explanation

Two. The constructor needs a proof of P and a proof of Q.

One more idea in your toolkit.

Take your time. Progress is yours to mark.