Part II · The Proof Engine & Gear 2 Ch 05 · 30 min · ProveIt/Ch05.lean

Proofs Are Programs, Goals Are Stack Traces

Reading the Lean Infoview cleanly and mastering `→`, `∧`, `∨`, `¬`, `∀`, and `∃` as typed API contracts.

5-Line Mental-Model Shift · Propositions as Function Signatures
-- Look at these two Lean declarations side by side:
def applyFallback (f : Req → Resp) (x : Req) : Resp := f x
theorem applyImplication (h_imp : SafeConfig → NoOutage) (h_cfg : SafeConfig) : NoOutage :=
  h_imp h_cfg
-- Why do `def` and `theorem` have the EXACT same body?
Socratic Gate · Commit to a Prediction Unanswered · Locks on commit

If an implication `P → Q` is a function taking a proof of `P` to a proof of `Q`, what data structure corresponds to proving `P ∧ Q` (`And P Q`)?

Reading the Lean Infoview Like a Debugger Frame

Every time you click inside a by ... block, Lean's Infoview shows your live stack frame: Objects (req : Request, n : Nat) are function arguments in scope; Hypotheses (h1 : Valid req, h2 : n < 100) are local immutable bindings holding proofs you already possess; and ⊢ Goal is the return type your remaining block must construct.

Every logical connective has two moves: how to build it when it sits in the ⊢ Goal, and how to unpack it when it sits in a hypothesis h.

The Six Core Connectives Cheat-Sheet

P → Q and ∀ x, P x: build with intro, use by calling h x (apply / exact). P ∧ Q: build with constructor (or ⟨hp, hq⟩), unpack with rcases h with ⟨hp, hq⟩. P ∨ Q: build with left or right, unpack with rcases h with hp | hq (must handle both cases!). ∃ x, P x: build by supplying a concrete witness ⟨witness, proof⟩ (refine ⟨w, ?_⟩), unpack with rcases h with ⟨x, hx⟩. And ¬P is defined as P → False—a function showing P leads to contradiction!

⊢ ProveIt/Ch05.lean · Unpacking & Building Logical Contracts
Step 1 / 1
Lean Infoview Open Goal
Hands-On Exercise (ProveIt/Ch05.lean):

In `ProveIt/Ch05.lean`, practice driving the Infoview across conjunctions, disjunctions, negations, and existential witnesses without guesswork.

Finished the Socratic gate, Infoview trace, and playground run?
Record completion in local browser storage to track your 20-unit progress.