Zulip Chat Archive

Stream: lean4

Topic: How to get subtype element


Mathias Schack Rabing (Mar 12 2022 at 22:37):

Hi if I e.g. have (p (n : ℕ): Prop := n ≠ 0). How do i then get from an element (n : ℕ) where (n ≠ 0) get the corresponding element in (subtype p).
Thanks for the help

Henrik Böving (Mar 12 2022 at 22:47):

I'm not quite sure what you are asking for but if you have some element x of typeSubtypeyou can get the value with x.val and if you want to construct one you can use the Subtype.mk constructor

Mathias Schack Rabing (Mar 12 2022 at 23:05):

Thank you it was the Subtype.mk contructor i couldn't find

Kevin Buzzard (Mar 12 2022 at 23:35):

You can use pointy brackets \<n, proof\> as well


Last updated: Dec 20 2023 at 11:08 UTC