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_5.lean

45 lines
1.1 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_4
Game "NNG"
World "AdvAddition"
Level 5
Title "add_right_cancel"
open MyNat
Introduction
"
The theorem `add_right_cancel` is the theorem that you can cancel on the right
when you're doing addition -- if `a + t = b + t` then `a = b`.
"
Statement MyNat.add_right_cancel
"On the set of natural numbers, addition has the right cancellation property.
In other words, if there are natural numbers $a, b$ and $c$ such that
$$ a + t = b + t, $$
then we have $a = b$."
(a t b : ) : a + t = b + t → a = b := by
Hint (hidden := true) "You should start with `intro`."
intro h
Hint "I'd recommend now induction on `t`. Don't forget that `rw [add_zero] at h` can be used
to do rewriting of hypotheses rather than the goal."
induction t with d hd
rw [add_zero] at h
rw [add_zero] at h
exact h
apply hd
rw [add_succ] at h
rw [add_succ] at h
Hint (hidden := true) "At this point `succ_inj` might be useful."
exact succ_inj h
-- TODO: Display at this level after induction is confusing: old assumption floating in context
LemmaTab "Add"
Conclusion
"
"