summaryrefslogtreecommitdiff
path: root/backends/lean/Base/IList
diff options
context:
space:
mode:
authorSon HO2024-06-17 23:29:51 +0200
committerGitHub2024-06-17 23:29:51 +0200
commit76ab141814644a94bffc8497e5845436d86b1083 (patch)
tree664f9b51b9dac1abbf34bca8add6c88fbe7bcec9 /backends/lean/Base/IList
parent95e3219b7814dd454dd82dd0b7f607af9ac02826 (diff)
parent359410257a4b803dd972a248b46ede377b1bed15 (diff)
Merge pull request #240 from RaitoBezarius/has-int-pred
backends/lean: introduce `HasIntPred` automation
Diffstat (limited to 'backends/lean/Base/IList')
-rw-r--r--backends/lean/Base/IList/IList.lean8
1 files changed, 5 insertions, 3 deletions
diff --git a/backends/lean/Base/IList/IList.lean b/backends/lean/Base/IList/IList.lean
index a1897191..96843f55 100644
--- a/backends/lean/Base/IList/IList.lean
+++ b/backends/lean/Base/IList/IList.lean
@@ -18,9 +18,11 @@ theorem len_pos : 0 ≤ (ls : List α).len := by
induction ls <;> simp [*]
omega
-instance (a : Type u) : Arith.HasIntProp (List a) where
- prop_ty := λ ls => 0 ≤ ls.len
- prop := λ ls => ls.len_pos
+instance (l: List a) : Arith.HasIntPred (l.len) where
+ concl := 0 ≤ l.len
+ prop := l.len_pos
+
+example (l: List a): 0 ≤ l.len := by scalar_tac
-- Remark: if i < 0, then the result is none
def indexOpt (ls : List α) (i : Int) : Option α :=