summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorRyan Lahfa2024-04-16 23:30:47 +0200
committerRyan Lahfa2024-04-17 00:31:44 +0200
commitc264b08cfb9beb5fe34d872b02a8f4cd1e12d45e (patch)
tree1b0188215788a8ec27120a8e854283ed49c1b9b7 /backends
parent23da71768c03d955c916635bfc5c9d5806a80187 (diff)
compiler: map `core::option::Option::take` to identity function
`take` in a pure functional model is the identity function and everything related to borrow checking is handled by the forward/backward mechanism. Signed-off-by: Ryan Lahfa <ryan.lahfa@inria.fr>
Diffstat (limited to 'backends')
-rw-r--r--backends/lean/Base/Primitives/Base.lean2
1 files changed, 2 insertions, 0 deletions
diff --git a/backends/lean/Base/Primitives/Base.lean b/backends/lean/Base/Primitives/Base.lean
index 4c5b2795..62546ac3 100644
--- a/backends/lean/Base/Primitives/Base.lean
+++ b/backends/lean/Base/Primitives/Base.lean
@@ -130,6 +130,8 @@ 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)
/-- Aeneas-translated function -- useful to reduce non-recursive definitions.
Use with `simp [ aeneas ]` -/