Natural Number Game in Verso

5.Β Power WorldπŸ”—

This world introduces exponentiation. If you want to define 37 ^ n then, as always, you will need to know what 37 ^ 0 is, and what 37 ^ (succ d) is, given only 37 ^ d.

You can probably guess the names of the general theorems:

  • pow_zero (a : β„•) : a ^ 0 = 1

  • pow_succ (a b : β„•) : a ^ succ b = a ^ b * a

Using only these, can you get past the final boss level?

The levels in this world were designed by Sian Carey, a UROP student at Imperial College London, funded by a Mary Lister McCammon Fellowship in the summer of 2019. Thanks to Sian and also thanks to Imperial College for funding her.

5.1.Β Level 1: zero_pow_zeroπŸ”—

Mathematicians sometimes debate what 0 ^ 0 is; the answer depends, of course, on your definitions. In this game, 0 ^ 0 = 1. See if you can prove it.

Check out the Pow tab in your list of theorems to see the new proofs which are available.

0 ^ 0 = 1

New: pow_zero

pow_zero a : a ^ 0 = 1 is one of the two axioms defining exponentiation in this game.

New: ^

Pow a b, with notation a ^ b, is the usual exponentiation of natural numbers. Internally it is defined via two axioms:

  • pow_zero a : a ^ 0 = 1

  • pow_succ a b : a ^ succ b = a ^ b * a

Note in particular that 0 ^ 0 = 1.

theorem zero_pow_zero : (0 : β„•) ^ 0 = 1
Tactics
Theorems
Symbols

5.2.Β Level 2: zero_pow_succπŸ”—

We've just seen that 0 ^ 0 = 1, but if n is a successor, then 0 ^ n = 0. We prove that here.

For all numbers m, 0 ^{\operatorname{succ} (m)} = 0.

New: pow_succ

pow_succ a b : a ^ (succ b) = a ^ b * a is one of the two axioms defining exponentiation in this game.

theorem zero_pow_succ (m : β„•) : (0 : β„•) ^ (succ m) = 0
Tactics
Theorems
Symbols

5.3.Β Level 3: pow_oneπŸ”—

For all naturals a, a ^ 1 = a.

theorem pow_one (a : β„•) : a ^ 1 = a
Tactics
Theorems
Symbols

5.4.Β Level 4: one_powπŸ”—

For all naturals m, 1 ^ m = 1.

theorem one_pow (m : β„•) : (1 : β„•) ^ m = 1
Tactics
Theorems
Symbols

5.5.Β Level 5: pow_twoπŸ”—

Note: this lemma will be useful for the final boss!

For all naturals a, a ^ 2 = a \times a.

theorem pow_two (a : β„•) : a ^ 2 = a * a
Tactics
Theorems
Symbols

5.6.Β Level 6: pow_addπŸ”—

Let's now begin our approach to the final boss, by proving some more subtle facts about powers.

For all naturals a, m, n, we have a^{m + n} = a ^ m a ^ n.

theorem pow_add (a m n : β„•) : a ^ (m + n) = a ^ m * a ^ n
Tactics
Theorems
Symbols

5.7.Β Level 7: mul_powπŸ”—

The music gets ever more dramatic, as we explore the interplay between exponentiation and multiplication.

If you're having trouble exchanging the right a * b because rw [mul_comm] swaps the wrong multiplication, then read the documentation of rw for tips on how to fix this.

For all naturals a, b, n, we have (ab) ^ n = a ^ nb ^ n.

theorem mul_pow (a b n : β„•) : (a * b) ^ n = a ^ n * b ^ n
Tactics
Theorems
Symbols

5.8.Β Level 8: pow_powπŸ”—

One of the best named levels in the game, a savage pow_pow sub-boss appears as the music reaches a frenzy. What else could there be to prove about powers after this?

For all naturals a, m, n, we have (a ^ m) ^ n = a ^ {mn}.

theorem pow_pow (a m n : β„•) : (a ^ m) ^ n = a ^ (m * n)
Tactics
Theorems
Symbols

5.9.Β Level 9: add_sqπŸ”—

[final boss music]

For all numbers a and b, we have (a+b)^2=a^2+b^2+2ab.

theorem add_sq (a b : β„•) : (a + b) ^ 2 = a ^ 2 + b ^ 2 + 2 * a * b
Tactics
Theorems
Symbols

5.10.Β Level 10: Fermat's Last TheoremπŸ”—

We now have enough to state a mathematically accurate, but slightly clunky, version of Fermat's Last Theorem.

Fermat's Last Theorem states that if x,y,z>0 and m \geq 3 then x^m+y^m\not =z^m. If you didn't do inequality world yet then we can't talk about m \geq 3, so we have to resort to the hack of using n + 3 for m, which guarantees it's big enough. Similarly instead of x > 0 we use a + 1.

This level looks superficially like other levels we have seen, but the shortest solution known to humans would translate into many millions of lines of Lean code. The author of this game, Kevin Buzzard, is working on translating the proof by Wiles and Taylor into Lean, although this task will take many years.

CONGRATULATIONS!

You've finished the main quest of the natural number game! If you would like to learn more about how to use Lean to prove theorems in mathematics, then take a look at Mathematics In Lean, an interactive textbook which you can read in your browser, and which explains how to work with many more mathematical concepts in Lean.

For all naturals a b c and n, we have (a+1)^{n+3}+(b+1)^{n+3}\not=(c+1)^{n+3}.

example (a b c n : β„•) : (a + 1) ^ (n + 3) + (b + 1) ^ (n + 3) β‰  (c + 1) ^ (n + 3)
Tactics
Theorems
Symbols