lean-ja / lean-ja/lean-by-example
`unsafe` 利用例: in-place な実装を用意して、それで置き換える
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
This PR gives
Array.mapFinIdxMan@[implemented_by]unsafe
implementation so thatmapFinIdx,mapIdxM, andmapIdxmap in
place, likeArray.map.
https://github.com/leanprover/lean4/commit/068011713f00d41059c2346d97fbb41ec4daf576
これは興味深いと思う。理由は
- そもそも Lean で in-place な実装を与える方法は難しいが、unsafe を使うことで in-place 実装を与えられるという可能性を示唆している
- unsafe を使うことが必須なのか、通常の in-place でない実装と等しいことを証明して csimp で置き換えるわけにはいかなかったのかなど、他にも気になることがある
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
Begin by reading the linked Lean commit and the definitions of Array.mapFinIdxM, mapFinIdx, mapIdxM, and mapIdx. Compare the unsafe in-place approach with the ordinary implementation and investigate whether equivalence plus csimp is viable; the issue does not specify a concrete completion criterion, so confirm the intended approach before making changes.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100