Sigma types #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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.inhabited = {default := ⟨inhabited.default _inst_1, inhabited.default _inst_2⟩}
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₂ (decidable.is_true _) = sigma.decidable_eq._match_2 a b₁ b₂ (h₂ a b₁ b₂)
- sigma.decidable_eq._match_1 a₁ _x a₂ _x_1 (decidable.is_false n) = decidable.is_false _
- sigma.decidable_eq._match_2 a b b (decidable.is_true _) = decidable.is_true _
- sigma.decidable_eq._match_2 a b₁ b₂ (decidable.is_false n) = decidable.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
Equations
- psigma.inhabited = {default := ⟨inhabited.default _inst_1, inhabited.default _inst_2⟩}
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₂ (decidable.is_true _) = psigma.decidable_eq._match_2 a b₁ b₂ (h₂ a b₁ b₂)
- psigma.decidable_eq._match_1 a₁ _x a₂ _x_1 (decidable.is_false n) = decidable.is_false _
- psigma.decidable_eq._match_2 a b b (decidable.is_true _) = decidable.is_true _
- psigma.decidable_eq._match_2 a b₁ b₂ (decidable.is_false n) = decidable.is_false _