Zulip Chat Archive
Stream: general
Topic: tactic type class instance
petercommand (Jan 09 2019 at 08:28):
meta def opt_fst (a: tactic unit) (b: tactic unit) : tactic unit := (a >> b) <|> b
I am trying to define a tactic combinator, but it seems that I cannot use it like this:
opt_fst { symmetry } { symmetry }
and I am getting errors like
failed to synthesize type class instance for |- has_emptyc (tactic unit)
Am I doing something wrong here?
petercommand (Jan 09 2019 at 08:30):
I want the tactic to accept begin...end blocks or {...} blocks
Sebastian Ullrich (Jan 09 2019 at 08:31):
You'll want your parameters to have type itactic
(for "interactive tactic"). Try searching for itactic in core or mathlib for examples.
Rob Lewis (Jan 09 2019 at 08:32):
meta def tactic.interactive.opt_fst (a: tactic.interactive.itactic) (b: tactic.interactive.itactic) : tactic unit := (a >> b) <|> b
petercommand (Jan 09 2019 at 08:34):
Isn't tactic.interactive.itactic
defined as tactic unit
?
Sebastian Ullrich (Jan 09 2019 at 08:34):
Yes, but it's special-cased in the tactic block parser
petercommand (Jan 09 2019 at 08:34):
Ah
petercommand (Jan 09 2019 at 08:34):
Hmm..I am still getting the same error
Gabriel Ebner (Jan 09 2019 at 08:35):
You need to call it inside begin..end
: begin opt_fst {} {} end
petercommand (Jan 09 2019 at 08:35):
do I have to prefix the name of the tactic with tactic.interactive.
?
Gabriel Ebner (Jan 09 2019 at 08:36):
No.
Sebastian Ullrich (Jan 09 2019 at 08:36):
(if you're in tactic.interactive
, which your definition should be)
petercommand (Jan 09 2019 at 08:36):
after changing the name of the tactic, it worked..
Rob Lewis (Jan 09 2019 at 08:37):
The tactic should be named tactic.interactive.whatever
. You don't need to write the tactic.interactive
part when you use it.
petercommand (Jan 09 2019 at 08:38):
The tactic should be named
tactic.interactive.whatever
. You don't need to write thetactic.interactive
part when you use it.
Hmm..seems that this is also hardcoded
petercommand (Jan 09 2019 at 08:39):
Thanks!
Last updated: Dec 20 2023 at 11:08 UTC