summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorSon Ho2024-04-25 16:27:43 +0200
committerSon Ho2024-04-25 16:27:43 +0200
commiteb5b2e76de6e2c6780b9817c1424777276ea5e00 (patch)
tree3c4865d0c9759af3bbb286243cf50d9c30fbcd61 /backends
parent078b7f59ddfcb12a7b4c69f0a51bfd57cb391ddf (diff)
Update the backend and ExtractBuiltin.ml
Diffstat (limited to 'backends')
-rw-r--r--backends/coq/Primitives.v7
-rw-r--r--backends/fstar/Primitives.fst6
-rw-r--r--backends/lean/Base/Primitives/Core.lean2
3 files changed, 14 insertions, 1 deletions
diff --git a/backends/coq/Primitives.v b/backends/coq/Primitives.v
index 5ffda12f..b29fce43 100644
--- a/backends/coq/Primitives.v
+++ b/backends/coq/Primitives.v
@@ -564,6 +564,13 @@ Definition core_clone_CloneI128 : core_clone_Clone i128 := {|
clone := fun x => Ok (core_clone_impls_CloneI128_clone x)
|}.
+(** [core::option::{core::option::Option<T>}::unwrap] *)
+Definition core_option_Option_unwrap (T : Type) (x : option T) : result T :=
+ match x with
+ | None => Fail_ Failure
+ | Some x => Ok x
+ end.
+
(*** core::ops *)
(* Trait declaration: [core::ops::index::Index] *)
diff --git a/backends/fstar/Primitives.fst b/backends/fstar/Primitives.fst
index c7c9f9db..9951ccc3 100644
--- a/backends/fstar/Primitives.fst
+++ b/backends/fstar/Primitives.fst
@@ -540,6 +540,12 @@ let core_clone_CloneI128 : core_clone_Clone i128 = {
clone = fun x -> Ok (core_clone_impls_CloneI128_clone x)
}
+(** [core::option::{core::option::Option<T>}::unwrap] *)
+let core_option_Option_unwrap (t : Type0) (x : option t) : result t =
+ match x with
+ | None -> Fail Failure
+ | Some x -> Ok x
+
(*** core::ops *)
// Trait declaration: [core::ops::index::Index]
diff --git a/backends/lean/Base/Primitives/Core.lean b/backends/lean/Base/Primitives/Core.lean
index b7dd6d2c..14a51bc1 100644
--- a/backends/lean/Base/Primitives/Core.lean
+++ b/backends/lean/Base/Primitives/Core.lean
@@ -51,7 +51,7 @@ def clone.CloneBool : clone.Clone Bool := {
clone := fun b => ok (clone.impls.CloneBool.clone b)
}
-namespace option
+namespace option -- core.option
/- [core::option::{core::option::Option<T>}::unwrap] -/
def Option.unwrap (T : Type) (x : Option T) : Result T :=