lean-ja / lean-ja/lean-by-example
notation の priority の効果についての謎
Open
Nobody has claimed this yet.
要調査
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
このコードはなぜ priority := high を付けても付けなくても効果がないのか。
同じ構文に異なる解釈があるときの優先度の違いを決めているのではないのか???
/- ## 記法の重複問題
`notation` を使って定義した記法のパース優先順位が意図通りに反映されないことがあります。-/
section
-- 排他的論理和の記号を定義
local notation:60 (priority := high) x:60 " ⊕ " y:61 => xor x y
-- メタ変数を表示させないため
set_option pp.mvars false
-- 等号(パース優先順位 50)より優先順位が低いという問題でエラーになる
-- 上では60で定義しているのに、なぜ?
#check_failure true ⊕ true = false
-- 括弧を付けるとエラーにならない
#check (true ⊕ true) = false
end
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 by running the notation declarations and #check_failure examples from the issue, then inspect the surrounding Lean notation and parser-precedence documentation. Determine why the priority annotation has no visible effect in this expression and document the distinction between notation precedence and priority, including the parenthesized form.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100