Encodability of Pi types #
This file provides instances of Encodable
for types of vectors and (dependent) functions:
Encodable.List.Vector.encodable
: vectors of lengthn
(represented by lists) are encodableEncodable.finArrow
: vectors of lengthn
(represented byFin
-indexed functions) are encodableEncodable.fintypeArrow
,Encodable.fintypePi
: (dependent) functions with finite domain and countable codomain are encodable
instance
Encodable.List.Vector.encodable
{α : Type u_1}
[Encodable α]
{n : ℕ}
:
Encodable (List.Vector α n)
If α
is encodable, then so is Vector α n
.
Equations
instance
Encodable.List.Vector.countable
{α : Type u_1}
[Countable α]
{n : ℕ}
:
Countable (List.Vector α n)
If α
is countable, then so is Vector α n
.
def
Encodable.fintypeArrow
(α : Type u_2)
(β : Type u_3)
[DecidableEq α]
[Fintype α]
[Encodable β]
:
When α
is finite and β
is encodable, α → β
is encodable too. Because the encoding is not
unique, we wrap it in Trunc
to preserve computability.
Equations
Instances For
def
Encodable.fintypePi
(α : Type u_2)
(π : α → Type u_3)
[DecidableEq α]
[Fintype α]
[(a : α) → Encodable (π a)]
:
When α
is finite and all π a
are encodable, Π a, π a
is encodable too. Because the
encoding is not unique, we wrap it in Trunc
to preserve computability.