Zulip Chat Archive

Stream: general

Topic: Lean 3.12.0


Gabriel Ebner (May 14 2020 at 13:48):

As every week, I'm proud to release the latest version of the Lean community fork, Lean 3.12.0. Thanks to @Yury G. Kudryashov, @Johan Commelin, @Mario Carneiro, @Jannis Limperg! Here is the changelog:

Features:

- tactic combinators with informative results (lean#212)
- has_singleton is a new typeclass (lean#217)
- Add instances for has_repr name, has_repr case_tag, and has_to_format case_tag (lean#230)

Changes:

- library/init/function: use dot notation, add some docstrings (lean#216)
- tactic.all_goals is now called tactic.all_goals', etc. (lean#212)
- norm_num is removed (lean#224)
- Parse {a,b,c} as right associative (lean#153)
- Refactor case tags (lean#228)
- Enable pp.generalized_field_notation by default (lean#227)

Johan Commelin (May 14 2020 at 14:07):

Are there plans for bumping mathlib?

Gabriel Ebner (May 14 2020 at 14:11):

I'm currently on the segfault with lean#234

Johan Commelin (May 14 2020 at 14:17):

I'm not saying you should do it. Many people contributed to this release. Many others could also help with moving mathlib onto it.

Johan Commelin (May 14 2020 at 14:38):

Before I mess up again... what is a good branch name?

Johan Commelin (May 14 2020 at 14:38):

I could of course go for jmc-bump-to-3-12-0, but I want something a bit more professional (-;

Johan Commelin (May 14 2020 at 14:41):

#2681 is the start of a draft PR

Jannis Limperg (May 14 2020 at 14:47):

I've added commits that fix all breakage due to my Lean PRs.

Yury G. Kudryashov (May 14 2020 at 14:49):

I'll fix logic/function

Yury G. Kudryashov (May 14 2020 at 14:49):

Unless someone else is already on it

Johan Commelin (May 14 2020 at 14:51):

@Yury G. Kudryashov Please go ahead. I tried a global replace, but borked it.

Johan Commelin (May 14 2020 at 15:10):

@Yury G. Kudryashov Doesn't it need more changes in the rest of mathlib?

Yury G. Kudryashov (May 14 2020 at 15:11):

Yes, it does.

Johan Commelin (May 14 2020 at 15:11):

Can we do a smart global search replace?

Johan Commelin (May 14 2020 at 15:11):

I did things in the wrong order, and ended up replacing substrings that shouldn't have been replaced.

Yury G. Kudryashov (May 14 2020 at 15:11):

No, I want to use dot notation.

Johan Commelin (May 14 2020 at 15:12):

Aha, so it's going to be a lot of work.

Johan Commelin (May 14 2020 at 15:12):

I thought we could do that in a follow-up PR.

Yury G. Kudryashov (May 14 2020 at 15:12):

I'm looking for editable grep mode for Emacs.

Johan Commelin (May 14 2020 at 15:12):

Sorry, can't help you there. Maybe Reid can?

Yury G. Kudryashov (May 14 2020 at 15:13):

OK, let's postpone this to another PR. I'll try to make sed do the job.

Johan Commelin (May 14 2020 at 15:25):

Thanks for pushing @Yury G. Kudryashov

Johan Commelin (May 14 2020 at 15:25):

Next up is

mathlib/src/data/set/basic.lean:584:62: error: type mismatch, term
  rfl
has type
  ?m_2 = ?m_2
but is expected to have type
  {a} = {a}

Johan Commelin (May 14 2020 at 15:25):

I guess this is now because of the has_singleton stuff.

Reid Barton (May 14 2020 at 15:26):

oh boy

Johan Commelin (May 14 2020 at 15:28):

What is the best way forward?

Johan Commelin (May 14 2020 at 15:28):

theorem singleton_def (a : α) : ({a} : set α) = insert a  := rfl

Johan Commelin (May 14 2020 at 15:29):

Are we going to rename such things in this PR?

Johan Commelin (May 14 2020 at 15:29):

I guess it should become singleton_eq_insert_empty_right?

Johan Commelin (May 14 2020 at 15:30):

I would like to keep this PR as small as possible, I think. And then clean up/massage in later PRs

Johan Commelin (May 14 2020 at 15:36):

I've fixed data/set/basic

Johan Commelin (May 14 2020 at 15:37):

@Yury G. Kudryashov I still get errors related to injective/surjective

Johan Commelin (May 14 2020 at 15:37):

In data.equiv.basic

Yury G. Kudryashov (May 14 2020 at 15:37):

I'm pushing one or two renames at a time.

Yury G. Kudryashov (May 14 2020 at 15:42):

singleton_def is now (insert_singleton_eq a).symm

Yury G. Kudryashov (May 14 2020 at 15:42):

Where insert_singleton_eq comes from is_lawful_singleton instance.

Yury G. Kudryashov (May 14 2020 at 15:43):

And mem_singleton_iff is now iff.rfl

Johan Commelin (May 14 2020 at 15:49):

Ok... is that better than what I did? Or does it not matter?

Johan Commelin (May 14 2020 at 15:49):

Dinner now... I'll be back later.

Yury G. Kudryashov (May 14 2020 at 15:49):

I answered before looking at your diff

Yury G. Kudryashov (May 14 2020 at 15:51):

No need to use ext

Yury G. Kudryashov (May 14 2020 at 15:54):

In finset I'm going to reuse finset.singleton for has_singleton.

Johan Commelin (May 14 2020 at 17:27):

@Yury G. Kudryashov What's the status here?

Johan Commelin (May 14 2020 at 17:27):

Something I can help with?

Yury G. Kudryashov (May 14 2020 at 17:27):

I'm working on finset. You can choose some other file.

Johan Commelin (May 14 2020 at 17:30):

@Mario Carneiro

tactic/ring.lean:106:9: warning: failed to generate bytecode for 'eval_horner'
code generation failed, VM does not have code for 'tactic.norm_num'
tactic/ring.lean:143:9: error: equation compiler failed to generate bytecode for 'eval_add._main'
nested exception message:
code generation failed, VM does not have code for 'tactic.norm_num'
tactic/ring.lean:205:9: error: equation compiler failed to generate bytecode for 'eval_neg._main'
nested exception message:
code generation failed, VM does not have code for 'tactic.norm_num'

Is this good or bad news?

Mario Carneiro (May 14 2020 at 17:32):

that's fine, tactic.ring was calling tactic.norm_num to evaluate some additions and multiplications, they just need to be redirected to the norm_num calls

Johan Commelin (May 14 2020 at 17:33):

Is this something that a human sed like me can do?

Johan Commelin (May 14 2020 at 17:34):

I guess the mere fact that tactic.norm_num still exists means that I didn't do a good job in my PR to core.

Johan Commelin (May 14 2020 at 17:35):

But it's hidden in some file about simp.

Gabriel Ebner (May 14 2020 at 17:35):

@Johan Commelin Please do not clean square rooms in a circular way: https://github.com/leanprover-community/lean/blob/aa5e30d24fefd13fb5b272522b9c08f9c5491d18/library/init/meta/simp_tactic.lean#L456

Gabriel Ebner (May 14 2020 at 17:36):

But don't worry. It's not dangerous. It will just throw an error when you call it. But it should be removed.

Johan Commelin (May 14 2020 at 17:37):

@Gabriel Ebner Yup, I also just found it.

Johan Commelin (May 14 2020 at 17:58):

Anyway, how should I fix this? What does

redirected to the norm_num calls

mean?

Rob Lewis (May 14 2020 at 18:01):

I think you can replace calls to tactic.norm_num with calls to norm_num.derive'? Or maybe derive.

Rob Lewis (May 14 2020 at 18:02):

derive' seems right.

Johan Commelin (May 14 2020 at 18:03):

Thx, let me try

Johan Commelin (May 14 2020 at 18:05):

Hmmmz, doesn't seem to help. Same error message.

Mario Carneiro (May 14 2020 at 18:05):

I'll prep a PR shortly for this. You (I) can call the internal norm_num functions and avoid some of the dispatching

Mario Carneiro (May 14 2020 at 18:06):

it also allows us to cache instances across multiple norm_num invocations in the same ring call, which we couldn't do before, so a possible performance improvement

Johan Commelin (May 14 2020 at 18:07):

For eval_neg it did help to tag on .derive'

Rob Lewis (May 14 2020 at 18:09):

Oh yeah, ignore me, I'm working on a version of mathlib like two commits before the norm_num update.

Johan Commelin (May 14 2020 at 18:09):

Is the problem that eval_add is passing on a pair, and norm_num.derive' expects a single number?

Johan Commelin (May 14 2020 at 18:09):

@Rob Lewis Ooh, it did fix 1 error (-;

Mario Carneiro (May 14 2020 at 18:10):

What's the problem with the drop in replacement of derive'?

Mario Carneiro (May 14 2020 at 18:10):

that should also work

Johan Commelin (May 14 2020 at 18:11):

I really don't understand the error:

equation compiler failed to generate bytecode for 'eval_add._main'
nested exception message:
code generation failed, VM does not have code for 'tactic.norm_num'

Johan Commelin (May 14 2020 at 18:11):

I don't see any reference to tactic.norm_num anymore

Johan Commelin (May 14 2020 at 18:12):

/me stupid

Johan Commelin (May 14 2020 at 18:12):

I missed an error higher up in the file

Johan Commelin (May 14 2020 at 18:12):

It's all fixed now. Thanks Rob and Mario!

Johan Commelin (May 14 2020 at 18:20):

Hmm, but ring is now failing in tactic.omega.eq_elim on:

tactic failed, there are unsolved goals
state:
v :   ,
b : ,
as : list ,
n : ,
h1 : 0 < get n as,
h2 : 0 = term.val v (b, as),
a_n :  := get n as,
m :  := a_n + 1,
h3 : m  0
 (-(a_n * sgm v b as n) + sym_sym m b + coeffs.val_except n v (list.map (sym_sym m) as)) * m =
    (sym_sym m b + (coeffs.val_except n v (list.map (sym_sym m) as) - a_n * sgm v b as n)) * m

Johan Commelin (May 14 2020 at 18:27):

It's really weird, it's something that ring should easily solve.

Johan Commelin (May 14 2020 at 18:32):

Ugly fix: https://github.com/leanprover-community/mathlib/pull/2681/commits/87e05736402caefbb7febac7983992a29616c04d

Johan Commelin (May 14 2020 at 18:36):

It seems that (all?) other errors are about singleton stuff. How's that going @Yury G. Kudryashov ?

Yury G. Kudryashov (May 14 2020 at 18:37):

Almost there.

Yury G. Kudryashov (May 14 2020 at 18:38):

Fixed multiset and finset files.

Yury G. Kudryashov (May 14 2020 at 18:39):

A new inconvenience: (({a} : finset α) : set α) is no longer defeq {a}

Bhavik Mehta (May 14 2020 at 18:39):

Oof I wonder if this is gonna kill my combinatorics project... We shall see! (At least I was warned by basically everyone that this would happen)

Yury G. Kudryashov (May 14 2020 at 18:41):

I can't make a ∈ ({b} : finset α) defeq a = b because it comes from lists.

Johan Commelin (May 14 2020 at 18:41):

@Bhavik Mehta you mean

(({a} : finset α) : set α) is no longer defeq {a}
? Are you using sets that much? I thought it would all be finset...

Bhavik Mehta (May 14 2020 at 18:42):

I mean all the set and finset changes

Johan Commelin (May 14 2020 at 18:42):

Yury fixed all of mathlib in ~ 2hours

Yury G. Kudryashov (May 14 2020 at 18:42):

No, I've just fixed finset.lean

Johan Commelin (May 14 2020 at 18:42):

Oooooh..... :no_mouth:

Yury G. Kudryashov (May 14 2020 at 18:43):

This included removing finset.singleton

Bhavik Mehta (May 14 2020 at 18:44):

that's gonna hurt me

Yury G. Kudryashov (May 14 2020 at 18:44):

You just use ({a} : finset α) instead

Yury G. Kudryashov (May 14 2020 at 18:44):

ring fails in quadratic_discriminant

Bhavik Mehta (May 14 2020 at 18:44):

oh fair enough shouldn't be too bad then

Yury G. Kudryashov (May 14 2020 at 18:45):

You should PR your partial progress.

Bryan Gin-ge Chen (May 14 2020 at 18:45):

Exactly, if you'd PR'd it to mathlib then Yury would be fixing your code right now too :joy:

Chris Hughes (May 14 2020 at 18:46):

Isn't fold op [a] defeq to a now on lists. I thought there was a change at some point. So if mem was defined using fold then the defeq might work.

Bhavik Mehta (May 14 2020 at 18:46):

Yeah I know this is my fault

Bhavik Mehta (May 14 2020 at 18:47):

my real hope is that this makes singleton finsets easier to use so that some of my less pleasant proofs can actually be improved

Yury G. Kudryashov (May 14 2020 at 18:47):

But this will break a ∈ b::s defeq a = b ∨ a ∈ s.

Johan Commelin (May 14 2020 at 18:49):

I think ring is simply broken.

Johan Commelin (May 14 2020 at 18:49):

I fixed the errors in tactic/ring but I think I "broke" it at the same time.

Johan Commelin (May 14 2020 at 18:50):

@Mario Carneiro I can't fix this, I fear.

Yury G. Kudryashov (May 14 2020 at 22:03):

I fixed a few more files. Waiting for a fixed tactic/ring.

Johan Commelin (May 15 2020 at 03:35):

@Mario Carneiro Could you please take a look at ring?

Mario Carneiro (May 15 2020 at 03:36):

I'm working on it as we speak

Johan Commelin (May 15 2020 at 03:39):

Awesome

Johan Commelin (May 15 2020 at 03:43):

So I guess we should merge #2685 (new norm_num in ring) before the bump to 3.12.0

Johan Commelin (May 15 2020 at 04:10):

It's really great to see all those finset.singleton x be replaced by {x}.

Johan Commelin (May 15 2020 at 04:31):

@Mario Carneiro Do you think it makes sense to merge your PR into this bump PR already?

Johan Commelin (May 15 2020 at 04:31):

Still keep them as separate PRs, of course

Johan Commelin (May 15 2020 at 04:32):

Really, my question is: Is your PR now stable, or do you still expect a lot of changes?

Mario Carneiro (May 15 2020 at 04:32):

If it compiles I'm happy with it

Johan Commelin (May 15 2020 at 04:39):

@Yury G. Kudryashov I've merged Mario's ring fixes. Just so you know.

Yury G. Kudryashov (May 15 2020 at 05:01):

@Mario Carneiro Please have a look at this docstring

Johan Commelin (May 15 2020 at 05:03):

@Yury G. Kudryashov Oops, didn't realise you were still working on this branch

Johan Commelin (May 15 2020 at 05:04):

I just pushed some stuff

Johan Commelin (May 15 2020 at 05:05):

I'm afraid we can't really parallelise this...

Johan Commelin (May 15 2020 at 05:05):

Or maybe I will just build, and ignore the first 20 errors.

Yury G. Kudryashov (May 15 2020 at 05:06):

Or maybe I'll go eat something and work on a paper for a few hours.

Johan Commelin (May 15 2020 at 05:46):

I pushed a bit. Now it's time to break my fast.

Yury G. Kudryashov (May 15 2020 at 06:26):

Pushed determinant.

Johan Commelin (May 15 2020 at 07:07):

@Yury G. Kudryashov Are you working on this again?

Yury G. Kudryashov (May 15 2020 at 07:08):

I'll fix fractional_ideal, then make another break.

Johan Commelin (May 15 2020 at 07:08):

Ok, good

Johan Commelin (May 15 2020 at 07:23):

I pushed a fix to topology/instances/ennreal

Yury G. Kudryashov (May 15 2020 at 07:43):

Pushed ring_theory/polynomial, fixed ring_theory/adjoin locally

Johan Commelin (May 15 2020 at 07:44):

@Yury G. Kudryashov Could you look at https://github.com/leanprover-community/mathlib/pull/2681/commits/5d1e279722120258238737ca5f95edacb4a6104b

Johan Commelin (May 15 2020 at 07:44):

I don't like it

Johan Commelin (May 15 2020 at 08:05):

@Yury G. Kudryashov I've merged ring_faster again. And pushed.

Yury G. Kudryashov (May 15 2020 at 08:06):

Pushed

Yury G. Kudryashov (May 15 2020 at 09:30):

Opening borel_space

Johan Commelin (May 15 2020 at 09:38):

That's about the last thing with errors, I think

Johan Commelin (May 15 2020 at 09:39):

And something in geometry/manifold/real_instances. After that, maybe we're done :slight_smile:

Yury G. Kudryashov (May 15 2020 at 09:41):

A side effect of the singleton change: we can't do rintro rfl on (H : a ∈ {b}). We can do rintro (rfl|H) but it unfolds b.

Johan Commelin (May 15 2020 at 09:45):

Yup, I noticed this... but I think it's minor compared to all the wins that we got.

Johan Commelin (May 15 2020 at 09:58):

Hooray, Yury pushed. Are we done?

Yury G. Kudryashov (May 15 2020 at 10:03):

No

Johan Commelin (May 15 2020 at 10:04):

Oho... :sad:

Johan Commelin (May 15 2020 at 10:05):

I see... measure_theory/integration. Are you on it @Yury G. Kudryashov ? I can also do it

Yury G. Kudryashov (May 15 2020 at 10:07):

Done.

Yury G. Kudryashov (May 15 2020 at 10:12):

leanpkg build succeeded.

Johan Commelin (May 15 2020 at 10:43):

I've undrafted the PR

Johan Commelin (May 15 2020 at 10:43):

But it depends on the norm_num PR

Yury G. Kudryashov (May 15 2020 at 10:43):

Waiting for lint

Mario Carneiro (May 15 2020 at 14:32):

Yury G. Kudryashov said:

A side effect of the singleton change: we can't do rintro rfl on (H : a ∈ {b}). We can do rintro (rfl|H) but it unfolds b.

Does rintro <> work? I usually try this when rfl doesn't work

Johan Commelin (May 15 2020 at 16:42):

I think #2681 is ready

Gabriel Ebner (May 15 2020 at 17:04):

There is a merge conflict in ring.

Johan Commelin (May 15 2020 at 17:07):

Fixed


Last updated: Dec 20 2023 at 11:08 UTC