Zulip Chat Archive

Stream: Is there code for X?

Topic: IsUnit and CharP


Eric Wieser (Mar 06 2025 at 22:08):

Is the following true? What counterexample am I missing if not?

variable {A : Type*} [Ring A] (p : ) [Fact (Nat.Prime p)] [CharP A p]
theorem natCast_iff_of_charP {n : } : IsUnit (n : A)  ¬ (p  n) := sorry

Eric Wieser (Mar 06 2025 at 22:26):

Answer: Yes, but my proof in #22237 is super ugly

Eric Wieser (Mar 06 2025 at 22:31):

import Mathlib

variable {A : Type*} [Ring A] (p : ) [Fact (Nat.Prime p)] [CharP A p]

theorem natCast_iff_of_charP {n : } : IsUnit (n : A)  ¬ (p  n) := by
  constructor
  · rintro x, hx
    rw [ CharP.cast_eq_zero_iff (R := A),  hx]
    have := CharP.nontrivial_of_char_ne_one (R := A) (Nat.Prime.ne_one Fact.out : p  1)
    exact x.ne_zero
  · intro h
    rw [  ZMod.cast_natCast' (n := p)]
    let u : (ZMod p)ˣ := .mk0 n (ZMod.natCast_zmod_eq_zero_iff_dvd _ _ |>.not.mpr h)
    let u' := u.map (ZMod.castHom (dvd_refl p) A).toMonoidHom
    exact u', rfl

Eric Wieser (Mar 06 2025 at 22:32):

Going through ZMod.cast feels a little silly

Aaron Liu (Mar 06 2025 at 22:34):

I would have done it the same way

Eric Wieser (Mar 06 2025 at 22:48):

Maybe the resolution I want here is "generalize the approach used to build the inverse on zmod"

Kevin Buzzard (Mar 06 2025 at 22:49):

The inverse is p.gcdB n if that's any help

Kevin Buzzard (Mar 06 2025 at 22:51):

  · intro h
    rw [ Nat.Prime.coprime_iff_not_dvd Fact.out] at h
    have := h  p.gcd_eq_gcd_ab n
    -- this : ↑1 = ↑p * p.gcdA n + ↑n * p.gcdB n

Yakov Pechersky (Mar 06 2025 at 23:22):

I would except a lemma like docs#CharTwo.two_zsmul to exist but for smul and arbitrary CharP.

Yakov Pechersky (Mar 06 2025 at 23:24):

Why wouldn't ZMod be the right thing to go through?

Eric Wieser (Mar 07 2025 at 00:43):

#22669

Eric Wieser (Mar 07 2025 at 00:47):

Is this stronger result true?

import Mathlib

variable [Ring R] {p : } [CharP R p]
-- I already have the other direction
theorem CharP.coprime_of_isUnit {n : } : IsUnit (n : R)  n.Coprime p

Adam Topaz (Mar 07 2025 at 00:57):

Yes

Adam Topaz (Mar 07 2025 at 01:00):

I assume we have the characterization of units in ZMod? docs#ZMod.isUnit_iff_coprime

Eric Wieser (Mar 07 2025 at 01:00):

docs#ZMod.isUnit_iff_coprime indeed exists

Eric Wieser (Mar 07 2025 at 01:01):

I don't see how to ensure that there aren't some "surprise" units in R for things that weren't units in ZMod p

Adam Topaz (Mar 07 2025 at 01:09):

I guess one needs to know something about the localizations of Z/n\mathbb{Z}/n, but I'm trying to think of a more elementary proof...

Aaron Liu (Mar 07 2025 at 01:09):

The non-units in ZMod p are zero-divisors

Eric Wieser (Mar 07 2025 at 01:10):

I'm thinking of the elements of R which live outside the range of ZMod.cast

Aaron Liu (Mar 07 2025 at 01:11):

Zero divisors can't be units, and that property is preserved by ring homomorphisms.

Adam Topaz (Mar 07 2025 at 01:11):

Right, exactly.

Adam Topaz (Mar 07 2025 at 01:11):

Well, they're preserved by \emph{injective} ring hom :)

Eric Wieser (Mar 07 2025 at 01:12):

I'm guessing I can't avoid ZMod so easily for this case?

Adam Topaz (Mar 07 2025 at 01:12):

I don't think so :)

Aaron Liu (Mar 07 2025 at 01:13):

Adam Topaz said:

Well, they're preserved by \emph{injective} ring hom :)

(forgot about 0)

Antoine Chambert-Loir (Mar 15 2025 at 21:30):

What about the zero ring?

Antoine Chambert-Loir (Mar 15 2025 at 21:31):

In any case, if a prime p is nilpotent in R, say p ^ m = 0, and n is prime to p, then there are natural integers such that a * n = b * p ^ m + 1, and this implies that n is invertible in R.


Last updated: May 02 2025 at 03:31 UTC