From b37fc3089eb0ca8fc37a82ae6d6071b0accbca19 Mon Sep 17 00:00:00 2001
From: Andreas Grois <andi@grois.info>
Date: Sat, 21 Dec 2024 21:37:51 +0100
Subject: Continue Day17

---
 Common/Countable.lean | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 Common/Countable.lean

(limited to 'Common/Countable.lean')

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
-- 
cgit v1.2.3

