summaryrefslogtreecommitdiff
path: root/backends/lean/Base
diff options
context:
space:
mode:
authorSon HO2024-04-25 14:08:36 +0200
committerGitHub2024-04-25 14:08:36 +0200
commita3e38d5f47e4780768902e49e28e471e38efd40a (patch)
tree9bbce3d68895d32d2ad1118f895e7f820ef0987d /backends/lean/Base
parent1be37966ceea2510b911b119a96246b4657a62fd (diff)
parente739bde5ee916af9c0c2dcf186173edba1585e4f (diff)
Merge pull request #135 from RaitoBezarius/option-take
compiler: add `core::option::Option::{take, is_none}` and `core::mem::swap` support
Diffstat (limited to 'backends/lean/Base')
-rw-r--r--backends/lean/Base/Primitives/Base.lean4
1 files changed, 4 insertions, 0 deletions
diff --git a/backends/lean/Base/Primitives/Base.lean b/backends/lean/Base/Primitives/Base.lean
index 4c5b2795..94134d86 100644
--- a/backends/lean/Base/Primitives/Base.lean
+++ b/backends/lean/Base/Primitives/Base.lean
@@ -130,6 +130,10 @@ def Result.attach {α: Type} (o : Result α): Result { x : α // o = ok x } :=
----------
@[simp] def core.mem.replace (a : Type) (x : a) (_ : a) : a × a := (x, x)
+/- [core::option::Option::take] -/
+@[simp] def Option.take (T: Type) (self: Option T): Option T × Option T := (self, .none)
+/- [core::mem::swap] -/
+@[simp] def core.mem.swap (T: Type) (a b: T): T × T := (b, a)
/-- Aeneas-translated function -- useful to reduce non-recursive definitions.
Use with `simp [ aeneas ]` -/