Zulip Chat Archive
Stream: new members
Topic: Antiquotes
Robert Maxton (Apr 03 2022 at 22:11):
Allegedly, antiquotes are supposed to work in meta-tactic blocks like `[tac...]
; but I'm getting invalid antiquotation, occurs outside of quoted expressions
Robert Maxton (Apr 03 2022 at 22:11):
Has this been changed since the tutorial was written?
Yaël Dillies (Apr 03 2022 at 22:15):
That still works. You probably need to give us more code for us to diagnose.
Robert Maxton (Apr 03 2022 at 22:18):
I'm doing something like
meta def tactic.interactive.restricted_induction (v: parse ident) (ax: parse ident): tactic unit :=
`[revert %%v, apply ax, split]
Robert Maxton (Apr 03 2022 at 22:18):
where the idea is that I'm going to write down a bunch of different induction axioms of varying strength and use a specific one
Yaël Dillies (Apr 03 2022 at 22:21):
Isn't there anything below that line that could interfere?
Robert Maxton (Apr 03 2022 at 22:21):
and I'm not entirely sure I'm supposed to be using antiquotes in that situation in the first place lol
Yaël Dillies (Apr 03 2022 at 22:21):
I suspect adding #exit
right after this line might solve your problem
Robert Maxton (Apr 03 2022 at 22:23):
hmmm
okay, that does fix the problem, but then how do I use the tactic lol
Robert Maxton (Apr 03 2022 at 22:23):
also I suspect it doesn't do what I need it to do anyway but to some extent that's a separate problem
Yaël Dillies (Apr 03 2022 at 22:23):
Fix whatever syntax error you introduced later :smile:
Robert Maxton (Apr 03 2022 at 22:24):
... that's kind of annoying, tbh
Robert Maxton (Apr 03 2022 at 22:24):
since that appears at the top of a namespace of half-finished theorems
Robert Maxton (Apr 03 2022 at 22:24):
oh well
Robert Maxton (Apr 03 2022 at 22:25):
anyway, I take that back, adding #exit doesn't actually remove the error anyway
Robert Maxton (Apr 03 2022 at 22:26):
I forgot to actually reintroduce the antiquote before checking last time >.>
Robert Maxton (Apr 03 2022 at 22:26):
still complains about antiquotations when I do
Robert Maxton (Apr 03 2022 at 22:27):
also the next line is namespace
so I'd've been pretty surprised if that was the problem anyway
Eric Wieser (Apr 03 2022 at 22:35):
I think this doesn't work because revert
expects a name not an expression.
Eric Wieser (Apr 03 2022 at 22:35):
And %%
is for expressions
Kyle Miller (Apr 03 2022 at 22:40):
For example, this works:
import tactic
setup_tactic_parser
meta def tactic.interactive.restricted_induction (ax: parse texpr): tactic unit :=
`[apply %%ax, split]
Kyle Miller (Apr 03 2022 at 22:40):
(but it doesn't solve using revert
)
Patrick Johnson (Apr 03 2022 at 22:41):
This also works:
import tactic
section
setup_tactic_parser
open tactic.interactive
meta def tactic.interactive.restricted_induction
(v : parse ident) (ax : parse texpr) : tactic unit := do
revert [v], apply ax, split
end
Patrick Johnson (Apr 03 2022 at 22:42):
Example usage:
example {n : ℕ} (h : true ∧ true → ∀ {n : ℕ}, true) : true :=
begin
restricted_induction n h,
repeat { trivial },
end
Robert Maxton (Apr 03 2022 at 22:46):
hm. Okay, that's simpler than I had expected
Robert Maxton (Apr 03 2022 at 22:47):
In particular I was really scratching my head over how to make a many ident
and it's a little embarrassing the answer was just "make a list of it" ^.^;
Patrick Johnson (Apr 03 2022 at 22:53):
parse ident*
is definitionally equal to list name
Last updated: Dec 20 2023 at 11:08 UTC