Commit d167cced authored by Robbert Krebbers's avatar Robbert Krebbers

Version of inj_countable with a total function.

parent 0d7a7f06
......@@ -93,6 +93,14 @@ Section inj_countable.
Next Obligation. intros y; simpl; rewrite decode_encode; eauto. Qed.
End inj_countable.
Section inj_countable'.
Context `{Countable A, EqDecision B}.
Context (f : B A) (g : A B) (fg : x, g (f x) = x).
Program Instance inj_countable' : Countable B := inj_countable f (Some g) _.
Next Obligation. intros x. by f_equal/=. Qed.
End inj_countable'.
(** ** Unit *)
Program Instance unit_countable : Countable unit :=
{| encode u := 1; decode p := Some () |}.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment