Zulip Chat Archive
Stream: general
Topic: calling a tactic without importing it
Scott Morrison (Apr 14 2019 at 06:46):
I am trying to write a tactic that will invoke norm_num
, if it has otherwise been imported, and otherwise fail. I need this to work without actually importing norm_num
.
Scott Morrison (Apr 14 2019 at 06:46):
Any suggestions?
Mario Carneiro (Apr 14 2019 at 06:51):
search for norm_num
in the environment and call eval_expr
on it
Mario Carneiro (Apr 14 2019 at 06:57):
import tactic.norm_num -- remove me open tactic interactive example : 2 + 2 = 4 := by try { do t ← mk_const `tactic.interactive.norm_num1, f ← eval_expr (loc → tactic unit) t, f (loc.ns [none]) }
Scott Morrison (Apr 14 2019 at 07:00):
Thanks.
Scott Morrison (Apr 14 2019 at 07:01):
It would be nice if norm_num
didn't have to import tactic.interactive
. :-)
Scott Morrison (Apr 14 2019 at 07:01):
I've just been looking; that seems rather unlikely.
Keeley Hoek (Apr 14 2019 at 07:05):
Stuff importing tactic.interactive
has been a problem for me before too---is there scope for putting all of the real defs in tactic.interactive
somewhere else (maybe tactic.interactive.basic
?) and making tactic.interactive
just a stub which conveniently includes most of mathlib's interactive stuff?
Simon Hudon (Apr 14 2019 at 12:14):
I suggested decoupling some of those dependencies in #878 but it did not seem like a popular suggestion
Scott Morrison (Apr 14 2019 at 12:42):
I think this is a great idea. tactic.basic
and tactic.interactive
should both be chopped up into tiny pieces. :-)
Simon Hudon (Apr 14 2019 at 12:45):
Sounds pretty gory :P
Simon Hudon (Apr 14 2019 at 12:51):
In general, I'd like a tool to analyze the dependencies of mathlib and detect the needless imports
Last updated: Dec 20 2023 at 11:08 UTC