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

宣言に [simp] 属性が付与されているかどうかチェックするコマンド

Open
#1,444 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

Zulip: request: discourage squeezing terminal simps?

import Lean

@[simp]
theorem X : True := trivial

open Lean Elab Command Meta in
elab "#is_simp " ids:ident+ : command => do
  let se := simpExtension.getState (← getEnv)
  for id in ids do
    let nm ← liftCoreM do realizeGlobalConstNoOverload id
    if se.lemmaNames.contains (.decl nm) then
      logInfoAt id m!"'{.ofConstName nm}' has the `simp` attribute!"
    else
      logWarningAt id m!"'{.ofConstName nm}' does not have the `simp` attribute!"

#is_simp X

attribute [local simp] Nat.succ_mul in
#is_simp X Nat Nat.succ_mul

#is_simp X Nat Nat.succ_mul

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

Start with the proposed #is_simp command and its Lean.Elab.Command and Lean.Meta APIs in the issue body. Check the examples for global and local simp attributes, then verify that the command reports whether each declaration has the attribute and handles unresolved identifiers appropriately.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.