Zulip Chat Archive

Stream: new members

Topic: Show tactic failed


Gihan Marasingha (Oct 22 2020 at 23:59):

The following gives an error message show tactic failed in the first subgoal of refine. It works fine if I use exact k₁. As far as I can tell, the goal at that point is a → b ∧ a.

What's going on?

variables p q r a b c : Prop

theorem imp_trans1 : (p  q)  (q  r)  (p  r) :=
λ h₁ h₂ h₃, h₂ (h₁ h₃)

example (k₁ : a  b  a) (k₂ : b  c) : a  c :=
begin
  refine imp_trans1 a (b  a) c _ _,
  { show a  b  a, from k₁, },
  { show b  a  c,
    assume k₃ : b  a,
    have k₄ : b, from k₃.left,
    exact k₂ k₄, },
end

Reid Barton (Oct 23 2020 at 00:20):

lean#437

Gihan Marasingha (Oct 23 2020 at 00:24):

So the lesson I've learned is not to use a as a variable name!

Kevin Buzzard (Oct 23 2020 at 06:39):

The a bug is surprisingly rare, at least for me. It's also apparently surprisingly hard to fix. I went through a phase of never using a but now I use it and just change it when I run into the a bug.

Kevin Buzzard (Oct 23 2020 at 06:41):

Can't we just change things so instead of being an a bug it's an xyzzy bug or something?

Mario Carneiro (Oct 23 2020 at 07:06):

That would be lean#442, which appears to have stalled somewhere

Mario Carneiro (Oct 23 2020 at 07:07):

oh, it's currently blocked on lean#447

Kevin Buzzard (Oct 23 2020 at 07:38):

I thought that this was because we tried to change it to the _a bug. I'm just suggesting xyzzy with no underscore.

Mario Carneiro (Oct 23 2020 at 07:56):

I'd rather just fix the segfault

Kevin Buzzard (Oct 23 2020 at 08:04):

That's of course the correct solution.

Reid Barton (Oct 23 2020 at 08:34):

Even the proposed a -> _x change was going to induce a surprisingly large number of changes h_a -> h__x in mathlib

Johan Commelin (Oct 23 2020 at 08:38):

But I think it's worth fixing those anyway

Johan Commelin (Oct 23 2020 at 08:39):

I can spend some time on fixing those, if someone gives me the lean to fix them

Reid Barton (Oct 23 2020 at 08:40):

but changing them to h_xyzzy probably isn't great, especially if we would change them to something else again later

Johan Commelin (Oct 23 2020 at 08:41):

But the fix would be to use explicit variable names, right?

Reid Barton (Oct 23 2020 at 08:41):

I quickly grew tired of trying to do that when I looked at that earlier

Johan Commelin (Oct 23 2020 at 08:42):

Maybe we can crowdsource it?

Reid Barton (Oct 23 2020 at 08:43):

What I'm trying to say is it's significantly more annoying than you would think

Reid Barton (Oct 23 2020 at 08:43):

you can just build Lean with a version of the change in the PR to see

Johan Commelin (Oct 23 2020 at 08:47):

rg "h_a" | wc -l
241
rg "_a" | wc -l
32547

Johan Commelin (Oct 23 2020 at 08:47):

I guess it's not only h_a, right?

Reid Barton (Oct 23 2020 at 08:47):

for example with the xyzzy change

Reid Barton (Oct 23 2020 at 08:47):

the number is not the issue

Reid Barton (Oct 23 2020 at 08:48):

if you want to do it the "correct" way of not using an autogenerated name

Reid Barton (Oct 23 2020 at 08:48):

the issue is some of them are individually hard to deal with

Johan Commelin (Oct 23 2020 at 08:48):

rg "_a " | wc -l
124

Reid Barton (Oct 23 2020 at 08:49):

because they are not simple straight-line intro, cases h, exact h_a but complicated stuff involving ; and so on

Johan Commelin (Oct 23 2020 at 08:49):

Reid Barton said:

if you want to do it the "correct" way of not using an autogenerated name

But we could do it in two stages... first rename everything to h__xyzzy automatically, and then hope that 124 people will each fix one of those issues afterwards.

Johan Commelin (Oct 23 2020 at 08:50):

I wouldn't mind having h__xyzzy in mathlib if it removes the a bug

Johan Commelin (Oct 23 2020 at 08:50):

And it will be extra motivation for people to not use autogenerated names in the future

Reid Barton (Oct 23 2020 at 08:55):

I think the last time I looked Lean 4 did not let you use autogenerated names anyways (by default?)

Kevin Buzzard (Oct 23 2020 at 09:18):

so it will need to be done at some stage anyway?


Last updated: Dec 20 2023 at 11:08 UTC