Example

Read what a Lean statement actually says

Truncated subtraction, division by zero, a vacuous hypothesis and a misleading name, all accepted by the kernel.

A formal statement’s symbols mean what the library says they mean, and those are not always what a reader brings. This core-Lean file shows four places where that matters: natural-number subtraction, division by zero, a hypothesis that can never hold, and a theorem whose name says one thing and whose statement says another.

Run it

Save this as formal_propositions.lean and run lean formal_propositions.lean with Lean 4.35.0 (core Lean only, no Mathlib), or paste it into the Lean 4 web editor at live.lean-lang.org .

-- What a formal proposition says: the symbols mean what the library says (core Lean 4).

-- Natural-number subtraction is truncated: there is no -1 in Nat.
#eval (2 - 3 : Nat)            -- 0
#eval (2 - 3 : Int)            -- -1

-- Division by zero is defined, and is 0. A total function, not a fact about numbers.
#eval (7 / 0 : Nat)            -- 0

-- So an identity over the integers can fail over the naturals.
example : ∀ m n : Int, (m - n) + n = m := by intro m n; omega        -- true
example : ¬ ∀ m n : Nat, (m - n) + n = m := by                         -- false on Nat
  intro h
  have := h 2 3
  omega

-- A vacuous hypothesis: the kernel accepts this, correctly. It says nothing.
theorem anything_from_false (h : 0 = 1) : 2 + 2 = 5 := by omega

-- The name says nothing either. This "fermat_is_false" proves something else entirely.
theorem fermat_is_false : 1 + 1 = 2 := rfl
#check @fermat_is_false        -- the statement is what counts, not the name

Expected outcome

0
-1
0
fermat_is_false : 1 + 1 = 2

On Nat, 2 − 3 is 0 and 7 / 0 is 0: total functions, not facts about numbers. So (m − n) + n = m is an identity on Int and false on Nat, and Lean proves both. The theorem with hypothesis 0 = 1 is accepted, correctly, and says nothing. fermat_is_false proves 1 + 1 = 2: only #check, the statement, tells you what was proved.

Mechanism and limitations

Documented: Chapter 15 of the book sets out the mathematics; this program is a self-contained demonstration of it, not one of the laboratory’s recorded investigations.

Observed: the output above, produced by running the program exactly as shown.

Not shown:

  • Core Lean only; Mathlib’s real-number conventions (√ of a negative is 0) are described in the chapter, not shown here.
  • Lean accepting a file shows the statements are proved, not that they are the statements anyone wanted.

Related worked example: Chapter 5 .

Challenge this result

Copy this into the AI assistant of your choice, or work through it yourself. Check any finding against the recorded evidence.

Examine each declaration in the file. Write down what it states in plain
English, from the statement, not the name. Which would a reader most likely
misread, and why? Find another identity that holds on `Int` but fails on
`Nat`, prove both in Lean, and propose a hypothesis that restores it on `Nat`.

Chapter: https://programmer.ie/books/math/15-chapter/
Example: https://programmer.ie/examples/math/15-chapter/
Program: https://github.com/ernanhughes/math/blob/main/notebooks/math/programs/15-formal-propositions.lean
Distinguish what the record shows from what you infer. If you cannot open a link, ask me for the material; do not invent it.

Canonical source and the program .

Understand this example

Copy this prompt into your AI tool. No code runs here.

Apply this example

Copy this prompt into your AI tool. No code runs here.