Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_hoge_rules コマンドに localscoped を付与できない #1119

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions LeanByExample/Reference/Declarative/DeclareAesopRuleSets.lean
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ example : True := by
/- `hoge` タクティク用のルールを登録するのは [`add_aesop_rules`](./AddAesopRules.md) コマンドで可能ですが、これに対しても専用のコマンドを用意することができます。-/

/-- `hoge` タクティク用のルールを追加する -/
macro "add_hoge_rules" e:Aesop.rule_expr : command =>
`(command| add_aesop_rules (rule_sets := [HogeRules]) $e)
macro attrKind:attrKind "add_hoge_rules" e:Aesop.rule_expr : command =>
match attrKind with
| `(attrKind| local) => `(command| local add_aesop_rules (rule_sets := [HogeRules]) $e)
| `(attrKind| scoped) => `(command| scoped add_aesop_rules (rule_sets := [HogeRules]) $e)
| _ => `(command| add_aesop_rules (rule_sets := [HogeRules]) $e)

namespace Command --#

Expand All @@ -60,7 +63,7 @@ example : MyTrue := by
apply MyTrue.intro

-- `MyTrue` に関するルールを `hoge` に登録する
add_hoge_rules safe constructors [MyTrue]
local add_hoge_rules safe constructors [MyTrue]

example : MyTrue := by
-- `hoge` で証明できるようになった!
Expand All @@ -82,7 +85,7 @@ macro "hoge" e:Aesop.rule_expr : attr =>
namespace Attr --#

/-- `True` を模して自作した命題 -/
@[hoge safe constructors]
@[local hoge safe constructors]
inductive MyTrue : Prop where
| intro

Expand Down
Loading