Zulip Chat Archive
Stream: general
Topic: custom options
Heather Macbeth (Sep 21 2022 at 17:55):
I noticed that in Lean 4 you can make your own options with register_option
:
https://github.com/arthurpaulino/lean4-metaprogramming-book/blob/master/md/extra/options.md#making-our-own
Does this feature exist in Lean 3?
Alex J. Best (Sep 21 2022 at 18:09):
Unfortunately not. I think the closet thing you can do is register a tracing option. Which in the past people have (ab)used to pretend it's like a normal option
Heather Macbeth (Sep 21 2022 at 18:16):
I'd be up for that abuse, do you know of an example I could look at?
Alex J. Best (Sep 21 2022 at 18:35):
I'm on mobile, but i found the thread I'm thinking of https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/A.20useless.20option.20which.20I.20can.20use.20for.20another.20purpose.3F
Alex J. Best (Sep 21 2022 at 18:35):
I can look a bit later for something more specific
Heather Macbeth (Sep 21 2022 at 18:45):
Thanks! I see that I can register my fake tracing option using declare_trace
; I think the only other thing I need to know is how to access the state of the option within meta code.
Kyle Miller (Sep 21 2022 at 18:45):
Here's another reference I found: https://leanprover.zulipchat.com/#narrow/stream/303200-sphere-eversion/topic/Chapter.203.20coordination/near/296282435 (it uses the declare_trace
hack)
Kyle Miller (Sep 21 2022 at 18:45):
I believe the function is docs#tactic.get_bool_option
Heather Macbeth (Sep 21 2022 at 21:35):
Thanks @Alex J. Best @Kyle Miller, I got it working! See #16586 for my use case.
Kevin Buzzard (Sep 22 2022 at 06:48):
Nice work!
Last updated: Dec 20 2023 at 11:08 UTC