Zulip Chat Archive

Stream: mathlib4

Topic: mathport funext


James Gallicchio (Jan 10 2023 at 09:05):

Small issue -- looks like when porting lean3 funext tactic, mathport just put lean4 funext, which doesn't work -- it should probably (?) be replaced with funext _ everywhere it's used

Mario Carneiro (Jan 10 2023 at 09:18):

what does funext do in lean 3 and lean 4?

Mario Carneiro (Jan 10 2023 at 09:19):

Usually when tactic behavior doesn't match up it is preferable to fix the tactics rather than automate a wide scale usability regression

Mario Carneiro (Jan 10 2023 at 09:20):

unless there is an argument for why the new behavior is better than the old one

James Gallicchio (Jan 10 2023 at 09:23):

Both are basically equivalent to apply funext; intro, is my impression. lean3 funext would autogenerate a name if none was provided, while lean4 funext requires it. since lean4 intro autogenerates a name, funext should probably be modified to do the same

Kevin Buzzard (Jan 10 2023 at 09:25):

So basically there's a bunch of unhygienic lean 3 code being incorrectly ported

James Gallicchio (Jan 10 2023 at 09:26):

(Is there a situation where apply funext; intro _ wouldn't work as a translation..? not sure what effect hygiene issues have on porting)

James Gallicchio (Jan 10 2023 at 09:28):

There's actually a few unrelated mathport issues cropping up in Data.List.Permutation, should I make new threads or just list them here?

Mario Carneiro (Jan 10 2023 at 10:02):

James Gallicchio said:

Both are basically equivalent to apply funext; intro, is my impression. lean3 funext would autogenerate a name if none was provided, while lean4 funext requires it.

I'm asking what funext does, full stop no extra argument

Mario Carneiro (Jan 10 2023 at 10:03):

what do you mean by lean4 funext requires it? Is it an error?

Mario Carneiro (Jan 10 2023 at 10:05):

Kevin Buzzard said:

So basically there's a bunch of unhygienic lean 3 code being incorrectly ported

It's not clear to me that hygiene is the issue here. That would only be if follow up code talks about a or something assuming that the introduced name is a; our use of :ahat: in lean 3 addresses most of those cases though

Yaël Dillies (Jan 10 2023 at 10:06):

Not in the case of ext, though. ext gets its name from the variable name that is used in the lambda expression.

Mario Carneiro (Jan 10 2023 at 10:06):

James Gallicchio said:

There's actually a few unrelated mathport issues cropping up in Data.List.Permutation, should I make new threads or just list them here?

You can put them in one thread, but the thread should be called Data.List.Permutation in that case

Yaël Dillies (Jan 10 2023 at 10:06):

And that is unhygienic because those names tend to change when lemmas are moved around.

Mario Carneiro (Jan 10 2023 at 10:06):

I said most

Mario Carneiro (Jan 10 2023 at 10:07):

lean 4 can do that too (variable names are officially part of the signature now)

Mario Carneiro (Jan 10 2023 at 10:08):

so you should not change the names of variables by moving them, that's a breaking change similar to changing the lemma statement

James Gallicchio (Jan 10 2023 at 10:08):

Mario Carneiro said:

what do you mean by lean4 funext requires it? Is it an error?

syntax error:

macro_rules
  | `(tactic|funext $x) => `(tactic| apply funext; intro $x:term)
  | `(tactic|funext $x $xs*) => `(tactic| apply funext; intro $x:term; funext $xs*)

It's a one-line fix :)

Mario Carneiro (Jan 10 2023 at 10:09):

well that was easy


Last updated: Dec 20 2023 at 11:08 UTC