lean-ja / lean-ja/lean-by-example

quotPrecheck はマクロ展開の中にマクロがあると偽陽性を出すことがある

Open
#674 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

オプション
Dominant language
Lean
Stars
188
Forks
15
Avg merge
9h 8m
Merged PRs (30d)
6

Description

-- エラーになる
/-
no macro or `[quot_precheck]` instance for syntax kind 'Lean.Parser.Term.letMVar' found
  failed to pretty print term (use 'set_option pp.rawOnError true' for raw representation)
This means we cannot eagerly check your notation/quotation for unbound identifiers; you can use `set_option quotPrecheck false` to disable this check.
-/
notation s:70 "[" x:70 "↦" n:70 "]" => (fun v => if v = x then n else s v)

-- `if` がマクロだったので偽陽性を出していただけのようだ
notation s:70 "[" x:70 "↦" n:70 "]" => (fun v => ite (v = x) n (s v))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the false positive with the two notation examples in the issue, starting from the quotPrecheck error and comparing the if and ite forms. Trace the macro-expansion path involved in quotation prechecking; done means the nested-macro case no longer reports a missing [quot_precheck] instance while the check still handles genuine failures.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.