Zulip Chat Archive

Stream: mathlib4

Topic: WithBot v WithZero


Kevin Buzzard (Jun 15 2024 at 10:12):

I'm in the middle of a bunch of rewrites and I don't really want to stop, apply norm_cast, and then start again. But I can't find a way around it:

import Mathlib.RingTheory.DedekindDomain.AdicValuation

example (x : Multiplicative ) (hx : 1 < (x : WithZero (Multiplicative ))) : 1 < x := by
  rw [WithBot.one_lt_coe] at hx -- fails

because we have WithBot.one_lt_coe but it won't fire on WithZero. Not even this works:

example (x : Multiplicative ) (hx : 1 < (x : WithZero (Multiplicative ))) : 1 < x := by
  rw [(WithBot.one_lt_coe : (1 : WithZero (Multiplicative )) < x  _)] at hx -- fails

Should I just make WithZero.one_lt_coe or is this frowned upon because it's code duplication?

Yaël Dillies (Jun 15 2024 at 10:13):

It's not code duplication! They are (supposed to be) different types!

Kevin Buzzard (Jun 15 2024 at 11:11):

#13853


Last updated: May 02 2025 at 03:31 UTC