feat(library/data/countable): show that a type is countable by providing an injection to a type already known to be countable
This commit is contained in:
parent
f16eaf8f0f
commit
036900280d
1 changed files with 18 additions and 0 deletions
|
@ -187,3 +187,21 @@ countable.mk
|
||||||
unpickle_list
|
unpickle_list
|
||||||
unpickle_pickle_list
|
unpickle_pickle_list
|
||||||
end list
|
end list
|
||||||
|
|
||||||
|
definition countable_of_left_injection
|
||||||
|
{A B : Type} [h₁ : countable A]
|
||||||
|
(f : B → A) (finv : A → option B) (linv : ∀ b, finv (f b) = some b) : countable B :=
|
||||||
|
countable.mk
|
||||||
|
(λ b, pickle (f b))
|
||||||
|
(λ n,
|
||||||
|
match unpickle A n with
|
||||||
|
| some a := finv a
|
||||||
|
| none := none
|
||||||
|
end)
|
||||||
|
(λ b,
|
||||||
|
begin
|
||||||
|
esimp,
|
||||||
|
rewrite [countable.picklek],
|
||||||
|
esimp [option.cases_on],
|
||||||
|
rewrite [linv]
|
||||||
|
end)
|
||||||
|
|
Loading…
Reference in a new issue