leanprover-community / lean4-metaprogramming-book

https://leanprover-community.github.io/lean4-metaprogramming-book/
Apache License 2.0
211 stars 51 forks source link

[WIP] Add macro based tactics. #16

Closed bollu closed 2 years ago

bollu commented 2 years ago

@arthurpaulino I don't have many ideas for how to use macros for tactics. If you do, I'd be happy to add them.

hargoniX commented 2 years ago

I think it would be nicer if we could have some ties back to the syntax chapter here, especially to this part https://github.com/arthurpaulino/lean4-metaprogramming-book/blob/master/lean/main/syntax.lean#L87-L90, should we add the tactic category here? We should definitely explain at the latest in this chapter that tactic is a syntax category as well even if it should be obvious to the reader at this point, stating it explicitly is better than assuming people understand it.

Regarding custom tactics we can show off a bit here:

bollu commented 2 years ago

I'm writing the second part that shows off building tactics via macros. Thanks for the examples, I'll incorporate them and send a PR tomorrow.

On Wed, 25 May, 2022, 23:25 Henrik Böving, @.***> wrote:

I think it would be nicer if we could have some ties back to the syntax chapter here, especially to this part https://github.com/arthurpaulino/lean4-metaprogramming-book/blob/master/lean/main/syntax.lean#L87-L90, should we add the tactic category here? We should definitely explain at the latest here that tactic is a syntax category as well even if it should be obvious to the reader at this point, stating it explicitly is better than assuming people understand it.

Regarding custom tactics we can show off a bit here:

— Reply to this email directly, view it on GitHub https://github.com/arthurpaulino/lean4-metaprogramming-book/pull/16#issuecomment-1137901875, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM5ZDNOKCGX7PICH2B55GTVL2SG5ANCNFSM5W6MYUYQ . You are receiving this because you authored the thread.Message ID: @.***>

arthurpaulino commented 2 years ago

I think Mathlib4's iterate is a good target for an "advanced" macro tactic