import MyNat.Definition
import MyNat.Addition
import AdditionWorld.Level6
namespace MyNat
open MyNat
axiom succ_inj: ∀ {a b : MyNat}, succ a = succ b → a = b
succ_inj {a: MyNat
a b: MyNat
b : MyNat: Type
MyNat} : succ: MyNat → MyNat
succ a: MyNat
a = succ: MyNat → MyNat
succ b: MyNat
b → a: MyNat
a = b: MyNat
b
Advanced Addition World
Level 1: succ_inj
. A function.
Let's learn how to use succ_inj
. You should know a couple of ways to prove the below -- one
directly using an exact
, and one which uses an apply
first. But either way you'll need to use
succ_inj
.
Theorem
For all naturals a
and b
, if we assume succ a = succ b
, then we can
deduce a = b
.
theoremsucc_inj' {succ_inj': ∀ {a b : MyNat}, succ a = succ b → a = baa: MyNatb :b: MyNatMyNat} (MyNat: Typehs :hs: succ a = succ bsuccsucc: MyNat → MyNata =a: MyNatsuccsucc: MyNat → MyNatb) :b: MyNata =a: MyNatb :=b: MyNata, b: MyNat
hs: succ a = succ ba = bGoals accomplished! 🐙
Important thing.
You can rewrite proofs of equalities. If h : A = B
then rw [h]
changes A
s to B
s.
But you cannot rewrite proofs of implications. rw [succ_inj]
will never work
because succ_inj
isn't of the form A = B
, it's of the form A⟹ B
. This is one
of the most common mistakes I see from beginners. ⟹
and =
are two different things
and you need to be clear about which one you are using.
Next up Level 2