Sigma types #
This file proves basic results about sigma types.
A sigma type is a dependent pair type. Like α × β
but where the type of the second component
depends on the first component. More precisely, given β : ι → Type*
, Sigma β
is made of stuff
which is of type β i
for some i : ι
, so the sigma type is a disjoint union of types.
For example, the sum type X ⊕ Y
can be emulated using a sigma type, by taking ι
with
exactly two elements (see Equiv.sumEquivSigmaBool
).
Σ x, A x
is notation for Sigma A
(note that this is \Sigma
, not the sum operator ∑
).
Σ x y z ..., A x y z ...
is notation for Σ x, Σ y, Σ z, ..., A x y z ...
. Here we have
α : Type*
, β : α → Type*
, γ : Π a : α, β a → Type*
, ...,
A : Π (a : α) (b : β a) (c : γ a b) ..., Type*
with x : α
y : β x
, z : γ x y
, ...
Notes #
The definition of Sigma
takes values in Type*
. This effectively forbids Prop
- valued sigma
types. To that effect, we have PSigma
, which takes value in Sort*
and carries a more
complicated universe signature as a consequence.
Equations
- One or more equations did not get rendered due to their size.
Interpret a function on Σ x : α, β x
as a dependent function with two arguments.
This also exists as an Equiv
as Equiv.piCurry γ
.
Equations
- Sigma.curry f x y = f { fst := x, snd := y }
Instances For
Interpret a dependent function with two arguments as a function on Σ x : α, β x
.
This also exists as an Equiv
as (Equiv.piCurry γ).symm
.
Equations
- Sigma.uncurry f x = f x.fst x.snd
Instances For
Convert a product type to a Σ-type.
Equations
- Prod.toSigma p = { fst := p.fst, snd := p.snd }
Instances For
Nondependent eliminator for PSigma
.
Equations
- PSigma.elim f a = PSigma.casesOn a f
Instances For
Equations
- One or more equations did not get rendered due to their size.
Map the left and right components of a sigma
Equations
- PSigma.map f₁ f₂ x = match x with | { fst := a, snd := b } => { fst := f₁ a, snd := f₂ a b }