Zulip Chat Archive

Stream: mathlib4

Topic: by { }


Yaël Dillies (Dec 03 2022 at 17:22):

What's the equivalent of one-line by { } proofs?

Scott Morrison (Dec 03 2022 at 17:23):

just leave out the braces?

Scott Morrison (Dec 03 2022 at 17:23):

by X; Y <;> Z

Jireh Loreaux (Dec 03 2022 at 17:23):

And use ;

Yaël Dillies (Dec 03 2022 at 17:24):

Not a MWE but is

refine' fun h  _, by rintro rfl, rfl; refl

supposed to work?

Jireh Loreaux (Dec 03 2022 at 17:29):

Seems syntactically valid.

Yaël Dillies (Dec 03 2022 at 17:31):

Fails in mathlib4#840 but you're welcome to prove me wrong!

Scott Morrison (Dec 03 2022 at 17:31):

It was a different problem.

Scott Morrison (Dec 03 2022 at 17:31):

simpa has changed behaviour slightly, I've pushed a fix

Scott Morrison (Dec 03 2022 at 17:32):

Note A; B no longer means "do B to all goals from A"

Scott Morrison (Dec 03 2022 at 17:32):

for that you need <;>

Scott Morrison (Dec 03 2022 at 17:33):

Then, the other change is that simpa using h will fail it if simplifies h to False. You have to change this just to simp at h.

Yaël Dillies (Dec 03 2022 at 17:33):

Yeah, I thought so too, so I tried ; ... <:>, but you did <;> ... ; instead?

Yaël Dillies (Dec 03 2022 at 17:33):

Wait sorry, why does simplifying it to False make it fail?

Scott Morrison (Dec 03 2022 at 17:34):

In your case, the simpa using h was doing something pretty weird: there were two goals open. It killed the first one during the simp at h stage, and then tried exact h on the second goal, but by then h wasn't in scope anymore (rather: there was an h in scope, but a different one)

Scott Morrison (Dec 03 2022 at 17:34):

Because if simp at h reduces h to False it will immediately close the goal.

Scott Morrison (Dec 03 2022 at 17:34):

and simpa is currently not smart enough to realise it shouldn't try assumption.

Scott Morrison (Dec 03 2022 at 17:35):

This should be fixed; someone needs to make a PR to std, where simpa now lives.

Scott Morrison (Dec 03 2022 at 17:36):

(The reason I knew something weird was happening with the goals was that the error message had a tombstone next to the h, indicating it wasn't the h I thought it was.)

Yaël Dillies (Dec 03 2022 at 17:36):

That calls for more questions than it answers :^)

  1. Haven't we fixed the fact that simpa doesn't focus on one goal?
  2. Can't we use the same name for different hypotheses through goals anymore? I thought it was a great, if not hacky, feature, as that means you can run the same proof in parallel when doing a case bash.

Yaël Dillies (Dec 03 2022 at 17:37):

Oh I guess that answers 1 actually no, we are talking about different things. But I still don't see why the h in the second goal was a different h. It was introduced with the same lambda.

Scott Morrison (Dec 03 2022 at 17:38):

sort of... :-) There are two different hs here. When you use <;> it correctly uses the correct h in each branch of the proof (see the fix I pushed). However when simpa using h did something wonky switching from one goal to another, Lean correctly detected that it was talking about the wrong h!

Scott Morrison (Dec 03 2022 at 17:39):

There's certainly a problem in simpa, but Lean 4 handled the bad instructions it received well.

Mario Carneiro (Dec 04 2022 at 02:10):

Oh, I had some recent fixes to simpa but apparently they weren't pushed. Is there a MWE for the issue you folks are talking about so I can see if this issue has already been fixed?

Mario Carneiro (Dec 04 2022 at 02:12):

(It appears I can't even look at the original PR, since it was force-pushed away. Please don't do that to issues which have been permalinked to zulip.)

Yaël Dillies (Dec 04 2022 at 02:16):

Yes you can. I just force-pushed over Ruben's fix as I had a better fix in local, but the first commit still has the error mentioned here.

Mario Carneiro (Dec 04 2022 at 02:23):

can you please MWE it?

Mario Carneiro (Dec 04 2022 at 02:25):

I don't even see simpa in the code

Mario Carneiro (Dec 04 2022 at 02:33):

Actually, reading Scott's description of the issue I'm pretty sure it's exactly what I was trying to fix, so I think I'll just leave it at that.

Yaël Dillies (Dec 04 2022 at 10:37):

Ah sorry, actually Scott answered #839 on this thread that was about #840. #839 is where the failing simpa is.


Last updated: Dec 20 2023 at 11:08 UTC