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

aesop ラッパの属性を手作りする例を示す #1117

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
22 changes: 22 additions & 0 deletions LeanByExample/Reference/Declarative/DeclareAesopRuleSets.lean
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ example : True := by
macro "add_hoge_rules" e:Aesop.rule_expr : command =>
`(command| add_aesop_rules (rule_sets := [HogeRules]) $e)

namespace Command --#

/-- `True` を模して自作した命題 -/
inductive MyTrue : Prop where
| intro
Expand All @@ -69,3 +71,23 @@ example : MyTrue := by
fail_if_success aesop

apply MyTrue.intro

end Command --#
/- あるいは、`[aesop]` 属性と同等の機能を持つ `[hoge]` 属性を作成して、それを使ってルールを登録することもできます。-/

/-- `hoge` タクティク用のルールを追加する -/
macro "hoge" e:Aesop.rule_expr : attr =>
`(attr| aesop (rule_sets := [HogeRules]) $e)

namespace Attr --#

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

example : MyTrue := by
-- `hoge` で証明できる!
hoge

end Attr --#
Loading