summaryrefslogtreecommitdiff
path: root/Common/List.lean
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2024-09-18 19:42:46 +0200
committerAndreas Grois <andi@grois.info>2024-09-18 19:42:46 +0200
commit2c1f2362c69ab20b10b61bdbebf8e5121eca38b1 (patch)
treeb31f7e8fff82630d33319b231cf2868d5922cb30 /Common/List.lean
parent6554499717d70d5656a3b38a20dc60850674a873 (diff)
Continue Day11/Parsing
Diffstat (limited to 'Common/List.lean')
-rw-r--r--Common/List.lean5
1 files changed, 5 insertions, 0 deletions
diff --git a/Common/List.lean b/Common/List.lean
index 0e8285e..b34f1e2 100644
--- a/Common/List.lean
+++ b/Common/List.lean
@@ -49,3 +49,8 @@ def compare {α : Type} [Ord α] (a b : List α) := match a, b with
instance {α : Type} [Ord α] : Ord (List α) where
compare := compare
+
+def not_empty_iff_size_gt_zero {list : List α} : list.isEmpty = false ↔ list.length > 0 :=
+ match list with
+ | [] => ⟨nofun, nofun⟩
+ | l :: ls => ⟨λ_ ↦ (List.length_cons l ls).substr (Nat.succ_pos ls.length), λ_ => rfl⟩