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. This can be seen as a generalization of the sum type α ⊕ β
:
α ⊕ β
is made of stuff which is either of typeα
orβ
.- Given
α : ι → Type*
,sigma α
is made of stuff which is of typeα i
for somei : ι
. One effectively recovers a type isomorphic toα ⊕ β
by taking aι
with exactly two elements. Seeequiv.sum_equiv_sigma_bool
.
Σ x, A x
is notation for sigma A
(note the difference with the big 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 in consequence.
Equations
- sigma.decidable_eq ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ = sigma.decidable_eq._match_1 a₁ b₁ a₂ b₂ (h₁ a₁ a₂)
- sigma.decidable_eq._match_1 a b₁ a b₂ (is_true _) = sigma.decidable_eq._match_2 a b₁ b₂ (h₂ a b₁ b₂)
- sigma.decidable_eq._match_1 a₁ _x a₂ _x_1 (is_false n) = is_false _
- sigma.decidable_eq._match_2 a b b (is_true _) = is_true _
- sigma.decidable_eq._match_2 a b₁ b₂ (is_false n) = is_false _
Interpret a function on Σ x : α, β x
as a dependent function with two arguments.
This also exists as an equiv
as equiv.Pi_curry γ
.
Equations
- sigma.curry f x y = f ⟨x, y⟩
Interpret a dependent function with two arguments as a function on Σ x : α, β x
.
This also exists as an equiv
as (equiv.Pi_curry γ).symm
.
Equations
- sigma.uncurry f x = f x.fst x.snd
Nondependent eliminator for psigma
.
Equations
- psigma.elim f a = a.cases_on f
Equations
- psigma.decidable_eq ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ = psigma.decidable_eq._match_1 a₁ b₁ a₂ b₂ (h₁ a₁ a₂)
- psigma.decidable_eq._match_1 a b₁ a b₂ (is_true _) = psigma.decidable_eq._match_2 a b₁ b₂ (h₂ a b₁ b₂)
- psigma.decidable_eq._match_1 a₁ _x a₂ _x_1 (is_false n) = is_false _
- psigma.decidable_eq._match_2 a b b (is_true _) = is_true _
- psigma.decidable_eq._match_2 a b₁ b₂ (is_false n) = is_false _
Map the left and right components of a sigma
Equations
- psigma.map f₁ f₂ ⟨a, b⟩ = ⟨f₁ a, f₂ a b⟩