From 1dbdd9e316e690e5c63de2e1923afad520c76e4d Mon Sep 17 00:00:00 2001 From: Son Ho Date: Tue, 21 Nov 2023 10:27:08 +0100 Subject: Update more names --- backends/coq/Primitives.v | 32 +++++++++++++-------------- backends/fstar/Primitives.fst | 32 +++++++++++++-------------- backends/lean/Base/Primitives/ArraySlice.lean | 32 +++++++++++++-------------- compiler/ExtractBuiltin.ml | 13 ++++++----- 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/backends/coq/Primitives.v b/backends/coq/Primitives.v index 846a5e4b..83f860b6 100644 --- a/backends/coq/Primitives.v +++ b/backends/coq/Primitives.v @@ -620,18 +620,18 @@ Definition core_slice_index_Slice_index end. (* [core::slice::index::Range:::get]: forward function *) -Axiom core_slice_index_Range_get : forall (T : Type) (i : core_ops_range_Range usize) (s : slice T), result (option (slice T)). +Axiom core_slice_index_RangeUsize_get : forall (T : Type) (i : core_ops_range_Range usize) (s : slice T), result (option (slice T)). (* [core::slice::index::Range::get_mut]: forward function *) -Axiom core_slice_index_Range_get_mut : +Axiom core_slice_index_RangeUsize_get_mut : forall (T : Type), core_ops_range_Range usize -> slice T -> result (option (slice T)). (* [core::slice::index::Range::get_mut]: backward function 0 *) -Axiom core_slice_index_Range_get_mut_back : +Axiom core_slice_index_RangeUsize_get_mut_back : forall (T : Type), core_ops_range_Range usize -> slice T -> option (slice T) -> result (slice T). (* [core::slice::index::Range::get_unchecked]: forward function *) -Definition core_slice_index_Range_get_unchecked +Definition core_slice_index_RangeUsize_get_unchecked (T : Type) : core_ops_range_Range usize -> const_raw_ptr (slice T) -> result (const_raw_ptr (slice T)) := (* Don't know what the model should be - for now we always fail to make @@ -639,7 +639,7 @@ Definition core_slice_index_Range_get_unchecked fun _ _ => Fail_ Failure. (* [core::slice::index::Range::get_unchecked_mut]: forward function *) -Definition core_slice_index_Range_get_unchecked_mut +Definition core_slice_index_RangeUsize_get_unchecked_mut (T : Type) : core_ops_range_Range usize -> mut_raw_ptr (slice T) -> result (mut_raw_ptr (slice T)) := (* Don't know what the model should be - for now we always fail to make @@ -647,15 +647,15 @@ Definition core_slice_index_Range_get_unchecked_mut fun _ _ => Fail_ Failure. (* [core::slice::index::Range::index]: forward function *) -Axiom core_slice_index_Range_index : +Axiom core_slice_index_RangeUsize_index : forall (T : Type), core_ops_range_Range usize -> slice T -> result (slice T). (* [core::slice::index::Range::index_mut]: forward function *) -Axiom core_slice_index_Range_index_mut : +Axiom core_slice_index_RangeUsize_index_mut : forall (T : Type), core_ops_range_Range usize -> slice T -> result (slice T). (* [core::slice::index::Range::index_mut]: backward function 0 *) -Axiom core_slice_index_Range_index_mut_back : +Axiom core_slice_index_RangeUsize_index_mut_back : forall (T : Type), core_ops_range_Range usize -> slice T -> slice T -> result (slice T). (* [core::slice::index::[T]::index_mut]: forward function *) @@ -692,14 +692,14 @@ Definition core_slice_index_SliceIndexRangeUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex (core_ops_range_Range usize) (slice T) := {| core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedRangeUsizeInst; core_slice_index_SliceIndex_Output := slice T; - core_slice_index_SliceIndex_get := core_slice_index_Range_get T; - core_slice_index_SliceIndex_get_mut := core_slice_index_Range_get_mut T; - core_slice_index_SliceIndex_get_mut_back := core_slice_index_Range_get_mut_back T; - core_slice_index_SliceIndex_get_unchecked := core_slice_index_Range_get_unchecked T; - core_slice_index_SliceIndex_get_unchecked_mut := core_slice_index_Range_get_unchecked_mut T; - core_slice_index_SliceIndex_index := core_slice_index_Range_index T; - core_slice_index_SliceIndex_index_mut := core_slice_index_Range_index_mut T; - core_slice_index_SliceIndex_index_mut_back := core_slice_index_Range_index_mut_back T; + core_slice_index_SliceIndex_get := core_slice_index_RangeUsize_get T; + core_slice_index_SliceIndex_get_mut := core_slice_index_RangeUsize_get_mut T; + core_slice_index_SliceIndex_get_mut_back := core_slice_index_RangeUsize_get_mut_back T; + core_slice_index_SliceIndex_get_unchecked := core_slice_index_RangeUsize_get_unchecked T; + core_slice_index_SliceIndex_get_unchecked_mut := core_slice_index_RangeUsize_get_unchecked_mut T; + core_slice_index_SliceIndex_index := core_slice_index_RangeUsize_index T; + core_slice_index_SliceIndex_index_mut := core_slice_index_RangeUsize_index_mut T; + core_slice_index_SliceIndex_index_mut_back := core_slice_index_RangeUsize_index_mut_back T; |}. (* Trait implementation: [core::slice::index::[T]] *) diff --git a/backends/fstar/Primitives.fst b/backends/fstar/Primitives.fst index 19c4e7a3..94322ead 100644 --- a/backends/fstar/Primitives.fst +++ b/backends/fstar/Primitives.fst @@ -483,23 +483,23 @@ let core_slice_index_Slice_index | Some x -> Return x // [core::slice::index::Range:::get]: forward function -let core_slice_index_Range_get (t : Type0) (i : core_ops_range_Range usize) (s : slice t) : +let core_slice_index_RangeUsize_get (t : Type0) (i : core_ops_range_Range usize) (s : slice t) : result (option (slice t)) = admit () // TODO // [core::slice::index::Range::get_mut]: forward function -let core_slice_index_Range_get_mut +let core_slice_index_RangeUsize_get_mut (t : Type0) : core_ops_range_Range usize → slice t → result (option (slice t)) = admit () // TODO // [core::slice::index::Range::get_mut]: backward function 0 -let core_slice_index_Range_get_mut_back +let core_slice_index_RangeUsize_get_mut_back (t : Type0) : core_ops_range_Range usize → slice t → option (slice t) → result (slice t) = admit () // TODO // [core::slice::index::Range::get_unchecked]: forward function -let core_slice_index_Range_get_unchecked +let core_slice_index_RangeUsize_get_unchecked (t : Type0) : core_ops_range_Range usize → const_raw_ptr (slice t) → result (const_raw_ptr (slice t)) = // Don't know what the model should be - for now we always fail to make @@ -507,7 +507,7 @@ let core_slice_index_Range_get_unchecked fun _ _ -> Fail Failure // [core::slice::index::Range::get_unchecked_mut]: forward function -let core_slice_index_Range_get_unchecked_mut +let core_slice_index_RangeUsize_get_unchecked_mut (t : Type0) : core_ops_range_Range usize → mut_raw_ptr (slice t) → result (mut_raw_ptr (slice t)) = // Don't know what the model should be - for now we always fail to make @@ -515,17 +515,17 @@ let core_slice_index_Range_get_unchecked_mut fun _ _ -> Fail Failure // [core::slice::index::Range::index]: forward function -let core_slice_index_Range_index +let core_slice_index_RangeUsize_index (t : Type0) : core_ops_range_Range usize → slice t → result (slice t) = admit () // TODO // [core::slice::index::Range::index_mut]: forward function -let core_slice_index_Range_index_mut +let core_slice_index_RangeUsize_index_mut (t : Type0) : core_ops_range_Range usize → slice t → result (slice t) = admit () // TODO // [core::slice::index::Range::index_mut]: backward function 0 -let core_slice_index_Range_index_mut_back +let core_slice_index_RangeUsize_index_mut_back (t : Type0) : core_ops_range_Range usize → slice t → slice t → result (slice t) = admit () // TODO @@ -568,14 +568,14 @@ let core_slice_index_SliceIndexRangeUsizeSliceTInst (t : Type0) : core_slice_index_SliceIndex (core_ops_range_Range usize) (slice t) = { sealedInst = core_slice_index_private_slice_index_SealedRangeUsizeInst; output = slice t; - get = core_slice_index_Range_get t; - get_mut = core_slice_index_Range_get_mut t; - get_mut_back = core_slice_index_Range_get_mut_back t; - get_unchecked = core_slice_index_Range_get_unchecked t; - get_unchecked_mut = core_slice_index_Range_get_unchecked_mut t; - index = core_slice_index_Range_index t; - index_mut = core_slice_index_Range_index_mut t; - index_mut_back = core_slice_index_Range_index_mut_back t; + get = core_slice_index_RangeUsize_get t; + get_mut = core_slice_index_RangeUsize_get_mut t; + get_mut_back = core_slice_index_RangeUsize_get_mut_back t; + get_unchecked = core_slice_index_RangeUsize_get_unchecked t; + get_unchecked_mut = core_slice_index_RangeUsize_get_unchecked_mut t; + index = core_slice_index_RangeUsize_index t; + index_mut = core_slice_index_RangeUsize_index_mut t; + index_mut_back = core_slice_index_RangeUsize_index_mut_back t; } // Trait implementation: [core::slice::index::[T]] diff --git a/backends/lean/Base/Primitives/ArraySlice.lean b/backends/lean/Base/Primitives/ArraySlice.lean index 8bb9a855..f68c0846 100644 --- a/backends/lean/Base/Primitives/ArraySlice.lean +++ b/backends/lean/Base/Primitives/ArraySlice.lean @@ -363,23 +363,23 @@ def core.slice.index.Slice.index | some x => ret x /- [core::slice::index::Range:::get]: forward function -/ -def core.slice.index.Range.get (T : Type) (i : Range Usize) (slice : Slice T) : +def core.slice.index.RangeUsize.get (T : Type) (i : Range Usize) (slice : Slice T) : Result (Option (Slice T)) := sorry -- TODO /- [core::slice::index::Range::get_mut]: forward function -/ -def core.slice.index.Range.get_mut +def core.slice.index.RangeUsize.get_mut (T : Type) : Range Usize → Slice T → Result (Option (Slice T)) := sorry -- TODO /- [core::slice::index::Range::get_mut]: backward function 0 -/ -def core.slice.index.Range.get_mut_back +def core.slice.index.RangeUsize.get_mut_back (T : Type) : Range Usize → Slice T → Option (Slice T) → Result (Slice T) := sorry -- TODO /- [core::slice::index::Range::get_unchecked]: forward function -/ -def core.slice.index.Range.get_unchecked +def core.slice.index.RangeUsize.get_unchecked (T : Type) : Range Usize → ConstRawPtr (Slice T) → Result (ConstRawPtr (Slice T)) := -- Don't know what the model should be - for now we always fail to make @@ -387,7 +387,7 @@ def core.slice.index.Range.get_unchecked fun _ _ => fail panic /- [core::slice::index::Range::get_unchecked_mut]: forward function -/ -def core.slice.index.Range.get_unchecked_mut +def core.slice.index.RangeUsize.get_unchecked_mut (T : Type) : Range Usize → MutRawPtr (Slice T) → Result (MutRawPtr (Slice T)) := -- Don't know what the model should be - for now we always fail to make @@ -395,17 +395,17 @@ def core.slice.index.Range.get_unchecked_mut fun _ _ => fail panic /- [core::slice::index::Range::index]: forward function -/ -def core.slice.index.Range.index +def core.slice.index.RangeUsize.index (T : Type) : Range Usize → Slice T → Result (Slice T) := sorry -- TODO /- [core::slice::index::Range::index_mut]: forward function -/ -def core.slice.index.Range.index_mut +def core.slice.index.RangeUsize.index_mut (T : Type) : Range Usize → Slice T → Result (Slice T) := sorry -- TODO /- [core::slice::index::Range::index_mut]: backward function 0 -/ -def core.slice.index.Range.index_mut_back +def core.slice.index.RangeUsize.index_mut_back (T : Type) : Range Usize → Slice T → Slice T → Result (Slice T) := sorry -- TODO @@ -448,14 +448,14 @@ def core.slice.index.SliceIndexRangeUsizeSliceTInst (T : Type) : core.slice.index.SliceIndex (Range Usize) (Slice T) := { sealedInst := core.slice.index.private_slice_index.SealedRangeUsizeInst Output := Slice T - get := core.slice.index.Range.get T - get_mut := core.slice.index.Range.get_mut T - get_mut_back := core.slice.index.Range.get_mut_back T - get_unchecked := core.slice.index.Range.get_unchecked T - get_unchecked_mut := core.slice.index.Range.get_unchecked_mut T - index := core.slice.index.Range.index T - index_mut := core.slice.index.Range.index_mut T - index_mut_back := core.slice.index.Range.index_mut_back T + get := core.slice.index.RangeUsize.get T + get_mut := core.slice.index.RangeUsize.get_mut T + get_mut_back := core.slice.index.RangeUsize.get_mut_back T + get_unchecked := core.slice.index.RangeUsize.get_unchecked T + get_unchecked_mut := core.slice.index.RangeUsize.get_unchecked_mut T + index := core.slice.index.RangeUsize.index T + index_mut := core.slice.index.RangeUsize.index_mut T + index_mut_back := core.slice.index.RangeUsize.index_mut_back T } /- Trait implementation: [core::slice::index::[T]] -/ diff --git a/compiler/ExtractBuiltin.ml b/compiler/ExtractBuiltin.ml index f4f34155..b0a5159f 100644 --- a/compiler/ExtractBuiltin.ml +++ b/compiler/ExtractBuiltin.ml @@ -278,18 +278,19 @@ let builtin_funs () : (pattern * bool list option * builtin_fun_info list) list mk_fun "core::array::{[@T; @C]}::index" None None true false; mk_fun "core::array::{[@T; @C]}::index_mut" None None true false; mk_fun "core::slice::index::{core::ops::range::Range}::get" - (Some "core::slice::index::Range::get") None true false; + (Some "core::slice::index::RangeUsize::get") None true false; mk_fun "core::slice::index::{core::ops::range::Range}::get_mut" - (Some "core::slice::index::Range::get_mut") None true false; + (Some "core::slice::index::RangeUsize::get_mut") None true false; mk_fun "core::slice::index::{core::ops::range::Range}::index" - (Some "core::slice::index::Range::index") None true false; + (Some "core::slice::index::RangeUsize::index") None true false; mk_fun "core::slice::index::{core::ops::range::Range}::index_mut" - (Some "core::slice::index::Range::index_mut") None true false; + (Some "core::slice::index::RangeUsize::index_mut") None true false; mk_fun "core::slice::index::{core::ops::range::Range}::get_unchecked" - (Some "core::slice::index::Range::get_unchecked") None false false; + (Some "core::slice::index::RangeUsize::get_unchecked") None false false; mk_fun "core::slice::index::{core::ops::range::Range}::get_unchecked_mut" - (Some "core::slice::index::Range::get_unchecked_mut") None false false; + (Some "core::slice::index::RangeUsize::get_unchecked_mut") None false + false; mk_fun "core::slice::index::{usize}::get" None None true false; mk_fun "core::slice::index::{usize}::get_mut" None None true false; mk_fun "core::slice::index::{usize}::get_unchecked" None None false false; -- cgit v1.2.3