Zulip Chat Archive

Stream: mathlib4

Topic: WithBot manipulation?


Siddharth Bhat (Oct 13 2023 at 23:14):

Not sure where I should ask this. Here's an MWE of something I'm trying to prove, I don't know how to get WitBot's arithmetic instances to play nice:

theorem withBotManipulation
  (H1 : (2 : WithBot ) ^ 5 = some val)
  (H2 : val' < 2^5) : val' < val := by sorry

Kevin Buzzard (Oct 13 2023 at 23:20):

#mwe s contain all imports ;-)

Kevin Buzzard (Oct 13 2023 at 23:28):

import Mathlib.Tactic

theorem foo (H1 : (2 : WithBot ) ^ 5 = some val) : val = 2 ^ 5 := by
  norm_cast at H1 -- this line not necessary but proof becomes unreadable without it
  cases H1
  simp

theorem withBotManipulation
    (H1 : (2 : WithBot ) ^ 5 = some val)
    (H2 : val' < 2^5) : val' < val := by
  rw [foo H1]
  assumption

Eric Wieser (Oct 13 2023 at 23:30):

Which some is that?

Siddharth Bhat (Oct 13 2023 at 23:31):

Aha, super, norm_cast was indeed what I was looking for! Thanks @Kevin Buzzard !

Eric Wieser (Oct 13 2023 at 23:32):

It should be docs#WithBot.some, but I suspect it's actually Option.some

Eric Wieser (Oct 13 2023 at 23:34):

I just checked; it's the wrong some, and that's going to make proving things annoying


Last updated: Dec 20 2023 at 11:08 UTC