Zulip Chat Archive

Stream: mathlib4

Topic: Rewrite using Ring Isomorphisms


Gareth Ma (Apr 29 2024 at 05:35):

Hello, how do I "rewrite" using f here?

import Mathlib.Algebra.RingQuot
import Mathlib.RingTheory.Ideal.IsPrimary
import Mathlib.RingTheory.Ideal.LocalRing

open Polynomial Ideal Quotient LocalRing

example {R S : Type*} [CommRing R] [CommRing S] (f : R ≃+* S) : IsDomain R  IsDomain S := by
  simp

Riccardo Brasca (Apr 29 2024 at 05:39):

If this is not already in the library (maybe for injective rather than equiv) you can add it, it should be rather easy.

Gareth Ma (Apr 29 2024 at 05:41):

I realised that IsDomain is actually a mix-in. Should this lemma still be written like this?

Gareth Ma (Apr 29 2024 at 05:41):

Or should I use typeclasses

Gareth Ma (Apr 29 2024 at 05:41):

This is failing: for "cannot find synthesization order for instance @instIsDomainToSemiringToCommSemiring with type"

instance {R S : Type*}  [CommRing R] [CommRing S] (f : R ≃+* S) [IsDomain R] : IsDomain S := by
  infer_instance

Riccardo Brasca (Apr 29 2024 at 05:44):

infer_instance cannot use f, so there is no hope it works automatically. You can prove it by hand (noting that injectivity is enough)

Riccardo Brasca (Apr 29 2024 at 05:47):

Something like docs#IsPrincipalIdealRing.of_surjective

Gareth Ma (Apr 29 2024 at 05:48):

I will do it for isomorphism first, then try to use my brain later (x) Thanks!

Gareth Ma (Apr 29 2024 at 05:48):

I have another question here, if you don't mind to take a look

Riccardo Brasca (Apr 29 2024 at 05:49):

I am on my phone, the other one needs a computer I am afraid

Gareth Ma (Apr 30 2024 at 05:29):

What is the syntax for injective ringhom?

Gareth Ma (Apr 30 2024 at 05:47):

Also I'm pretty sure it doesn't work with just a injective ring homomorphism? ZZ[X]/X2\mathbb{Z} \hookrightarrow \mathbb{Z}[X]/\langle X^2 \rangle for example. Sorry for the terrible example...
But I got it for an isomorphism. I'll use that for now :D

Gareth Ma (Apr 30 2024 at 05:49):

theorem IsDomain.of_equiv {R S : Type*} [CommRing R] [CommRing S] (f : R ≃+* S) [IsDomain R] :
    IsDomain S where
  mul_left_cancel_of_ne_zero := by
    /- Prove that ab=ac -> a=0 or b=c by f^-1 (surjectivity) and R is ID -/
    intro a b c ha h
    apply_fun f.symm at h
    simpa [f.symm.map_mul, ha] using h
  mul_right_cancel_of_ne_zero := by
    intro a b c ha h
    apply_fun f.symm at h
    simpa [f.symm.map_mul, ha] using h
  exists_pair_ne := by
    obtain x, y, h := @Nontrivial.exists_pair_ne R _
    use f x, f y, fun h'  h (f.injective h') /- Prove that S is nontrivial using injectivity: |S| >= |R| -/

Eric Wieser (Apr 30 2024 at 05:52):

You should be able to use docs#Function.Injective.nontrivial for that last field

Eric Wieser (Apr 30 2024 at 05:53):

And docs#Function.Injective.noZeroDivisors for the other two

Eric Wieser (Apr 30 2024 at 05:53):

Or just use docs#Function.Injective.isDomain for the whole thing!

Gareth Ma (Apr 30 2024 at 05:53):

Wait hmm why does my example fail then

Gareth Ma (Apr 30 2024 at 05:54):

Oops should’ve searched harder, thanks

Gareth Ma (Apr 30 2024 at 05:55):

No the isDomain is flipped

Eric Wieser (Apr 30 2024 at 05:55):

Sure, but you have an equiv so you can flip that

Gareth Ma (Apr 30 2024 at 05:55):

Ah yea with an equiv yes

Gareth Ma (Apr 30 2024 at 05:56):

It’s very hard to find the instances I need, eg given the equiv f, what dot notations are accessible

Gareth Ma (Apr 30 2024 at 05:56):

Wish there’s a way like dir(f) in Python to list them

Eric Wieser (Apr 30 2024 at 05:56):

Auto complete sometimes helps

Eric Wieser (Apr 30 2024 at 05:57):

@loogle RingEquiv _ _ |- _

loogle (Apr 30 2024 at 05:57):

:exclamation: <input>:1:14: expected end of input

Eric Wieser (Apr 30 2024 at 05:58):

Well, without the |- _ that would have worked

Gareth Ma (Apr 30 2024 at 12:39):

theorem IsDomain.of_equiv {R S : Type*} [CommRing R] [CommRing S] (f : R ≃+* S) [IsDomain R] :
    IsDomain S :=
  f.symm.injective.isDomain f.symm.toRingHom

yay!

Eric Wieser (Apr 30 2024 at 12:54):

Probably not worth having in mathlib though, since it's just a special case of the more general injective case

Eric Wieser (Apr 30 2024 at 12:55):

Oh, I guess the iff version is

Gareth Ma (Apr 30 2024 at 12:59):

Yeah definitely. For iff do you mean IsDomain R iff IsDomain S (given an equiv)?

Gareth Ma (Apr 30 2024 at 13:36):

Ah well in that case you don't need an equiv either you just need a bijective function

Gareth Ma (Apr 30 2024 at 13:36):

probably

Eric Wieser (Apr 30 2024 at 13:37):

All bijective ring homs are equivalences anyway, right?

Gareth Ma (Apr 30 2024 at 13:39):

Think so, oops
It's just RingEquiv.ofBijective

Gareth Ma (Apr 30 2024 at 13:39):

my bad

Kevin Buzzard (Apr 30 2024 at 13:52):

In topology, bijective continuous maps aren't necessarily homeomorphisms, but in algebra this sort of thing is essentially always true.


Last updated: May 02 2025 at 03:31 UTC