summaryrefslogtreecommitdiff
path: root/Common/Countable.lean
diff options
context:
space:
mode:
Diffstat (limited to 'Common/Countable.lean')
-rw-r--r--Common/Countable.lean9
1 files changed, 9 insertions, 0 deletions
diff --git a/Common/Countable.lean b/Common/Countable.lean
new file mode 100644
index 0000000..e19db99
--- /dev/null
+++ b/Common/Countable.lean
@@ -0,0 +1,9 @@
+import Common.Finite
+
+class Countable (α : Type u) where
+ enumerate : α → Nat
+ injective {a b : α} : enumerate a = enumerate b → a = b
+
+instance {α : Type u} [Finite α] : Countable α where
+ enumerate := Fin.val ∘ Finite.enumerate
+ injective := Finite.injective ∘ Fin.val_inj.mp