Zulip Chat Archive

Stream: mathlib4

Topic: Data.PNat.Factors !4#1830


Ruben Van de Velde (Feb 01 2023 at 08:30):

This has an odd error where apparently lean can't find the Pow ℕ+ ℕ instance. Would be great if someone could take a look

Lukas Miaskiwskyi (Feb 05 2023 at 11:14):

I definitely have seen Pow errors like this before, and the common solution seems to be replacing a^b with Pow.pow a b, but that is not ideal indeed. An example with a useful porting note is in Data.PNat.Basic:

-- Porting note:
-- mathlib3 statement was
-- `((m ^ n : ℕ+) : ℕ) = (m : ℕ) ^ n`
-- where the left `^ : ℕ+ → ℕ → ℕ+` was `monoid.has_pow`.
-- Atm writing `m ^ n` means automatically `(↑m) ^ n`.
@[simp, norm_cast]
theorem pow_coe (m : +) (n : ) : ((Pow.pow m n : +) : ) = (m : ) ^ n :=
  rfl
#align pnat.pow_coe PNat.pow_coe

How do we get ^ to behave more naturally?

Eric Wieser (Feb 05 2023 at 21:02):

Is docs4#instHPow a thing?

Eric Wieser (Feb 05 2023 at 21:03):

Oh, it's already a default instance


Last updated: Dec 20 2023 at 11:08 UTC