summaryrefslogtreecommitdiff
path: root/backends/lean/Base/Primitives/Alloc.lean
diff options
context:
space:
mode:
authorSon Ho2023-12-05 17:34:13 +0100
committerSon Ho2023-12-05 17:34:13 +0100
commit726db4911add81a853aafcec3936b457aaeff5b4 (patch)
tree2663915767c3558203990ed14f8d5604b7fd21d1 /backends/lean/Base/Primitives/Alloc.lean
parent92887b89e35607e99bae2f19e4c5b2f162683d02 (diff)
parent4795e5f823bc89504855d8eb946b111d9314f4d5 (diff)
Merge branch 'main' into son_fixes2
Diffstat (limited to 'backends/lean/Base/Primitives/Alloc.lean')
-rw-r--r--backends/lean/Base/Primitives/Alloc.lean37
1 files changed, 37 insertions, 0 deletions
diff --git a/backends/lean/Base/Primitives/Alloc.lean b/backends/lean/Base/Primitives/Alloc.lean
new file mode 100644
index 00000000..6c89c6bb
--- /dev/null
+++ b/backends/lean/Base/Primitives/Alloc.lean
@@ -0,0 +1,37 @@
+import Lean
+import Base.Primitives.Base
+import Base.Primitives.CoreOps
+
+open Primitives
+open Result
+
+namespace alloc
+
+namespace boxed -- alloc.boxed
+
+namespace Box -- alloc.boxed.Box
+
+def deref (T : Type) (x : T) : Result T := ret x
+def deref_mut (T : Type) (x : T) : Result T := ret x
+def deref_mut_back (T : Type) (_ : T) (x : T) : Result T := ret x
+
+/-- Trait instance -/
+def coreopsDerefInst (Self : Type) :
+ core.ops.deref.Deref Self := {
+ Target := Self
+ deref := deref Self
+}
+
+/-- Trait instance -/
+def coreopsDerefMutInst (Self : Type) :
+ core.ops.deref.DerefMut Self := {
+ derefInst := coreopsDerefInst Self
+ deref_mut := deref_mut Self
+ deref_mut_back := deref_mut_back Self
+}
+
+end Box -- alloc.boxed.Box
+
+end boxed -- alloc.boxed
+
+end alloc