Skip to content

Commit

Permalink
algorithm world now looking good
Browse files Browse the repository at this point in the history
  • Loading branch information
kbuzzard committed Oct 27, 2023
1 parent 27ae2cd commit 6e503fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Game/Levels/Algorithm/L04pred.lean
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ Statement (a b : ℕ) (h : succ a = succ b) : a = b := by
rfl

Conclusion
"Let's now prove Peano's other axiom, `zero_ne_succ`.
"Let's now prove Peano's other axiom, that successors can't be $0$.
"
4 changes: 0 additions & 4 deletions Game/Levels/Algorithm/L05is_zero.lean
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,3 @@ Statement succ_ne_zero (a : ℕ) : succ a ≠ 0 := by
rw [h]
rw [is_zero_zero]
tauto

Conclusion
"Let's now use these lemmas to prove
"
4 changes: 3 additions & 1 deletion Game/Levels/Algorithm/L06succ_ne_succ.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ Every natural is either `0` or `succ n` for some `n`. Here is an algorithm
which, given two naturals `a` and `b`, returns the answer to \"does `a = b`?\"
*) If they're both `0`, return \"yes\".
*) If one is `0` and the other is `succ n`, return \"no\".
*) If `a = succ m` and `b = succ n`, then return the answer to \"does `m = n`?\"
Let's prove that this algorithm always gives the correct answer. The proof that
`0 = 0` is `rfl`. The proof that `0 ≠ succ n` is `zero_ne_succ n`, and the proof
that `succ m ≠ 0` is `succ_ne_zero m`. The proof that if `h : m = n` then
`succ m = succ n` is `rw [h]` and then `rfl`. The next level is a proof of the one
remaining case.
remaining case: if `a ≠ b` then `succ a ≠ succ b`.
"

TacticDoc «have» "
Expand Down
2 changes: 0 additions & 2 deletions Game/Levels/Algorithm/L07decide.lean
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,3 @@ between two naturals. Run it with the `decide` tactic.
/-- $20+20=40$. -/
Statement : (20 : ℕ) + 20 = 40 := by
decide

-- need tacticdoc
21 changes: 21 additions & 0 deletions Game/Levels/Algorithm/L08decide2.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Game.Levels.Algorithm.L07decide

World "Algorithm"
Level 8
Title "decide again"

LemmaTab "Peano"

namespace MyNat

Introduction
"
We gave a pretty unsatisfactory proof of `2 + 2 ≠ 5` earlier on; now give a nicer one.
"

/-- $2+2 \neq 5.$ -/
Statement : (2 : ℕ) + 25 := by
decide

Conclusion "Congratulations! You've finished Algorithm World. These algorithms
will be helpful for you in Even-Odd World."

0 comments on commit 6e503fa

Please sign in to comment.