Subtype p
, usually written as {x : α // p x}
, is a type which
represents all the elements x : α
for which p x
is true. It is structurally
a pair-like type, so if you have x : α
and h : p x
then
⟨x, h⟩ : {x // p x}
. An element s : {x // p x}
will coerce to α
but
you can also make it explicit using s.1
or s.val
.
Constructor
Subtype.mk.{u} {α : Sort u} {p : α → Prop}
(val : α) (property : p val) : Subtype p |
Fields
property | : | p self.val |
If | ||
val | : | α |
If |