Zulip Chat Archive

Stream: lean4

Topic: Learning lean macros


Joseph O (Mar 17 2022 at 03:02):

So I wanted to create my own custom syntax to define functions, but I didn't really know how to do it. So I looked at alloy for examples, but I wasn't able to understand anything. How were they able to learn how to use macros, and how can I?

Arthur Paulino (Mar 17 2022 at 03:15):

Porting some tactics to mathlib4 is teaching me wonders

Chris B (Mar 17 2022 at 03:31):

Parts 11.4 and 11.5 in the manual are good, and mathlib4's tactic/basic has some examples.

Andrés Goens (Mar 17 2022 at 12:04):

there's a nice tutorial also hidden on the docs: https://github.com/leanprover/lean4/blob/master/doc/tutorial/metaprogramming-arith.md

Joseph O (Mar 17 2022 at 13:18):

Andrés Goens said:

there's a nice tutorial also hidden on the docs: https://github.com/leanprover/lean4/blob/master/doc/tutorial/metaprogramming-arith.md

Oh interesting

Adrien Champion (Sep 16 2022 at 00:08):

Now available at https://leanprover.github.io/lean4/doc/metaprogramming-arith.html

Adrien Champion (Sep 16 2022 at 00:09):

Has there been new, potentially more in-depth material for learning macros published somewhere?

Leonardo de Moura (Sep 16 2022 at 00:16):

https://arxiv.org/pdf/2001.10490.pdf

Adrien Champion (Sep 16 2022 at 00:20):

I did read this paper, which helped a great deal, but I was hoping for something more hands-on

Adrien Champion (Sep 16 2022 at 00:20):

This seems to fit the bill: https://github.com/arthurpaulino/lean4-metaprogramming-book

Adrien Champion (Sep 16 2022 at 00:21):

Arthur Paulino said:

Porting some tactics to mathlib4 is teaching me wonders

Seems like it really did, thank you for this book!

Arthur Paulino (Sep 16 2022 at 00:40):

The book is the result of a big collaborative effort. I, alone, didn't write much


Last updated: Dec 20 2023 at 11:08 UTC