Zulip Chat Archive

Stream: Is there code for X?

Topic: X mod N mod D v X mod D


Kevin Buzzard (May 10 2024 at 13:30):

Do we have this?

import Mathlib.Data.Nat.ModEq
import Mathlib.Data.ZMod.Algebra

example (D N : ) (h : D  N) (e : ZMod N) : e.val  (ZMod.castHom h _ e : ZMod D).val [MOD D] := sorry

I need it for Fermat's Last Theorem :-)

Ruben Van de Velde (May 10 2024 at 14:05):

import Mathlib.Data.Nat.ModEq
import Mathlib.Data.ZMod.Algebra

example (D N : ) (h : D  N) (e : ZMod N) : e.val  (ZMod.castHom h _ e : ZMod D).val [MOD D] := by
  simp
  have : NeZero N := sorry
  rw [ZMod.cast_eq_val]
  rw [@ZMod.val_natCast]
  rw [@Nat.ModEq.comm]
  exact Nat.mod_modEq e.val D

Kevin Buzzard (May 10 2024 at 14:16):

Oh thanks! In the application N is indeed positive (unsurprisingly this is a ZHat thing).

Ruben Van de Velde (May 10 2024 at 14:19):

(I guessed as much, and have no idea if it's true for 0 anyway)


Last updated: May 02 2025 at 03:31 UTC