diff options
Diffstat (limited to '')
-rw-r--r-- | backends/lean/Base/Primitives/Base.lean | 2 | ||||
-rw-r--r-- | compiler/ExtractBuiltin.ml | 4 |
2 files changed, 6 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 ]` -/ diff --git a/compiler/ExtractBuiltin.ml b/compiler/ExtractBuiltin.ml index a9b939b5..3e96c320 100644 --- a/compiler/ExtractBuiltin.ml +++ b/compiler/ExtractBuiltin.ml @@ -290,6 +290,9 @@ let builtin_funs () : (pattern * bool list option * builtin_fun_info) list = mk_fun "core::slice::{[@T]}::len" (Some (backend_choice "slice::len" "Slice::len")) None; + mk_fun "core::option::{core::option::Option<@T>}::take" + (Some (backend_choice "option::take" "Option::take")) + None; mk_fun "alloc::vec::{alloc::vec::Vec<@T, alloc::alloc::Global>}::new" (Some "alloc::vec::Vec::new") None; mk_fun "alloc::vec::{alloc::vec::Vec<@T, @A>}::push" None @@ -515,6 +518,7 @@ let builtin_fun_effects = "alloc::vec::{alloc::vec::Vec<@T, @A>}::len"; "core::mem::replace"; "core::mem::take"; + "core::option::{core::option::Option<@T>}::take"; "core::clone::impls::{core::clone::Clone<bool>}::clone"; "alloc::vec::{alloc::vec::Vec<@T, alloc::alloc::Global>}::with_capacity"; "core::slice::{[@T]}::reverse"; |