Zulip Chat Archive
Stream: general
Topic: induction fails
Violeta Hernández (Aug 08 2022 at 02:07):
Here's something weird I found. If you make an alias of list.perm.rec_on
, theinduction
tactic suddenly complains about it.
import data.list.perm
alias list.perm.rec_on ← list.perm.rec_on'
-- Works
example {α} {l₁ l₂ : list α} (h : l₁ ~ l₂) : true :=
by induction h using list.perm.rec_on; trivial
-- invalid user defined recursor, type of the major premise 'ᾰ' does not contain the recursor index 'ᾰ'
example {α} {l₁ l₂ : list α} (h : l₁ ~ l₂) : true :=
by induction h using list.perm.rec_on'; trivial
David Renshaw (Aug 08 2022 at 02:13):
I wonder if this has to do with @[elab_as_eliminator]
Violeta Hernández (Aug 08 2022 at 02:15):
Something similar happens with relation.trans_gen.rec_on
.
import logic.relation
alias relation.trans_gen.rec_on ← relation.trans_gen.rec_on'
-- Works
example {α} {x y : α} {r : α → α → Prop} (h : relation.trans_gen r x y) : true :=
by induction h using relation.trans_gen.rec_on; trivial
-- invalid user defined recursor, type of the major premise 'ᾰ' must be for the form (I ...), where I is a constant
example {α} {x y : α} {r : α → α → Prop} (h : relation.trans_gen r x y) : true :=
by induction h using relation.trans_gen.rec_on'; trivial
David Renshaw (Aug 08 2022 at 02:15):
hm... attribute [elab_as_eliminator] list.perm.rec_on'
does not seem to help.
Violeta Hernández (Aug 08 2022 at 02:24):
@Mario Carneiro might have an idea of what's going on
Mario Carneiro (Aug 08 2022 at 09:26):
induction using
doesn't really work in lean 3, you should just use refine
Mario Carneiro (Aug 08 2022 at 09:27):
but you should make an issue to track it since it's hard to remember whhat goes wrong
Violeta Hernández (Aug 08 2022 at 14:20):
Would it be worthwhile to kill induction using
in mathlib?
Violeta Hernández (Aug 08 2022 at 14:22):
I wanted to test out redefining list.perm
as the transitive closure of the "at most one swap" relation, which gives a more general induction principle, but this change causes more trouble than it would otherwise due to induction using
now failing...
Ruben Van de Velde (Aug 08 2022 at 15:09):
It works perfectly well in nearly all cases, in my experience
Violeta Hernández (Aug 08 2022 at 15:20):
I thought that as well, but I've found a total of three fail cases in the past two or so weeks
Eric Wieser (Oct 23 2022 at 13:44):
Does alias
even work well for data? I thought we only ever used it for theorems
Mario Carneiro (Oct 23 2022 at 13:54):
it works fine for def
and theorem
, not so much for inductive
Mario Carneiro (Oct 23 2022 at 13:54):
well, for def
it probably won't copy the definitional equation, resulting in poor rw
behavior
Last updated: Dec 20 2023 at 11:08 UTC