Zulip Chat Archive

Stream: Is there code for X?

Topic: ideal.nat_cast


María Inés de Frutos Fernández (Sep 20 2022 at 11:35):

Do we have the following lemma?

import ring_theory.ideal.operations

lemma ideal.nat_cast (R : Type*) [comm_ring R] (n : ) :
  (n : ideal R) = ideal.span ({n} : set R) :=
sorry

Yaël Dillies (Sep 20 2022 at 11:37):

Is that true? If it were true, span {2} = 2 = 1 + 1 = span {1} + span {1} = univ + univ = univ

Kevin Buzzard (Sep 20 2022 at 11:53):

n : ideal R looks to me like an unfortunate consequence of the "if it has a + and a 0 and a 1, then it has an n for all n" rule (which is gone in Lean 4 if I understand correctly).

Riccardo Brasca (Sep 20 2022 at 11:54):

This indeed looks false. Addition on ideal R comes from docs#submodule.pointwise_add_comm_monoid, so it is the ideal generated by the two ideals, and 1 is the full ring. In particular 1+1+1+... = 1. The notation n : ideal R is mathematically irrelevant.

María Inés de Frutos Fernández (Sep 20 2022 at 11:58):

OK, I see. The (n : ideal R) appeared after applying simp to an hypothesis of the form n • I = 0, for I an ideal, but it seems that this is not the correct way to express this in Lean. Thanks!

Riccardo Brasca (Sep 20 2022 at 12:02):

Can you squeeze the simp and see which lemma is applied?

María Inés de Frutos Fernández (Sep 20 2022 at 12:02):

Yes, it applied nsmul_eq_mul.

Riccardo Brasca (Sep 20 2022 at 12:02):

n • I = I, right?

Yaël Dillies (Sep 20 2022 at 12:02):

docs#nsmul_eq_mul by any chance?

Riccardo Brasca (Sep 20 2022 at 12:04):

So I guess what is missing is a simp lemma saying ↑n * I = I

Riccardo Brasca (Sep 20 2022 at 12:05):

Wait

Alex J. Best (Sep 20 2022 at 12:06):

Kevin Buzzard said:

n : ideal R looks to me like an unfortunate consequence of the "if it has a + and a 0 and a 1, then it has an n for all n" rule (which is gone in Lean 4 if I understand correctly).

If we keep the semifield instance on fractional_ideal then I'd imagine we will always have a way of writing numerals and getting fractional ideals at least

Alex J. Best (Sep 20 2022 at 12:07):

Riccardo Brasca said:

Wait

unless n is 0?

Riccardo Brasca (Sep 20 2022 at 12:07):

Yes, that's annoying

Riccardo Brasca (Sep 20 2022 at 12:09):

@María Inés de Frutos Fernández it seems that cases n; simp is already able to do everything

Riccardo Brasca (Sep 20 2022 at 12:10):

It treats the cases as expected

María Inés de Frutos Fernández (Sep 20 2022 at 12:12):

Thanks!

Kevin Buzzard (Sep 20 2022 at 12:15):

Patrick gives this example (ideals) as the reason we need to have nonsense like semirings instead of just working with rings ;-) Great to see it working so well! ;-)

Yaël Dillies (Sep 20 2022 at 12:17):

I didn't know you hated nat so much, Kevin!

Kevin Buzzard (Sep 20 2022 at 12:17):

long live int!

Kevin Buzzard (Sep 20 2022 at 12:19):

We have a lot of lemmas proved for rings and then special cases nat.same_lemma and nnreal.same_lemma . If we dropped semirings we'd just have more of these.

Riccardo Brasca (Sep 20 2022 at 12:23):

It would be nice if simp could do the cases n part by itself, but this is maybe impossible.


Last updated: Dec 20 2023 at 11:08 UTC