Zulip Chat Archive

Stream: mathlib4

Topic: coercion from PNat to Nat is not reducing


David Renshaw (Mar 19 2023 at 02:50):

import Mathlib.Data.PNat.Basic

lemma foo (p :   Prop) (k' : ) (hk': 0 < k') (hpk' : p k') :
     k : +, p k.val := by
  use k', hk'
  dsimp -- (doesn't do anything!?)
  -- I expect goal to be `p k'` here,
  -- but instead it's `p ↑{ val := k', property := hk' }`
  sorry

David Renshaw (Mar 19 2023 at 02:51):

How can I get { val := k', property := hk' }.val to reduce to k'? In mathlib3, dsimp worked here.

Jireh Loreaux (Mar 19 2023 at 13:57):

docs4#PNat.mk_coe ?

Jireh Loreaux (Mar 19 2023 at 13:58):

I think the problem is that the arrow is PNat.val instead of Subtype.val (but these are defeq)

David Renshaw (Mar 19 2023 at 14:28):

Yep, rw[PNat.mk_coe] works: https://github.com/dwrensha/math-puzzles-in-lean4/commit/3cae4ff98f250319450f6ff408369f1822df2f15

David Renshaw (Mar 19 2023 at 14:28):

Thanks!

David Renshaw (Mar 19 2023 at 14:29):

It's still counterintuitive to me that this doesn't just reduce on its own.

Jeremy Tan (Mar 19 2023 at 14:30):

@David Renshaw can you formalise a proof of IMO 1988 Q6 (the "Vieta jumping" problem)?

Eric Wieser (Mar 19 2023 at 14:35):

Jeremy Tan said:

David Renshaw can you formalise a proof of IMO 1988 Q6 (the "Vieta jumping" problem)?

Have you seen https://leanprover-community.github.io/mathlib_docs/imo/imo1988_q6.html?

Eric Wieser (Mar 19 2023 at 14:46):

Jireh Loreaux said:

docs4#PNat.mk_coe ?

This feels like it should be marked simp, and the porting note is wrong.

Eric Wieser (Mar 19 2023 at 14:54):

!4#2989


Last updated: Dec 20 2023 at 11:08 UTC