Natural Number Game in Verso

7.Β Advanced Addition WorldπŸ”—

In Advanced Addition World we will prove some basic addition facts such as x+y=x\implies y=0. The theorems proved in this world will be used to build a theory of inequalities in ≀ World.

Click on "Start" to proceed.

7.1.Β Level 1: add_right_cancelπŸ”—

In this world I will mostly leave you on your own.

add_right_cancel a b n is the theorem that a+n=b+n\implies a=b.

a+n=b+n\implies a=b.

theorem add_right_cancel (a b n : β„•) : a + n = b + n β†’ a = b
Tactics
Theorems
Symbols

7.2.Β Level 2: add_left_cancelπŸ”—

add_left_cancel a b n is the theorem that n+a=n+b\implies a=b. You can prove it by induction on n or you can deduce it from add_right_cancel.

n+a=n+b\implies a=b.

theorem add_left_cancel (a b n : β„•) : n + a = n + b β†’ a = b
Tactics
Theorems
Symbols

7.3.Β Level 3: add_left_eq_selfπŸ”—

add_left_eq_self x y is the theorem that x + y = y\implies x=0.

x + y = y\implies x=0.

theorem add_left_eq_self (x y : β„•) : x + y = y β†’ x = 0
Tactics
Theorems
Symbols

7.4.Β Level 4: add_right_eq_selfπŸ”—

add_right_eq_self x y is the theorem that x + y = x\implies y=0. Two ways to do it spring to mind; I'll mention them when you've solved it.

x+y=x\implies y=0.

theorem add_right_eq_self (x y : β„•) : x + y = x β†’ y = 0
Tactics
Theorems
Symbols

7.5.Β Level 5: add_right_eq_zeroπŸ”—

The next result we'll need in ≀ World is that if a + b = 0 then a = 0 and b = 0. Let's prove one of these facts in this level, and the other in the next.

A new tactic: cases

The cases tactic will split an object or hypothesis up into the possible ways that it could have been created.

For example, sometimes you want to deal with the two cases b = 0 and b = succ d separately, but don't need the inductive hypothesis hd that comes with induction b with d hd. In this situation you can use cases b with d instead. There are two ways to make a number: it's either zero or a successor. So you will end up with two goals, one with b = 0 and one with b = succ d.

Another example: if you have a hypothesis h : False then you are done, because a false statement implies any statement. Here cases h will close the goal, because there are no ways to make a proof of False! So you will end up with no goals, meaning you have proved everything.

If a+b=0 then a=0.

New: cases

Summary

If n is a number, then cases n with d will break the goal into two goals, one with n = 0 and the other with n = succ d.

If h is a proof (for example a hypothesis), then cases h with... will break the proof up into the pieces used to prove it.

Example

If n : β„• is a number, then cases n with d will break the goal into two goals, one with n replaced by 0 and the other with n replaced by succ d. This corresponds to the mathematical idea that every natural number is either 0 or a successor.

Example

If h : P ∨ Q is a hypothesis, then cases h with hp hq will turn one goal into two goals, one with a hypothesis hp : P and the other with a hypothesis hq : Q.

Example

If h : False is a hypothesis, then cases h will turn one goal into no goals, because there are no ways to make a proof of False! And if you have no goals left, you have finished the level.

Example

If h : a ≀ b is a hypothesis, then cases h with c hc will create a new number c and a proof hc : b = a + c. This is because the definition of a ≀ b is βˆƒ c, b = a + c.

theorem add_right_eq_zero (a b : β„•) : a + b = 0 β†’ a = 0
Tactics
Theorems
Symbols

7.6.Β Level 6: add_left_eq_zeroπŸ”—

You can just mimic the previous proof to do this one -- or you can figure out a way of using it.

If a+b=0 then b=0.

theorem add_left_eq_zero (a b : β„•) : a + b = 0 β†’ b = 0
Tactics
Theorems
Symbols