You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/server/nng/NNG/Levels/AdvAddition/Level_2.lean

57 lines
1.5 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import NNG.Levels.AdvAddition.Level_1
Game "NNG"
World "AdvAddition"
Level 2
Title "succ_succ_inj"
open MyNat
Introduction
"
In the below theorem, we need to apply `succ_inj` twice. Once to prove
$\\operatorname{succ}(\\operatorname{succ}(a))=\\operatorname{succ}(\\operatorname{succ}(b))
\\implies \\operatorname{succ}(a)=\\operatorname{succ}(b)$, and then again
to prove $\\operatorname{succ}(a)=\\operatorname{succ}(b)\\implies a=b$.
However `succ a = succ b` is
nowhere to be found, it's neither an assumption or a goal when we start
this level. You can make it with `have` or you can use `apply`.
"
Statement
"For all naturals $a$ and $b$, if we assume
$\\operatorname{succ}(\\operatorname{succ}(a))=\\operatorname{succ}(\\operatorname{succ}(b))$,
then we can deduce $a=b$. "
{a b : } (h : succ (succ a) = succ (succ b)) : a = b := by
Branch
exact succ_inj (succ_inj h)
apply succ_inj
apply succ_inj
assumption
LemmaTab "Nat"
Conclusion
"
## Sample solutions to this level.
Make sure you understand them all. And remember that `rw` should not be used
with `succ_inj` -- `rw` works only with equalities or `↔` statements,
not implications or functions.
```
example {a b : } (h : succ (succ a) = succ (succ b)) : a = b := by
apply succ_inj
apply succ_inj
exact h
example {a b : } (h : succ (succ a) = succ (succ b)) : a = b := by
apply succ_inj
exact succ_inj h
example {a b : } (h : succ (succ a) = succ (succ b)) : a = b := by
exact succ_inj (succ_inj h)
```
"