summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorRyan Lahfa2024-05-13 18:10:39 +0200
committerRyan Lahfa2024-05-13 18:10:39 +0200
commit001f3553287a51c1704ea3033a44e548440ec108 (patch)
treec24c553eafb29e2c4ab763aca16b450770654341 /backends
parent5c758f8b9b70288f3ef428c53122c75677255520 (diff)
backends/lean: repair definition of `core.mem.replace`
Oops, it is supposed to do something with the second argument! Signed-off-by: Ryan Lahfa <ryan.lahfa@inria.fr>
Diffstat (limited to 'backends')
-rw-r--r--backends/lean/Base/Primitives/Base.lean5
1 files changed, 4 insertions, 1 deletions
diff --git a/backends/lean/Base/Primitives/Base.lean b/backends/lean/Base/Primitives/Base.lean
index d682e926..c9237e65 100644
--- a/backends/lean/Base/Primitives/Base.lean
+++ b/backends/lean/Base/Primitives/Base.lean
@@ -134,7 +134,10 @@ def Result.attach {α: Type} (o : Result α): Result { x : α // o = ok x } :=
-- MISC --
----------
-@[simp] def core.mem.replace (a : Type) (x : a) (_ : a) : a × a := (x, x)
+-- This acts like a swap effectively in a functional pure world.
+-- We return the old value of `dst`, i.e. `dst` itself.
+-- The new value of `dst` is `src`.
+@[simp] def core.mem.replace (a : Type) (dst : a) (src : a) : a × a := (dst, src)
/- [core::option::Option::take] -/
@[simp] def Option.take (T: Type) (self: Option T): Option T × Option T := (self, .none)
/- [core::mem::swap] -/