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
If α is encodable, then so is Vector α n.
Equations
- Encodable.List.Vector.encodable = { encode := Encodable.List.Vector.encodable._aux_1, decode := Encodable.List.Vector.encodable._aux_3, encodek := ⋯ }
If α is countable, then so is Vector α n.
When α is finite and β is encodable, α → β is encodable too. Because the encoding is not
unique, we wrap it in Trunc to preserve computability.
Equations
- Encodable.fintypeArrow α β = Trunc.map (fun (f : α ≃ Fin (Fintype.card α)) => Encodable.ofEquiv (Fin (Fintype.card α) → β) (f.arrowCongr (Equiv.refl β))) (Fintype.truncEquivFin α)
Instances For
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.
Equations
- One or more equations did not get rendered due to their size.