lean-ja / lean-ja/lean-by-example
dsimp が効きそうで効かない例
Open
Nobody has claimed this yet.
タクティク
要調査
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
inductive MyNat : Type where
| zero : MyNat
| succ : MyNat → MyNat
namespace MyNat
def add (m n : MyNat) : MyNat :=
match n with
| zero => m
| succ n => succ (add m n)
instance : OfNat MyNat 0 where
ofNat := .zero
instance : OfNat MyNat 1 where
ofNat := .succ .zero
instance : Add MyNat where
add := MyNat.add
@[simp] theorem add_zero (n : MyNat) : n + 0 = n := by rfl
@[simp] theorem zero_add (n : MyNat) : 0 + n = n := by
induction n with
| zero => rfl
| succ n ih =>
dsimp [Add.add, MyNat.add]
-- goal state: 0 + n.succ = n.succ
-- why goal is not changed?
rw [show 0 + n.succ = .succ (0 + n) from by rfl]
rw [ih]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the supplied MyNat.zero_add proof and reproduce the goal after dsimp [Add.add, MyNat.add]. Check the surrounding Lean example or documentation to determine why the goal remains unchanged, then update the explanation or example so the expected simplification and proof outcome are clear.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100