Zulip Chat Archive

Stream: general

Topic: fpow and gpow


Sebastien Gouezel (Oct 26 2021 at 14:26):

For int powers, we use currently gpow and fpow. I guess gpow is for "group power" and fpow is for "field power"? Since we have groups with zeroes, the boundary between the two is not clear at all. Here is a random proof on fpow:

lemma fpow_nonneg {a : K} (ha : 0  a) :  (z : ), 0  a ^ z
| (n : ) := by { rw gpow_coe_nat, exact pow_nonneg ha _ }
| -[1+n]  := by { rw gpow_neg_succ_of_nat, exact inv_nonneg.2 (pow_nonneg ha _) }

Yes, the proof uses gpow lemmas all over the place. And when I try to find a lemma, half of the time it is an fpow and half of the time it is a gpow, so automatic completion doesn't work well. What would you think of a serious clean-up, using zpow everywhere?

Yury G. Kudryashov (Oct 26 2021 at 14:29):

Having gpow and fpow made sense some time ago when they used separate definitions etc. I think that it makes much less sense now but there are situations when fpow lemmas need more assumptions. E.g., compare docs#fpow_add and docs#gpow_add.

Yury G. Kudryashov (Oct 26 2021 at 14:29):

What do you suggest for these lemmas?

Sebastien Gouezel (Oct 26 2021 at 14:42):

We could have zpow_add for the first one, and when there is a special version for groups we could spell it gzpow_add. The point being that most lemmas wouldn't have the g, and that this would not break tab completion.

Johan Commelin (Oct 26 2021 at 14:44):

How about appending a for lemmas about groups with zero? That's what we've started doing elsewhere in the library.

Sebastien Gouezel (Oct 26 2021 at 14:45):

Many lemmas are true in general div_inv_monoids.

Yaël Dillies (Oct 26 2021 at 14:46):

Was about to bring up . This is the way forward.

Yaël Dillies (Oct 26 2021 at 14:48):

For other cases, like truncated subtraction vs add_group subtraction, set lattice operations vs lattice operations, we changed the actual name of the operation, but I don't think there's a need for that here.

Johan Commelin (Oct 26 2021 at 14:50):

So for Yury's example I would suggest gpow_add → zpow_add and fpow_add → zpow_add₀.

Sebastien Gouezel (Oct 26 2021 at 14:52):

With the zero used in general div_inv_monoids, and only when disambiguation is needed? I think I like that.

Reid Barton (Oct 26 2021 at 15:00):

While we're at it, can we also rename gsmul to zsmul for parallelism with nsmul?

Sebastien Gouezel (Oct 26 2021 at 15:07):

Maybe in two separate PRs. This one will be painful enough :-)

Yakov Pechersky (Oct 26 2021 at 16:15):

Anne asked if there is some sort of general cancellative_inv_monoid where fpow makes sense. I tried to code it up but ran into issues, as part of giving matrices an fpow:
https://github.com/leanprover-community/mathlib/pull/8683#issuecomment-922407544

Eric Wieser (Oct 26 2021 at 18:10):

On a related note; I was also wondering whether we want to make ring.inverse a field of ring so that we can just use \inv on rings. In particular, it would be nice to unify docs#matrix.has_inv and docs#ring.inverse such that ring.inverse A.det • A.adjugate = ring.inverse A was true by definition

Reid Barton (Oct 26 2021 at 20:20):

As in an actual field of the ring structure? I'm not a big fan because ring.inverse is nonalgebraic (e.g. it's not preserved by ring homomorphisms or computed componentwise in product instances)

Sebastien Gouezel (Oct 26 2021 at 20:52):

#9989 (wow, 10000 is getting pretty close!)

Yaël Dillies (Oct 26 2021 at 20:53):

Yes!! Who will be the lucky one?

Yaël Dillies (Oct 26 2021 at 20:53):

Can you believe that we were at 6500 when I joined?

Kevin Buzzard (Oct 26 2021 at 21:02):

Can you believe that we were at 21 when I joined??

Kevin Buzzard (Oct 26 2021 at 21:02):

What's happened here over the last four years is really quite extraordinary

Thomas Browning (Oct 26 2021 at 21:06):

Anyone got a good PR lined up for #10000 ?

Yaël Dillies (Oct 26 2021 at 21:14):

I can make it Szemerédi regularity lemma, but it will wait for quite a while before being merged. Also, I don't want to spoil anyone else's opportunity on this one.

Alex J. Best (Oct 26 2021 at 21:14):

Maybe we should bump the version of mathlib to 0.2 or something xD https://github.com/leanprover-community/mathlib/blob/master/leanpkg.toml

Yaël Dillies (Oct 26 2021 at 21:15):

Oooh that would be nice.

Alex J. Best (Oct 26 2021 at 21:15):

/disclaimer I have no idea if that would subtly break anyones external project

Thomas Browning (Oct 26 2021 at 21:18):

I could do Schur-Zassenhaus, although it's still got some work left.

Bryan Gin-ge Chen (Oct 26 2021 at 21:18):

Maybe leanprover-community-bot will snipe it with an update nolints PR.

Yaël Dillies (Oct 26 2021 at 21:19):

It might, because data.list.sigma earned its module docstring today.

Thomas Browning (Oct 26 2021 at 21:20):

Can you beat the bot if you're really quick on the draw (e.g., line up two PRs and do one right after the other)?

Yaël Dillies (Oct 26 2021 at 21:20):

Yup. The bot always does its PR at the same time, around 3 AM.

Yaël Dillies (Oct 26 2021 at 21:21):

(don't know how to get the fancy true-for-all-timezones thingy)

Patrick Massot (Oct 26 2021 at 21:37):

I'd love to see Yury filling this 10000 spot with a nice complex analysis PR.

Thomas Browning (Oct 26 2021 at 21:47):

Are we getting close to something big?

Patrick Massot (Oct 26 2021 at 21:51):

Yury did a version of Stokes which is enough to get some version of the Cauchy formula.

Heather Macbeth (Oct 27 2021 at 05:46):

I decided to sneak diagonalization in before the magic number. #9995

Yury G. Kudryashov (Oct 27 2021 at 06:24):

@Patrick Massot I want to do prove that the integral over circle is the same as ∫ x in a..(a + 2π), f x first.

Yury G. Kudryashov (Oct 27 2021 at 06:24):

This will make the Cauchy formula proofs and statements more readable.

Yury G. Kudryashov (Oct 27 2021 at 06:24):

(currently I use ∫ x in -π..π, f x a lot)

Johan Commelin (Oct 27 2021 at 06:35):

@Yury G. Kudryashov You could still reserve the PR number (-;

Yury G. Kudryashov (Oct 27 2021 at 06:39):

OK, reserved.

Yury G. Kudryashov (Oct 27 2021 at 06:39):

Possibly, I'll swap #10000 and #8903 later.

Yaël Dillies (Oct 27 2021 at 07:30):

:tada: Happy birthday mathlib!! :birthday:

Sebastien Gouezel (Oct 27 2021 at 08:08):

Reid Barton said:

While we're at it, can we also rename gsmul to zsmul for parallelism with nsmul?

I'll do it once/if #9989 is merged: there would be many conflicts between the two PRs, so not point making it now.

Johan Commelin (Oct 27 2021 at 08:11):

I vote for merging this, and merging it soon.

Rob Lewis (Nov 03 2021 at 13:20):

Bryan Gin-ge Chen said:

Maybe leanprover-community-bot will snipe it with an update nolints PR.

:robot: missed #10000 but did just claim the 10000th commit to master


Last updated: Dec 20 2023 at 11:08 UTC