summaryrefslogtreecommitdiff
path: root/Common/Countable.lean
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2024-12-21 21:37:51 +0100
committerAndreas Grois <andi@grois.info>2024-12-21 21:37:51 +0100
commitb37fc3089eb0ca8fc37a82ae6d6071b0accbca19 (patch)
treee500a5adc1a3f87a5e7f0608773dc12377e7af40 /Common/Countable.lean
parenta6e4b8f15c28c374553684f63fa3f4108095da2d (diff)
Continue Day17
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