From 5e92ae6b361f9221f5c5f9a39ab4c28a36597a77 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Tue, 21 Nov 2023 11:40:59 +0100 Subject: Regenerate most of the test files --- tests/coq/array/Array.v | 32 ++++---- tests/coq/array/Primitives.v | 88 +++++++++++--------- tests/coq/betree/Primitives.v | 88 +++++++++++--------- tests/coq/hashmap/Hashmap_Funs.v | 106 ++++++++++++------------ tests/coq/hashmap/Primitives.v | 88 +++++++++++--------- tests/coq/hashmap_on_disk/HashmapMain_Funs.v | 116 +++++++++++++-------------- tests/coq/hashmap_on_disk/Primitives.v | 88 +++++++++++--------- tests/coq/misc/Constants.v | 2 +- tests/coq/misc/External_Opaque.v | 4 +- tests/coq/misc/Loops.v | 15 ++-- tests/coq/misc/NoNestedBorrows.v | 5 +- tests/coq/misc/Primitives.v | 88 +++++++++++--------- tests/coq/traits/Primitives.v | 88 +++++++++++--------- 13 files changed, 425 insertions(+), 383 deletions(-) (limited to 'tests/coq') diff --git a/tests/coq/array/Array.v b/tests/coq/array/Array.v index 825f73e0..256ccd1c 100644 --- a/tests/coq/array/Array.v +++ b/tests/coq/array/Array.v @@ -101,7 +101,7 @@ Definition index_mut_slice_back Definition slice_subslice_shared_ (x : slice u32) (y : usize) (z : usize) : result (slice u32) := core_slice_index_Slice_index u32 (core_ops_range_Range usize) - (core_slice_index_Range_coresliceindexSliceIndexInst u32) x + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} . @@ -109,7 +109,7 @@ Definition slice_subslice_shared_ Definition slice_subslice_mut_ (x : slice u32) (y : usize) (z : usize) : result (slice u32) := core_slice_index_Slice_index_mut u32 (core_ops_range_Range usize) - (core_slice_index_Range_coresliceindexSliceIndexInst u32) x + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} . @@ -119,7 +119,7 @@ Definition slice_subslice_mut__back result (slice u32) := core_slice_index_Slice_index_mut_back u32 (core_ops_range_Range usize) - (core_slice_index_Range_coresliceindexSliceIndexInst u32) x + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} ret . @@ -144,8 +144,8 @@ Definition array_to_slice_mut__back Definition array_subslice_shared_ (x : array u32 32%usize) (y : usize) (z : usize) : result (slice u32) := core_array_Array_index u32 (core_ops_range_Range usize) 32%usize - (core_slice_index_Slice_coreopsindexIndexInst u32 (core_ops_range_Range - usize) (core_slice_index_Range_coresliceindexSliceIndexInst u32)) x + (core_ops_index_IndexSliceTIInst u32 (core_ops_range_Range usize) + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} . @@ -153,8 +153,8 @@ Definition array_subslice_shared_ Definition array_subslice_mut_ (x : array u32 32%usize) (y : usize) (z : usize) : result (slice u32) := core_array_Array_index_mut u32 (core_ops_range_Range usize) 32%usize - (core_slice_index_Slice_coreopsindexIndexMutInst u32 (core_ops_range_Range - usize) (core_slice_index_Range_coresliceindexSliceIndexInst u32)) x + (core_ops_index_IndexMutSliceTIInst u32 (core_ops_range_Range usize) + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} . @@ -164,8 +164,8 @@ Definition array_subslice_mut__back result (array u32 32%usize) := core_array_Array_index_mut_back u32 (core_ops_range_Range usize) 32%usize - (core_slice_index_Slice_coreopsindexIndexMutInst u32 (core_ops_range_Range - usize) (core_slice_index_Range_coresliceindexSliceIndexInst u32)) x + (core_ops_index_IndexMutSliceTIInst u32 (core_ops_range_Range usize) + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} ret . @@ -309,9 +309,8 @@ Definition update_all : result unit := Definition range_all : result unit := s <- core_array_Array_index_mut u32 (core_ops_range_Range usize) 4%usize - (core_slice_index_Slice_coreopsindexIndexMutInst u32 - (core_ops_range_Range usize) - (core_slice_index_Range_coresliceindexSliceIndexInst u32)) + (core_ops_index_IndexMutSliceTIInst u32 (core_ops_range_Range usize) + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) (mk_array u32 4%usize [ 0%u32; 0%u32; 0%u32; 0%u32 ]) {| core_ops_range_Range_start := 1%usize; @@ -320,9 +319,8 @@ Definition range_all : result unit := s0 <- update_mut_slice s; _ <- core_array_Array_index_mut_back u32 (core_ops_range_Range usize) 4%usize - (core_slice_index_Slice_coreopsindexIndexMutInst u32 - (core_ops_range_Range usize) - (core_slice_index_Range_coresliceindexSliceIndexInst u32)) + (core_ops_index_IndexMutSliceTIInst u32 (core_ops_range_Range usize) + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) (mk_array u32 4%usize [ 0%u32; 0%u32; 0%u32; 0%u32 ]) {| core_ops_range_Range_start := 1%usize; @@ -430,8 +428,8 @@ Definition f2 (i : u32) : result unit := Definition f4 (x : array u32 32%usize) (y : usize) (z : usize) : result (slice u32) := core_array_Array_index u32 (core_ops_range_Range usize) 32%usize - (core_slice_index_Slice_coreopsindexIndexInst u32 (core_ops_range_Range - usize) (core_slice_index_Range_coresliceindexSliceIndexInst u32)) x + (core_ops_index_IndexSliceTIInst u32 (core_ops_range_Range usize) + (core_slice_index_SliceIndexRangeUsizeSliceTInst u32)) x {| core_ops_range_Range_start := y; core_ops_range_Range_end_ := z |} . diff --git a/tests/coq/array/Primitives.v b/tests/coq/array/Primitives.v index 85e38f01..83f860b6 100644 --- a/tests/coq/array/Primitives.v +++ b/tests/coq/array/Primitives.v @@ -467,14 +467,14 @@ Definition alloc_boxed_Box_deref_mut (T : Type) (x : T) : result T := Return x. Definition alloc_boxed_Box_deref_mut_back (T : Type) (_ : T) (x : T) : result T := Return x. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| +Definition alloc_boxed_Box_coreopsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| core_ops_deref_Deref_target := Self; core_ops_deref_Deref_deref := alloc_boxed_Box_deref Self; |}. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| - core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreOpsDerefInst Self; +Definition alloc_boxed_Box_coreopsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| + core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreopsDerefInst Self; core_ops_deref_DerefMut_deref_mut := alloc_boxed_Box_deref_mut Self; core_ops_deref_DerefMut_deref_mut_back := alloc_boxed_Box_deref_mut_back Self; |}. @@ -576,7 +576,7 @@ Definition alloc_vec_Vec_insert (T: Type) (v: alloc_vec_Vec T) (i: usize) (x: T) else Fail_ Failure). (* Helper *) -Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result T. +Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize), result T. (* Helper *) Axiom alloc_vec_Vec_update_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result (alloc_vec_Vec T). @@ -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 *) @@ -683,44 +683,44 @@ Axiom core_array_Array_index_mut_back : forall (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) (a : array T N) (i : Idx) (x : inst.(core_ops_index_IndexMut_indexInst).(core_ops_index_Index_Output)), result (array T N). -(* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexInst (T Idx : Type) - (inst : core_slice_index_SliceIndex Idx (slice T)) : - core_ops_index_Index (slice T) Idx := {| - core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); - core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; -|}. - (* Trait implementation: [core::slice::index::private_slice_index::Range] *) -Definition core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedRangeUsizeInst : core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) := tt. (* Trait implementation: [core::slice::index::Range] *) -Definition core_slice_index_Range_coresliceindexSliceIndexInst (T : Type) : +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_Range_coresliceindexprivate_slice_indexSealedInst; + 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]] *) +Definition core_ops_index_IndexSliceTIInst (T Idx : Type) + (inst : core_slice_index_SliceIndex Idx (slice T)) : + core_ops_index_Index (slice T) Idx := {| + core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); + core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; |}. (* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexMutInst (T Idx : Type) +Definition core_ops_index_IndexMutSliceTIInst (T Idx : Type) (inst : core_slice_index_SliceIndex Idx (slice T)) : core_ops_index_IndexMut (slice T) Idx := {| - core_ops_index_IndexMut_indexInst := core_slice_index_Slice_coreopsindexIndexInst T Idx inst; + core_ops_index_IndexMut_indexInst := core_ops_index_IndexSliceTIInst T Idx inst; core_ops_index_IndexMut_index_mut := core_slice_index_Slice_index_mut T Idx inst; core_ops_index_IndexMut_index_mut_back := core_slice_index_Slice_index_mut_back T Idx inst; |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_Index (slice T) Idx) : core_ops_index_Index (array T N) Idx := {| core_ops_index_Index_Output := inst.(core_ops_index_Index_Output); @@ -728,10 +728,10 @@ Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexMutInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexMutArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) : core_ops_index_IndexMut (array T N) Idx := {| - core_ops_index_IndexMut_indexInst := core_array_Array_coreopsindexIndexInst T Idx N inst.(core_ops_index_IndexMut_indexInst); + core_ops_index_IndexMut_indexInst := core_ops_index_IndexArrayInst T Idx N inst.(core_ops_index_IndexMut_indexInst); core_ops_index_IndexMut_index_mut := core_array_Array_index_mut T Idx N inst; core_ops_index_IndexMut_index_mut_back := core_array_Array_index_mut_back T Idx N inst; |}. @@ -765,13 +765,13 @@ Axiom core_slice_index_usize_index_mut_back : forall (T : Type), usize -> slice T -> T -> result (slice T). (* Trait implementation: [core::slice::index::private_slice_index::usize] *) -Definition core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedUsizeInst : core_slice_index_private_slice_index_Sealed usize := tt. (* Trait implementation: [core::slice::index::usize] *) -Definition core_slice_index_usize_coresliceindexSliceIndexInst (T : Type) : +Definition core_slice_index_SliceIndexUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex usize (slice T) := {| - core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst; + core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedUsizeInst; core_slice_index_SliceIndex_Output := T; core_slice_index_SliceIndex_get := core_slice_index_usize_get T; core_slice_index_SliceIndex_get_mut := core_slice_index_usize_get_mut T; @@ -815,8 +815,16 @@ Definition alloc_vec_Vec_coreopsindexIndexMutInst (T Idx : Type) (*** Theorems *) +Axiom alloc_vec_Vec_index_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + +Axiom alloc_vec_Vec_index_mut_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + Axiom alloc_vec_Vec_index_mut_back_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), - alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x = + alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x = alloc_vec_Vec_update_usize v i x. End Primitives. diff --git a/tests/coq/betree/Primitives.v b/tests/coq/betree/Primitives.v index 85e38f01..83f860b6 100644 --- a/tests/coq/betree/Primitives.v +++ b/tests/coq/betree/Primitives.v @@ -467,14 +467,14 @@ Definition alloc_boxed_Box_deref_mut (T : Type) (x : T) : result T := Return x. Definition alloc_boxed_Box_deref_mut_back (T : Type) (_ : T) (x : T) : result T := Return x. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| +Definition alloc_boxed_Box_coreopsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| core_ops_deref_Deref_target := Self; core_ops_deref_Deref_deref := alloc_boxed_Box_deref Self; |}. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| - core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreOpsDerefInst Self; +Definition alloc_boxed_Box_coreopsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| + core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreopsDerefInst Self; core_ops_deref_DerefMut_deref_mut := alloc_boxed_Box_deref_mut Self; core_ops_deref_DerefMut_deref_mut_back := alloc_boxed_Box_deref_mut_back Self; |}. @@ -576,7 +576,7 @@ Definition alloc_vec_Vec_insert (T: Type) (v: alloc_vec_Vec T) (i: usize) (x: T) else Fail_ Failure). (* Helper *) -Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result T. +Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize), result T. (* Helper *) Axiom alloc_vec_Vec_update_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result (alloc_vec_Vec T). @@ -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 *) @@ -683,44 +683,44 @@ Axiom core_array_Array_index_mut_back : forall (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) (a : array T N) (i : Idx) (x : inst.(core_ops_index_IndexMut_indexInst).(core_ops_index_Index_Output)), result (array T N). -(* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexInst (T Idx : Type) - (inst : core_slice_index_SliceIndex Idx (slice T)) : - core_ops_index_Index (slice T) Idx := {| - core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); - core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; -|}. - (* Trait implementation: [core::slice::index::private_slice_index::Range] *) -Definition core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedRangeUsizeInst : core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) := tt. (* Trait implementation: [core::slice::index::Range] *) -Definition core_slice_index_Range_coresliceindexSliceIndexInst (T : Type) : +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_Range_coresliceindexprivate_slice_indexSealedInst; + 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]] *) +Definition core_ops_index_IndexSliceTIInst (T Idx : Type) + (inst : core_slice_index_SliceIndex Idx (slice T)) : + core_ops_index_Index (slice T) Idx := {| + core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); + core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; |}. (* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexMutInst (T Idx : Type) +Definition core_ops_index_IndexMutSliceTIInst (T Idx : Type) (inst : core_slice_index_SliceIndex Idx (slice T)) : core_ops_index_IndexMut (slice T) Idx := {| - core_ops_index_IndexMut_indexInst := core_slice_index_Slice_coreopsindexIndexInst T Idx inst; + core_ops_index_IndexMut_indexInst := core_ops_index_IndexSliceTIInst T Idx inst; core_ops_index_IndexMut_index_mut := core_slice_index_Slice_index_mut T Idx inst; core_ops_index_IndexMut_index_mut_back := core_slice_index_Slice_index_mut_back T Idx inst; |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_Index (slice T) Idx) : core_ops_index_Index (array T N) Idx := {| core_ops_index_Index_Output := inst.(core_ops_index_Index_Output); @@ -728,10 +728,10 @@ Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexMutInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexMutArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) : core_ops_index_IndexMut (array T N) Idx := {| - core_ops_index_IndexMut_indexInst := core_array_Array_coreopsindexIndexInst T Idx N inst.(core_ops_index_IndexMut_indexInst); + core_ops_index_IndexMut_indexInst := core_ops_index_IndexArrayInst T Idx N inst.(core_ops_index_IndexMut_indexInst); core_ops_index_IndexMut_index_mut := core_array_Array_index_mut T Idx N inst; core_ops_index_IndexMut_index_mut_back := core_array_Array_index_mut_back T Idx N inst; |}. @@ -765,13 +765,13 @@ Axiom core_slice_index_usize_index_mut_back : forall (T : Type), usize -> slice T -> T -> result (slice T). (* Trait implementation: [core::slice::index::private_slice_index::usize] *) -Definition core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedUsizeInst : core_slice_index_private_slice_index_Sealed usize := tt. (* Trait implementation: [core::slice::index::usize] *) -Definition core_slice_index_usize_coresliceindexSliceIndexInst (T : Type) : +Definition core_slice_index_SliceIndexUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex usize (slice T) := {| - core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst; + core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedUsizeInst; core_slice_index_SliceIndex_Output := T; core_slice_index_SliceIndex_get := core_slice_index_usize_get T; core_slice_index_SliceIndex_get_mut := core_slice_index_usize_get_mut T; @@ -815,8 +815,16 @@ Definition alloc_vec_Vec_coreopsindexIndexMutInst (T Idx : Type) (*** Theorems *) +Axiom alloc_vec_Vec_index_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + +Axiom alloc_vec_Vec_index_mut_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + Axiom alloc_vec_Vec_index_mut_back_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), - alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x = + alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x = alloc_vec_Vec_update_usize v i x. End Primitives. diff --git a/tests/coq/hashmap/Hashmap_Funs.v b/tests/coq/hashmap/Hashmap_Funs.v index 3ca52a9f..fbed86b5 100644 --- a/tests/coq/hashmap/Hashmap_Funs.v +++ b/tests/coq/hashmap/Hashmap_Funs.v @@ -14,7 +14,7 @@ Module Hashmap_Funs. Definition hash_key (k : usize) : result usize := Return k. -(** [hashmap::HashMap::{0}::allocate_slots]: loop 0: forward function *) +(** [hashmap::{hashmap::HashMap}::allocate_slots]: loop 0: forward function *) Fixpoint hashMap_allocate_slots_loop (T : Type) (n : nat) (slots : alloc_vec_Vec (List_t T)) (n0 : usize) : result (alloc_vec_Vec (List_t T)) @@ -31,7 +31,7 @@ Fixpoint hashMap_allocate_slots_loop end . -(** [hashmap::HashMap::{0}::allocate_slots]: forward function *) +(** [hashmap::{hashmap::HashMap}::allocate_slots]: forward function *) Definition hashMap_allocate_slots (T : Type) (n : nat) (slots : alloc_vec_Vec (List_t T)) (n0 : usize) : result (alloc_vec_Vec (List_t T)) @@ -39,7 +39,7 @@ Definition hashMap_allocate_slots hashMap_allocate_slots_loop T n slots n0 . -(** [hashmap::HashMap::{0}::new_with_capacity]: forward function *) +(** [hashmap::{hashmap::HashMap}::new_with_capacity]: forward function *) Definition hashMap_new_with_capacity (T : Type) (n : nat) (capacity : usize) (max_load_dividend : usize) (max_load_divisor : usize) : @@ -58,12 +58,12 @@ Definition hashMap_new_with_capacity |} . -(** [hashmap::HashMap::{0}::new]: forward function *) +(** [hashmap::{hashmap::HashMap}::new]: forward function *) Definition hashMap_new (T : Type) (n : nat) : result (HashMap_t T) := hashMap_new_with_capacity T n 32%usize 4%usize 5%usize . -(** [hashmap::HashMap::{0}::clear]: loop 0: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::clear]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Fixpoint hashMap_clear_loop (T : Type) (n : nat) (slots : alloc_vec_Vec (List_t T)) (i : usize) : @@ -78,14 +78,14 @@ Fixpoint hashMap_clear_loop i1 <- usize_add i 1%usize; slots0 <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) - slots i List_Nil; + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) slots i + List_Nil; hashMap_clear_loop T n0 slots0 i1) else Return slots end . -(** [hashmap::HashMap::{0}::clear]: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::clear]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashMap_clear (T : Type) (n : nat) (self : HashMap_t T) : result (HashMap_t T) := @@ -99,12 +99,12 @@ Definition hashMap_clear |} . -(** [hashmap::HashMap::{0}::len]: forward function *) +(** [hashmap::{hashmap::HashMap}::len]: forward function *) Definition hashMap_len (T : Type) (self : HashMap_t T) : result usize := Return self.(hashMap_num_entries) . -(** [hashmap::HashMap::{0}::insert_in_list]: loop 0: forward function *) +(** [hashmap::{hashmap::HashMap}::insert_in_list]: loop 0: forward function *) Fixpoint hashMap_insert_in_list_loop (T : Type) (n : nat) (key : usize) (value : T) (ls : List_t T) : result bool @@ -122,7 +122,7 @@ Fixpoint hashMap_insert_in_list_loop end . -(** [hashmap::HashMap::{0}::insert_in_list]: forward function *) +(** [hashmap::{hashmap::HashMap}::insert_in_list]: forward function *) Definition hashMap_insert_in_list (T : Type) (n : nat) (key : usize) (value : T) (ls : List_t T) : result bool @@ -130,7 +130,7 @@ Definition hashMap_insert_in_list hashMap_insert_in_list_loop T n key value ls . -(** [hashmap::HashMap::{0}::insert_in_list]: loop 0: backward function 0 *) +(** [hashmap::{hashmap::HashMap}::insert_in_list]: loop 0: backward function 0 *) Fixpoint hashMap_insert_in_list_loop_back (T : Type) (n : nat) (key : usize) (value : T) (ls : List_t T) : result (List_t T) @@ -150,7 +150,7 @@ Fixpoint hashMap_insert_in_list_loop_back end . -(** [hashmap::HashMap::{0}::insert_in_list]: backward function 0 *) +(** [hashmap::{hashmap::HashMap}::insert_in_list]: backward function 0 *) Definition hashMap_insert_in_list_back (T : Type) (n : nat) (key : usize) (value : T) (ls : List_t T) : result (List_t T) @@ -158,7 +158,7 @@ Definition hashMap_insert_in_list_back hashMap_insert_in_list_loop_back T n key value ls . -(** [hashmap::HashMap::{0}::insert_no_resize]: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::insert_no_resize]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashMap_insert_no_resize (T : Type) (n : nat) (self : HashMap_t T) (key : usize) (value : T) : @@ -169,7 +169,7 @@ Definition hashMap_insert_no_resize hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; inserted <- hashMap_insert_in_list T n key value l; if inserted @@ -178,7 +178,7 @@ Definition hashMap_insert_no_resize l0 <- hashMap_insert_in_list_back T n key value l; v <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod l0; Return {| @@ -191,7 +191,7 @@ Definition hashMap_insert_no_resize l0 <- hashMap_insert_in_list_back T n key value l; v <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod l0; Return {| @@ -202,7 +202,7 @@ Definition hashMap_insert_no_resize |}) . -(** [hashmap::HashMap::{0}::move_elements_from_list]: loop 0: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::move_elements_from_list]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Fixpoint hashMap_move_elements_from_list_loop (T : Type) (n : nat) (ntable : HashMap_t T) (ls : List_t T) : @@ -220,7 +220,7 @@ Fixpoint hashMap_move_elements_from_list_loop end . -(** [hashmap::HashMap::{0}::move_elements_from_list]: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::move_elements_from_list]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashMap_move_elements_from_list (T : Type) (n : nat) (ntable : HashMap_t T) (ls : List_t T) : @@ -229,7 +229,7 @@ Definition hashMap_move_elements_from_list hashMap_move_elements_from_list_loop T n ntable ls . -(** [hashmap::HashMap::{0}::move_elements]: loop 0: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::move_elements]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Fixpoint hashMap_move_elements_loop (T : Type) (n : nat) (ntable : HashMap_t T) @@ -244,22 +244,20 @@ Fixpoint hashMap_move_elements_loop then ( l <- alloc_vec_Vec_index_mut (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) - slots i; + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) slots i; let ls := core_mem_replace (List_t T) l List_Nil in ntable0 <- hashMap_move_elements_from_list T n0 ntable ls; i1 <- usize_add i 1%usize; let l0 := core_mem_replace_back (List_t T) l List_Nil in slots0 <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) - slots i l0; + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) slots i l0; hashMap_move_elements_loop T n0 ntable0 slots0 i1) else Return (ntable, slots) end . -(** [hashmap::HashMap::{0}::move_elements]: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::move_elements]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashMap_move_elements (T : Type) (n : nat) (ntable : HashMap_t T) @@ -269,7 +267,7 @@ Definition hashMap_move_elements hashMap_move_elements_loop T n ntable slots i . -(** [hashmap::HashMap::{0}::try_resize]: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::try_resize]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashMap_try_resize (T : Type) (n : nat) (self : HashMap_t T) : result (HashMap_t T) := @@ -301,7 +299,7 @@ Definition hashMap_try_resize |} . -(** [hashmap::HashMap::{0}::insert]: merged forward/backward function +(** [hashmap::{hashmap::HashMap}::insert]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashMap_insert (T : Type) (n : nat) (self : HashMap_t T) (key : usize) (value : T) : @@ -314,7 +312,7 @@ Definition hashMap_insert else Return self0 . -(** [hashmap::HashMap::{0}::contains_key_in_list]: loop 0: forward function *) +(** [hashmap::{hashmap::HashMap}::contains_key_in_list]: loop 0: forward function *) Fixpoint hashMap_contains_key_in_list_loop (T : Type) (n : nat) (key : usize) (ls : List_t T) : result bool := match n with @@ -330,13 +328,13 @@ Fixpoint hashMap_contains_key_in_list_loop end . -(** [hashmap::HashMap::{0}::contains_key_in_list]: forward function *) +(** [hashmap::{hashmap::HashMap}::contains_key_in_list]: forward function *) Definition hashMap_contains_key_in_list (T : Type) (n : nat) (key : usize) (ls : List_t T) : result bool := hashMap_contains_key_in_list_loop T n key ls . -(** [hashmap::HashMap::{0}::contains_key]: forward function *) +(** [hashmap::{hashmap::HashMap}::contains_key]: forward function *) Definition hashMap_contains_key (T : Type) (n : nat) (self : HashMap_t T) (key : usize) : result bool := hash <- hash_key key; @@ -344,12 +342,12 @@ Definition hashMap_contains_key hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; hashMap_contains_key_in_list T n key l . -(** [hashmap::HashMap::{0}::get_in_list]: loop 0: forward function *) +(** [hashmap::{hashmap::HashMap}::get_in_list]: loop 0: forward function *) Fixpoint hashMap_get_in_list_loop (T : Type) (n : nat) (key : usize) (ls : List_t T) : result T := match n with @@ -365,13 +363,13 @@ Fixpoint hashMap_get_in_list_loop end . -(** [hashmap::HashMap::{0}::get_in_list]: forward function *) +(** [hashmap::{hashmap::HashMap}::get_in_list]: forward function *) Definition hashMap_get_in_list (T : Type) (n : nat) (key : usize) (ls : List_t T) : result T := hashMap_get_in_list_loop T n key ls . -(** [hashmap::HashMap::{0}::get]: forward function *) +(** [hashmap::{hashmap::HashMap}::get]: forward function *) Definition hashMap_get (T : Type) (n : nat) (self : HashMap_t T) (key : usize) : result T := hash <- hash_key key; @@ -379,12 +377,12 @@ Definition hashMap_get hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; hashMap_get_in_list T n key l . -(** [hashmap::HashMap::{0}::get_mut_in_list]: loop 0: forward function *) +(** [hashmap::{hashmap::HashMap}::get_mut_in_list]: loop 0: forward function *) Fixpoint hashMap_get_mut_in_list_loop (T : Type) (n : nat) (ls : List_t T) (key : usize) : result T := match n with @@ -400,13 +398,13 @@ Fixpoint hashMap_get_mut_in_list_loop end . -(** [hashmap::HashMap::{0}::get_mut_in_list]: forward function *) +(** [hashmap::{hashmap::HashMap}::get_mut_in_list]: forward function *) Definition hashMap_get_mut_in_list (T : Type) (n : nat) (ls : List_t T) (key : usize) : result T := hashMap_get_mut_in_list_loop T n ls key . -(** [hashmap::HashMap::{0}::get_mut_in_list]: loop 0: backward function 0 *) +(** [hashmap::{hashmap::HashMap}::get_mut_in_list]: loop 0: backward function 0 *) Fixpoint hashMap_get_mut_in_list_loop_back (T : Type) (n : nat) (ls : List_t T) (key : usize) (ret : T) : result (List_t T) @@ -426,7 +424,7 @@ Fixpoint hashMap_get_mut_in_list_loop_back end . -(** [hashmap::HashMap::{0}::get_mut_in_list]: backward function 0 *) +(** [hashmap::{hashmap::HashMap}::get_mut_in_list]: backward function 0 *) Definition hashMap_get_mut_in_list_back (T : Type) (n : nat) (ls : List_t T) (key : usize) (ret : T) : result (List_t T) @@ -434,7 +432,7 @@ Definition hashMap_get_mut_in_list_back hashMap_get_mut_in_list_loop_back T n ls key ret . -(** [hashmap::HashMap::{0}::get_mut]: forward function *) +(** [hashmap::{hashmap::HashMap}::get_mut]: forward function *) Definition hashMap_get_mut (T : Type) (n : nat) (self : HashMap_t T) (key : usize) : result T := hash <- hash_key key; @@ -442,12 +440,12 @@ Definition hashMap_get_mut hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; hashMap_get_mut_in_list T n l key . -(** [hashmap::HashMap::{0}::get_mut]: backward function 0 *) +(** [hashmap::{hashmap::HashMap}::get_mut]: backward function 0 *) Definition hashMap_get_mut_back (T : Type) (n : nat) (self : HashMap_t T) (key : usize) (ret : T) : result (HashMap_t T) @@ -457,12 +455,12 @@ Definition hashMap_get_mut_back hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; l0 <- hashMap_get_mut_in_list_back T n l key ret; v <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod l0; Return {| @@ -473,7 +471,7 @@ Definition hashMap_get_mut_back |} . -(** [hashmap::HashMap::{0}::remove_from_list]: loop 0: forward function *) +(** [hashmap::{hashmap::HashMap}::remove_from_list]: loop 0: forward function *) Fixpoint hashMap_remove_from_list_loop (T : Type) (n : nat) (key : usize) (ls : List_t T) : result (option T) := match n with @@ -495,13 +493,13 @@ Fixpoint hashMap_remove_from_list_loop end . -(** [hashmap::HashMap::{0}::remove_from_list]: forward function *) +(** [hashmap::{hashmap::HashMap}::remove_from_list]: forward function *) Definition hashMap_remove_from_list (T : Type) (n : nat) (key : usize) (ls : List_t T) : result (option T) := hashMap_remove_from_list_loop T n key ls . -(** [hashmap::HashMap::{0}::remove_from_list]: loop 0: backward function 1 *) +(** [hashmap::{hashmap::HashMap}::remove_from_list]: loop 0: backward function 1 *) Fixpoint hashMap_remove_from_list_loop_back (T : Type) (n : nat) (key : usize) (ls : List_t T) : result (List_t T) := match n with @@ -525,13 +523,13 @@ Fixpoint hashMap_remove_from_list_loop_back end . -(** [hashmap::HashMap::{0}::remove_from_list]: backward function 1 *) +(** [hashmap::{hashmap::HashMap}::remove_from_list]: backward function 1 *) Definition hashMap_remove_from_list_back (T : Type) (n : nat) (key : usize) (ls : List_t T) : result (List_t T) := hashMap_remove_from_list_loop_back T n key ls . -(** [hashmap::HashMap::{0}::remove]: forward function *) +(** [hashmap::{hashmap::HashMap}::remove]: forward function *) Definition hashMap_remove (T : Type) (n : nat) (self : HashMap_t T) (key : usize) : result (option T) @@ -541,7 +539,7 @@ Definition hashMap_remove hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; x <- hashMap_remove_from_list T n key l; match x with @@ -551,7 +549,7 @@ Definition hashMap_remove end . -(** [hashmap::HashMap::{0}::remove]: backward function 0 *) +(** [hashmap::{hashmap::HashMap}::remove]: backward function 0 *) Definition hashMap_remove_back (T : Type) (n : nat) (self : HashMap_t T) (key : usize) : result (HashMap_t T) @@ -561,7 +559,7 @@ Definition hashMap_remove_back hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod; x <- hashMap_remove_from_list T n key l; match x with @@ -569,7 +567,7 @@ Definition hashMap_remove_back l0 <- hashMap_remove_from_list_back T n key l; v <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod l0; Return {| @@ -583,7 +581,7 @@ Definition hashMap_remove_back l0 <- hashMap_remove_from_list_back T n key l; v <- alloc_vec_Vec_index_mut_back (List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (List_t T)) self.(hashMap_slots) hash_mod l0; Return {| diff --git a/tests/coq/hashmap/Primitives.v b/tests/coq/hashmap/Primitives.v index 85e38f01..83f860b6 100644 --- a/tests/coq/hashmap/Primitives.v +++ b/tests/coq/hashmap/Primitives.v @@ -467,14 +467,14 @@ Definition alloc_boxed_Box_deref_mut (T : Type) (x : T) : result T := Return x. Definition alloc_boxed_Box_deref_mut_back (T : Type) (_ : T) (x : T) : result T := Return x. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| +Definition alloc_boxed_Box_coreopsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| core_ops_deref_Deref_target := Self; core_ops_deref_Deref_deref := alloc_boxed_Box_deref Self; |}. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| - core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreOpsDerefInst Self; +Definition alloc_boxed_Box_coreopsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| + core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreopsDerefInst Self; core_ops_deref_DerefMut_deref_mut := alloc_boxed_Box_deref_mut Self; core_ops_deref_DerefMut_deref_mut_back := alloc_boxed_Box_deref_mut_back Self; |}. @@ -576,7 +576,7 @@ Definition alloc_vec_Vec_insert (T: Type) (v: alloc_vec_Vec T) (i: usize) (x: T) else Fail_ Failure). (* Helper *) -Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result T. +Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize), result T. (* Helper *) Axiom alloc_vec_Vec_update_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result (alloc_vec_Vec T). @@ -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 *) @@ -683,44 +683,44 @@ Axiom core_array_Array_index_mut_back : forall (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) (a : array T N) (i : Idx) (x : inst.(core_ops_index_IndexMut_indexInst).(core_ops_index_Index_Output)), result (array T N). -(* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexInst (T Idx : Type) - (inst : core_slice_index_SliceIndex Idx (slice T)) : - core_ops_index_Index (slice T) Idx := {| - core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); - core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; -|}. - (* Trait implementation: [core::slice::index::private_slice_index::Range] *) -Definition core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedRangeUsizeInst : core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) := tt. (* Trait implementation: [core::slice::index::Range] *) -Definition core_slice_index_Range_coresliceindexSliceIndexInst (T : Type) : +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_Range_coresliceindexprivate_slice_indexSealedInst; + 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]] *) +Definition core_ops_index_IndexSliceTIInst (T Idx : Type) + (inst : core_slice_index_SliceIndex Idx (slice T)) : + core_ops_index_Index (slice T) Idx := {| + core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); + core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; |}. (* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexMutInst (T Idx : Type) +Definition core_ops_index_IndexMutSliceTIInst (T Idx : Type) (inst : core_slice_index_SliceIndex Idx (slice T)) : core_ops_index_IndexMut (slice T) Idx := {| - core_ops_index_IndexMut_indexInst := core_slice_index_Slice_coreopsindexIndexInst T Idx inst; + core_ops_index_IndexMut_indexInst := core_ops_index_IndexSliceTIInst T Idx inst; core_ops_index_IndexMut_index_mut := core_slice_index_Slice_index_mut T Idx inst; core_ops_index_IndexMut_index_mut_back := core_slice_index_Slice_index_mut_back T Idx inst; |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_Index (slice T) Idx) : core_ops_index_Index (array T N) Idx := {| core_ops_index_Index_Output := inst.(core_ops_index_Index_Output); @@ -728,10 +728,10 @@ Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexMutInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexMutArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) : core_ops_index_IndexMut (array T N) Idx := {| - core_ops_index_IndexMut_indexInst := core_array_Array_coreopsindexIndexInst T Idx N inst.(core_ops_index_IndexMut_indexInst); + core_ops_index_IndexMut_indexInst := core_ops_index_IndexArrayInst T Idx N inst.(core_ops_index_IndexMut_indexInst); core_ops_index_IndexMut_index_mut := core_array_Array_index_mut T Idx N inst; core_ops_index_IndexMut_index_mut_back := core_array_Array_index_mut_back T Idx N inst; |}. @@ -765,13 +765,13 @@ Axiom core_slice_index_usize_index_mut_back : forall (T : Type), usize -> slice T -> T -> result (slice T). (* Trait implementation: [core::slice::index::private_slice_index::usize] *) -Definition core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedUsizeInst : core_slice_index_private_slice_index_Sealed usize := tt. (* Trait implementation: [core::slice::index::usize] *) -Definition core_slice_index_usize_coresliceindexSliceIndexInst (T : Type) : +Definition core_slice_index_SliceIndexUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex usize (slice T) := {| - core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst; + core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedUsizeInst; core_slice_index_SliceIndex_Output := T; core_slice_index_SliceIndex_get := core_slice_index_usize_get T; core_slice_index_SliceIndex_get_mut := core_slice_index_usize_get_mut T; @@ -815,8 +815,16 @@ Definition alloc_vec_Vec_coreopsindexIndexMutInst (T Idx : Type) (*** Theorems *) +Axiom alloc_vec_Vec_index_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + +Axiom alloc_vec_Vec_index_mut_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + Axiom alloc_vec_Vec_index_mut_back_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), - alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x = + alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x = alloc_vec_Vec_update_usize v i x. End Primitives. diff --git a/tests/coq/hashmap_on_disk/HashmapMain_Funs.v b/tests/coq/hashmap_on_disk/HashmapMain_Funs.v index eac78186..6f3848e6 100644 --- a/tests/coq/hashmap_on_disk/HashmapMain_Funs.v +++ b/tests/coq/hashmap_on_disk/HashmapMain_Funs.v @@ -16,7 +16,7 @@ Module HashmapMain_Funs. Definition hashmap_hash_key (k : usize) : result usize := Return k. -(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots]: loop 0: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::allocate_slots]: loop 0: forward function *) Fixpoint hashmap_HashMap_allocate_slots_loop (T : Type) (n : nat) (slots : alloc_vec_Vec (hashmap_List_t T)) (n0 : usize) : @@ -34,7 +34,7 @@ Fixpoint hashmap_HashMap_allocate_slots_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::allocate_slots]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::allocate_slots]: forward function *) Definition hashmap_HashMap_allocate_slots (T : Type) (n : nat) (slots : alloc_vec_Vec (hashmap_List_t T)) (n0 : usize) : @@ -43,7 +43,7 @@ Definition hashmap_HashMap_allocate_slots hashmap_HashMap_allocate_slots_loop T n slots n0 . -(** [hashmap_main::hashmap::HashMap::{0}::new_with_capacity]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::new_with_capacity]: forward function *) Definition hashmap_HashMap_new_with_capacity (T : Type) (n : nat) (capacity : usize) (max_load_dividend : usize) (max_load_divisor : usize) : @@ -62,13 +62,13 @@ Definition hashmap_HashMap_new_with_capacity |} . -(** [hashmap_main::hashmap::HashMap::{0}::new]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::new]: forward function *) Definition hashmap_HashMap_new (T : Type) (n : nat) : result (hashmap_HashMap_t T) := hashmap_HashMap_new_with_capacity T n 32%usize 4%usize 5%usize . -(** [hashmap_main::hashmap::HashMap::{0}::clear]: loop 0: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::clear]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Fixpoint hashmap_HashMap_clear_loop (T : Type) (n : nat) (slots : alloc_vec_Vec (hashmap_List_t T)) (i : usize) : @@ -83,14 +83,14 @@ Fixpoint hashmap_HashMap_clear_loop i1 <- usize_add i 1%usize; slots0 <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) slots i Hashmap_List_Nil; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) slots + i Hashmap_List_Nil; hashmap_HashMap_clear_loop T n0 slots0 i1) else Return slots end . -(** [hashmap_main::hashmap::HashMap::{0}::clear]: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::clear]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashmap_HashMap_clear (T : Type) (n : nat) (self : hashmap_HashMap_t T) : @@ -106,13 +106,13 @@ Definition hashmap_HashMap_clear |} . -(** [hashmap_main::hashmap::HashMap::{0}::len]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::len]: forward function *) Definition hashmap_HashMap_len (T : Type) (self : hashmap_HashMap_t T) : result usize := Return self.(hashmap_HashMap_num_entries) . -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: loop 0: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::insert_in_list]: loop 0: forward function *) Fixpoint hashmap_HashMap_insert_in_list_loop (T : Type) (n : nat) (key : usize) (value : T) (ls : hashmap_List_t T) : result bool @@ -130,7 +130,7 @@ Fixpoint hashmap_HashMap_insert_in_list_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::insert_in_list]: forward function *) Definition hashmap_HashMap_insert_in_list (T : Type) (n : nat) (key : usize) (value : T) (ls : hashmap_List_t T) : result bool @@ -138,7 +138,7 @@ Definition hashmap_HashMap_insert_in_list hashmap_HashMap_insert_in_list_loop T n key value ls . -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: loop 0: backward function 0 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::insert_in_list]: loop 0: backward function 0 *) Fixpoint hashmap_HashMap_insert_in_list_loop_back (T : Type) (n : nat) (key : usize) (value : T) (ls : hashmap_List_t T) : result (hashmap_List_t T) @@ -159,7 +159,7 @@ Fixpoint hashmap_HashMap_insert_in_list_loop_back end . -(** [hashmap_main::hashmap::HashMap::{0}::insert_in_list]: backward function 0 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::insert_in_list]: backward function 0 *) Definition hashmap_HashMap_insert_in_list_back (T : Type) (n : nat) (key : usize) (value : T) (ls : hashmap_List_t T) : result (hashmap_List_t T) @@ -167,7 +167,7 @@ Definition hashmap_HashMap_insert_in_list_back hashmap_HashMap_insert_in_list_loop_back T n key value ls . -(** [hashmap_main::hashmap::HashMap::{0}::insert_no_resize]: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::insert_no_resize]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashmap_HashMap_insert_no_resize (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) (value : T) : @@ -178,7 +178,7 @@ Definition hashmap_HashMap_insert_no_resize hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; inserted <- hashmap_HashMap_insert_in_list T n key value l; if inserted @@ -187,8 +187,8 @@ Definition hashmap_HashMap_insert_no_resize l0 <- hashmap_HashMap_insert_in_list_back T n key value l; v <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) self.(hashmap_HashMap_slots) hash_mod l0; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) + self.(hashmap_HashMap_slots) hash_mod l0; Return {| hashmap_HashMap_num_entries := i0; @@ -201,8 +201,8 @@ Definition hashmap_HashMap_insert_no_resize l0 <- hashmap_HashMap_insert_in_list_back T n key value l; v <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) self.(hashmap_HashMap_slots) hash_mod l0; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) + self.(hashmap_HashMap_slots) hash_mod l0; Return {| hashmap_HashMap_num_entries := self.(hashmap_HashMap_num_entries); @@ -213,7 +213,7 @@ Definition hashmap_HashMap_insert_no_resize |}) . -(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list]: loop 0: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::move_elements_from_list]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Fixpoint hashmap_HashMap_move_elements_from_list_loop (T : Type) (n : nat) (ntable : hashmap_HashMap_t T) (ls : hashmap_List_t T) : @@ -231,7 +231,7 @@ Fixpoint hashmap_HashMap_move_elements_from_list_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::move_elements_from_list]: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::move_elements_from_list]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashmap_HashMap_move_elements_from_list (T : Type) (n : nat) (ntable : hashmap_HashMap_t T) (ls : hashmap_List_t T) : @@ -240,7 +240,7 @@ Definition hashmap_HashMap_move_elements_from_list hashmap_HashMap_move_elements_from_list_loop T n ntable ls . -(** [hashmap_main::hashmap::HashMap::{0}::move_elements]: loop 0: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::move_elements]: loop 0: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Fixpoint hashmap_HashMap_move_elements_loop (T : Type) (n : nat) (ntable : hashmap_HashMap_t T) @@ -255,22 +255,22 @@ Fixpoint hashmap_HashMap_move_elements_loop then ( l <- alloc_vec_Vec_index_mut (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) slots i; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) slots + i; let ls := core_mem_replace (hashmap_List_t T) l Hashmap_List_Nil in ntable0 <- hashmap_HashMap_move_elements_from_list T n0 ntable ls; i1 <- usize_add i 1%usize; let l0 := core_mem_replace_back (hashmap_List_t T) l Hashmap_List_Nil in slots0 <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) slots i l0; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) slots + i l0; hashmap_HashMap_move_elements_loop T n0 ntable0 slots0 i1) else Return (ntable, slots) end . -(** [hashmap_main::hashmap::HashMap::{0}::move_elements]: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::move_elements]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashmap_HashMap_move_elements (T : Type) (n : nat) (ntable : hashmap_HashMap_t T) @@ -280,7 +280,7 @@ Definition hashmap_HashMap_move_elements hashmap_HashMap_move_elements_loop T n ntable slots i . -(** [hashmap_main::hashmap::HashMap::{0}::try_resize]: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::try_resize]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashmap_HashMap_try_resize (T : Type) (n : nat) (self : hashmap_HashMap_t T) : @@ -317,7 +317,7 @@ Definition hashmap_HashMap_try_resize |} . -(** [hashmap_main::hashmap::HashMap::{0}::insert]: merged forward/backward function +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::insert]: merged forward/backward function (there is a single backward function, and the forward function returns ()) *) Definition hashmap_HashMap_insert (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) (value : T) : @@ -330,7 +330,7 @@ Definition hashmap_HashMap_insert else Return self0 . -(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list]: loop 0: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::contains_key_in_list]: loop 0: forward function *) Fixpoint hashmap_HashMap_contains_key_in_list_loop (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result bool := match n with @@ -346,13 +346,13 @@ Fixpoint hashmap_HashMap_contains_key_in_list_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::contains_key_in_list]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::contains_key_in_list]: forward function *) Definition hashmap_HashMap_contains_key_in_list (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result bool := hashmap_HashMap_contains_key_in_list_loop T n key ls . -(** [hashmap_main::hashmap::HashMap::{0}::contains_key]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::contains_key]: forward function *) Definition hashmap_HashMap_contains_key (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) : result bool @@ -362,12 +362,12 @@ Definition hashmap_HashMap_contains_key hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; hashmap_HashMap_contains_key_in_list T n key l . -(** [hashmap_main::hashmap::HashMap::{0}::get_in_list]: loop 0: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_in_list]: loop 0: forward function *) Fixpoint hashmap_HashMap_get_in_list_loop (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result T := match n with @@ -383,13 +383,13 @@ Fixpoint hashmap_HashMap_get_in_list_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::get_in_list]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_in_list]: forward function *) Definition hashmap_HashMap_get_in_list (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result T := hashmap_HashMap_get_in_list_loop T n key ls . -(** [hashmap_main::hashmap::HashMap::{0}::get]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get]: forward function *) Definition hashmap_HashMap_get (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) : result T := hash <- hashmap_hash_key key; @@ -397,12 +397,12 @@ Definition hashmap_HashMap_get hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; hashmap_HashMap_get_in_list T n key l . -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: loop 0: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_mut_in_list]: loop 0: forward function *) Fixpoint hashmap_HashMap_get_mut_in_list_loop (T : Type) (n : nat) (ls : hashmap_List_t T) (key : usize) : result T := match n with @@ -418,13 +418,13 @@ Fixpoint hashmap_HashMap_get_mut_in_list_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_mut_in_list]: forward function *) Definition hashmap_HashMap_get_mut_in_list (T : Type) (n : nat) (ls : hashmap_List_t T) (key : usize) : result T := hashmap_HashMap_get_mut_in_list_loop T n ls key . -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: loop 0: backward function 0 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_mut_in_list]: loop 0: backward function 0 *) Fixpoint hashmap_HashMap_get_mut_in_list_loop_back (T : Type) (n : nat) (ls : hashmap_List_t T) (key : usize) (ret : T) : result (hashmap_List_t T) @@ -444,7 +444,7 @@ Fixpoint hashmap_HashMap_get_mut_in_list_loop_back end . -(** [hashmap_main::hashmap::HashMap::{0}::get_mut_in_list]: backward function 0 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_mut_in_list]: backward function 0 *) Definition hashmap_HashMap_get_mut_in_list_back (T : Type) (n : nat) (ls : hashmap_List_t T) (key : usize) (ret : T) : result (hashmap_List_t T) @@ -452,7 +452,7 @@ Definition hashmap_HashMap_get_mut_in_list_back hashmap_HashMap_get_mut_in_list_loop_back T n ls key ret . -(** [hashmap_main::hashmap::HashMap::{0}::get_mut]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_mut]: forward function *) Definition hashmap_HashMap_get_mut (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) : result T := hash <- hashmap_hash_key key; @@ -460,12 +460,12 @@ Definition hashmap_HashMap_get_mut hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; hashmap_HashMap_get_mut_in_list T n l key . -(** [hashmap_main::hashmap::HashMap::{0}::get_mut]: backward function 0 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::get_mut]: backward function 0 *) Definition hashmap_HashMap_get_mut_back (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) (ret : T) : result (hashmap_HashMap_t T) @@ -475,12 +475,12 @@ Definition hashmap_HashMap_get_mut_back hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; l0 <- hashmap_HashMap_get_mut_in_list_back T n l key ret; v <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod l0; Return {| @@ -491,7 +491,7 @@ Definition hashmap_HashMap_get_mut_back |} . -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: loop 0: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::remove_from_list]: loop 0: forward function *) Fixpoint hashmap_HashMap_remove_from_list_loop (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result (option T) @@ -516,7 +516,7 @@ Fixpoint hashmap_HashMap_remove_from_list_loop end . -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::remove_from_list]: forward function *) Definition hashmap_HashMap_remove_from_list (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result (option T) @@ -524,7 +524,7 @@ Definition hashmap_HashMap_remove_from_list hashmap_HashMap_remove_from_list_loop T n key ls . -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: loop 0: backward function 1 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::remove_from_list]: loop 0: backward function 1 *) Fixpoint hashmap_HashMap_remove_from_list_loop_back (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result (hashmap_List_t T) @@ -551,7 +551,7 @@ Fixpoint hashmap_HashMap_remove_from_list_loop_back end . -(** [hashmap_main::hashmap::HashMap::{0}::remove_from_list]: backward function 1 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::remove_from_list]: backward function 1 *) Definition hashmap_HashMap_remove_from_list_back (T : Type) (n : nat) (key : usize) (ls : hashmap_List_t T) : result (hashmap_List_t T) @@ -559,7 +559,7 @@ Definition hashmap_HashMap_remove_from_list_back hashmap_HashMap_remove_from_list_loop_back T n key ls . -(** [hashmap_main::hashmap::HashMap::{0}::remove]: forward function *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::remove]: forward function *) Definition hashmap_HashMap_remove (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) : result (option T) @@ -569,7 +569,7 @@ Definition hashmap_HashMap_remove hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; x <- hashmap_HashMap_remove_from_list T n key l; match x with @@ -579,7 +579,7 @@ Definition hashmap_HashMap_remove end . -(** [hashmap_main::hashmap::HashMap::{0}::remove]: backward function 0 *) +(** [hashmap_main::hashmap::{hashmap_main::hashmap::HashMap}::remove]: backward function 0 *) Definition hashmap_HashMap_remove_back (T : Type) (n : nat) (self : hashmap_HashMap_t T) (key : usize) : result (hashmap_HashMap_t T) @@ -589,7 +589,7 @@ Definition hashmap_HashMap_remove_back hash_mod <- usize_rem hash i; l <- alloc_vec_Vec_index_mut (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t T)) + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) self.(hashmap_HashMap_slots) hash_mod; x <- hashmap_HashMap_remove_from_list T n key l; match x with @@ -597,8 +597,8 @@ Definition hashmap_HashMap_remove_back l0 <- hashmap_HashMap_remove_from_list_back T n key l; v <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) self.(hashmap_HashMap_slots) hash_mod l0; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) + self.(hashmap_HashMap_slots) hash_mod l0; Return {| hashmap_HashMap_num_entries := self.(hashmap_HashMap_num_entries); @@ -612,8 +612,8 @@ Definition hashmap_HashMap_remove_back l0 <- hashmap_HashMap_remove_from_list_back T n key l; v <- alloc_vec_Vec_index_mut_back (hashmap_List_t T) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (hashmap_List_t - T)) self.(hashmap_HashMap_slots) hash_mod l0; + (core_slice_index_SliceIndexUsizeSliceTInst (hashmap_List_t T)) + self.(hashmap_HashMap_slots) hash_mod l0; Return {| hashmap_HashMap_num_entries := i0; diff --git a/tests/coq/hashmap_on_disk/Primitives.v b/tests/coq/hashmap_on_disk/Primitives.v index 85e38f01..83f860b6 100644 --- a/tests/coq/hashmap_on_disk/Primitives.v +++ b/tests/coq/hashmap_on_disk/Primitives.v @@ -467,14 +467,14 @@ Definition alloc_boxed_Box_deref_mut (T : Type) (x : T) : result T := Return x. Definition alloc_boxed_Box_deref_mut_back (T : Type) (_ : T) (x : T) : result T := Return x. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| +Definition alloc_boxed_Box_coreopsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| core_ops_deref_Deref_target := Self; core_ops_deref_Deref_deref := alloc_boxed_Box_deref Self; |}. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| - core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreOpsDerefInst Self; +Definition alloc_boxed_Box_coreopsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| + core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreopsDerefInst Self; core_ops_deref_DerefMut_deref_mut := alloc_boxed_Box_deref_mut Self; core_ops_deref_DerefMut_deref_mut_back := alloc_boxed_Box_deref_mut_back Self; |}. @@ -576,7 +576,7 @@ Definition alloc_vec_Vec_insert (T: Type) (v: alloc_vec_Vec T) (i: usize) (x: T) else Fail_ Failure). (* Helper *) -Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result T. +Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize), result T. (* Helper *) Axiom alloc_vec_Vec_update_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result (alloc_vec_Vec T). @@ -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 *) @@ -683,44 +683,44 @@ Axiom core_array_Array_index_mut_back : forall (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) (a : array T N) (i : Idx) (x : inst.(core_ops_index_IndexMut_indexInst).(core_ops_index_Index_Output)), result (array T N). -(* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexInst (T Idx : Type) - (inst : core_slice_index_SliceIndex Idx (slice T)) : - core_ops_index_Index (slice T) Idx := {| - core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); - core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; -|}. - (* Trait implementation: [core::slice::index::private_slice_index::Range] *) -Definition core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedRangeUsizeInst : core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) := tt. (* Trait implementation: [core::slice::index::Range] *) -Definition core_slice_index_Range_coresliceindexSliceIndexInst (T : Type) : +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_Range_coresliceindexprivate_slice_indexSealedInst; + 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]] *) +Definition core_ops_index_IndexSliceTIInst (T Idx : Type) + (inst : core_slice_index_SliceIndex Idx (slice T)) : + core_ops_index_Index (slice T) Idx := {| + core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); + core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; |}. (* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexMutInst (T Idx : Type) +Definition core_ops_index_IndexMutSliceTIInst (T Idx : Type) (inst : core_slice_index_SliceIndex Idx (slice T)) : core_ops_index_IndexMut (slice T) Idx := {| - core_ops_index_IndexMut_indexInst := core_slice_index_Slice_coreopsindexIndexInst T Idx inst; + core_ops_index_IndexMut_indexInst := core_ops_index_IndexSliceTIInst T Idx inst; core_ops_index_IndexMut_index_mut := core_slice_index_Slice_index_mut T Idx inst; core_ops_index_IndexMut_index_mut_back := core_slice_index_Slice_index_mut_back T Idx inst; |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_Index (slice T) Idx) : core_ops_index_Index (array T N) Idx := {| core_ops_index_Index_Output := inst.(core_ops_index_Index_Output); @@ -728,10 +728,10 @@ Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexMutInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexMutArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) : core_ops_index_IndexMut (array T N) Idx := {| - core_ops_index_IndexMut_indexInst := core_array_Array_coreopsindexIndexInst T Idx N inst.(core_ops_index_IndexMut_indexInst); + core_ops_index_IndexMut_indexInst := core_ops_index_IndexArrayInst T Idx N inst.(core_ops_index_IndexMut_indexInst); core_ops_index_IndexMut_index_mut := core_array_Array_index_mut T Idx N inst; core_ops_index_IndexMut_index_mut_back := core_array_Array_index_mut_back T Idx N inst; |}. @@ -765,13 +765,13 @@ Axiom core_slice_index_usize_index_mut_back : forall (T : Type), usize -> slice T -> T -> result (slice T). (* Trait implementation: [core::slice::index::private_slice_index::usize] *) -Definition core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedUsizeInst : core_slice_index_private_slice_index_Sealed usize := tt. (* Trait implementation: [core::slice::index::usize] *) -Definition core_slice_index_usize_coresliceindexSliceIndexInst (T : Type) : +Definition core_slice_index_SliceIndexUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex usize (slice T) := {| - core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst; + core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedUsizeInst; core_slice_index_SliceIndex_Output := T; core_slice_index_SliceIndex_get := core_slice_index_usize_get T; core_slice_index_SliceIndex_get_mut := core_slice_index_usize_get_mut T; @@ -815,8 +815,16 @@ Definition alloc_vec_Vec_coreopsindexIndexMutInst (T Idx : Type) (*** Theorems *) +Axiom alloc_vec_Vec_index_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + +Axiom alloc_vec_Vec_index_mut_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + Axiom alloc_vec_Vec_index_mut_back_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), - alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x = + alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x = alloc_vec_Vec_update_usize v i x. End Primitives. diff --git a/tests/coq/misc/Constants.v b/tests/coq/misc/Constants.v index 03653f69..1f2ab812 100644 --- a/tests/coq/misc/Constants.v +++ b/tests/coq/misc/Constants.v @@ -68,7 +68,7 @@ Record Wrap_t (T : Type) := mkWrap_t { wrap_value : T; }. Arguments mkWrap_t { _ }. Arguments wrap_value { _ }. -(** [constants::Wrap::{0}::new]: forward function *) +(** [constants::{constants::Wrap}::new]: forward function *) Definition wrap_new (T : Type) (value : T) : result (Wrap_t T) := Return {| wrap_value := value |} . diff --git a/tests/coq/misc/External_Opaque.v b/tests/coq/misc/External_Opaque.v index 80be37e7..10c05583 100644 --- a/tests/coq/misc/External_Opaque.v +++ b/tests/coq/misc/External_Opaque.v @@ -25,12 +25,12 @@ Axiom core_mem_swap_back1 : forall(T : Type), T -> T -> state -> state -> result (state * T) . -(** [core::num::nonzero::NonZeroU32::{14}::new]: forward function *) +(** [core::num::nonzero::{core::num::nonzero::NonZeroU32#14}::new]: forward function *) Axiom core_num_nonzero_NonZeroU32_new : u32 -> state -> result (state * (option core_num_nonzero_NonZeroU32_t)) . -(** [core::option::Option::{0}::unwrap]: forward function *) +(** [core::option::{core::option::Option}::unwrap]: forward function *) Axiom core_option_Option_unwrap : forall(T : Type), option T -> state -> result (state * T) . diff --git a/tests/coq/misc/Loops.v b/tests/coq/misc/Loops.v index 1c0eab17..e5ff6c8e 100644 --- a/tests/coq/misc/Loops.v +++ b/tests/coq/misc/Loops.v @@ -77,7 +77,7 @@ Fixpoint clear_loop i1 <- usize_add i 1%usize; v0 <- alloc_vec_Vec_index_mut_back u32 usize - (core_slice_index_usize_coresliceindexSliceIndexInst u32) v i 0%u32; + (core_slice_index_SliceIndexUsizeSliceTInst u32) v i 0%u32; clear_loop n0 v0 i1) else Return v end @@ -209,8 +209,7 @@ Definition get_elem_mut := l <- alloc_vec_Vec_index_mut (List_t usize) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t usize)) - slots 0%usize; + (core_slice_index_SliceIndexUsizeSliceTInst (List_t usize)) slots 0%usize; get_elem_mut_loop n x l . @@ -240,12 +239,11 @@ Definition get_elem_mut_back := l <- alloc_vec_Vec_index_mut (List_t usize) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t usize)) - slots 0%usize; + (core_slice_index_SliceIndexUsizeSliceTInst (List_t usize)) slots 0%usize; l0 <- get_elem_mut_loop_back n x l ret; alloc_vec_Vec_index_mut_back (List_t usize) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t usize)) slots - 0%usize l0 + (core_slice_index_SliceIndexUsizeSliceTInst (List_t usize)) slots 0%usize + l0 . (** [loops::get_elem_shared]: loop 0: forward function *) @@ -269,8 +267,7 @@ Definition get_elem_shared := l <- alloc_vec_Vec_index (List_t usize) usize - (core_slice_index_usize_coresliceindexSliceIndexInst (List_t usize)) - slots 0%usize; + (core_slice_index_SliceIndexUsizeSliceTInst (List_t usize)) slots 0%usize; get_elem_shared_loop n x l . diff --git a/tests/coq/misc/NoNestedBorrows.v b/tests/coq/misc/NoNestedBorrows.v index c7af496f..376e722c 100644 --- a/tests/coq/misc/NoNestedBorrows.v +++ b/tests/coq/misc/NoNestedBorrows.v @@ -151,8 +151,9 @@ Check (test_list1 )%return. (** [no_nested_borrows::test_box1]: forward function *) Definition test_box1 : result unit := - let b := 1%i32 in - let x := b in + let b := 0%i32 in + b0 <- alloc_boxed_Box_deref_mut_back i32 b 1%i32; + x <- alloc_boxed_Box_deref i32 b0; if negb (x s= 1%i32) then Fail_ Failure else Return tt . diff --git a/tests/coq/misc/Primitives.v b/tests/coq/misc/Primitives.v index 85e38f01..83f860b6 100644 --- a/tests/coq/misc/Primitives.v +++ b/tests/coq/misc/Primitives.v @@ -467,14 +467,14 @@ Definition alloc_boxed_Box_deref_mut (T : Type) (x : T) : result T := Return x. Definition alloc_boxed_Box_deref_mut_back (T : Type) (_ : T) (x : T) : result T := Return x. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| +Definition alloc_boxed_Box_coreopsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| core_ops_deref_Deref_target := Self; core_ops_deref_Deref_deref := alloc_boxed_Box_deref Self; |}. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| - core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreOpsDerefInst Self; +Definition alloc_boxed_Box_coreopsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| + core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreopsDerefInst Self; core_ops_deref_DerefMut_deref_mut := alloc_boxed_Box_deref_mut Self; core_ops_deref_DerefMut_deref_mut_back := alloc_boxed_Box_deref_mut_back Self; |}. @@ -576,7 +576,7 @@ Definition alloc_vec_Vec_insert (T: Type) (v: alloc_vec_Vec T) (i: usize) (x: T) else Fail_ Failure). (* Helper *) -Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result T. +Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize), result T. (* Helper *) Axiom alloc_vec_Vec_update_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result (alloc_vec_Vec T). @@ -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 *) @@ -683,44 +683,44 @@ Axiom core_array_Array_index_mut_back : forall (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) (a : array T N) (i : Idx) (x : inst.(core_ops_index_IndexMut_indexInst).(core_ops_index_Index_Output)), result (array T N). -(* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexInst (T Idx : Type) - (inst : core_slice_index_SliceIndex Idx (slice T)) : - core_ops_index_Index (slice T) Idx := {| - core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); - core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; -|}. - (* Trait implementation: [core::slice::index::private_slice_index::Range] *) -Definition core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedRangeUsizeInst : core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) := tt. (* Trait implementation: [core::slice::index::Range] *) -Definition core_slice_index_Range_coresliceindexSliceIndexInst (T : Type) : +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_Range_coresliceindexprivate_slice_indexSealedInst; + 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]] *) +Definition core_ops_index_IndexSliceTIInst (T Idx : Type) + (inst : core_slice_index_SliceIndex Idx (slice T)) : + core_ops_index_Index (slice T) Idx := {| + core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); + core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; |}. (* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexMutInst (T Idx : Type) +Definition core_ops_index_IndexMutSliceTIInst (T Idx : Type) (inst : core_slice_index_SliceIndex Idx (slice T)) : core_ops_index_IndexMut (slice T) Idx := {| - core_ops_index_IndexMut_indexInst := core_slice_index_Slice_coreopsindexIndexInst T Idx inst; + core_ops_index_IndexMut_indexInst := core_ops_index_IndexSliceTIInst T Idx inst; core_ops_index_IndexMut_index_mut := core_slice_index_Slice_index_mut T Idx inst; core_ops_index_IndexMut_index_mut_back := core_slice_index_Slice_index_mut_back T Idx inst; |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_Index (slice T) Idx) : core_ops_index_Index (array T N) Idx := {| core_ops_index_Index_Output := inst.(core_ops_index_Index_Output); @@ -728,10 +728,10 @@ Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexMutInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexMutArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) : core_ops_index_IndexMut (array T N) Idx := {| - core_ops_index_IndexMut_indexInst := core_array_Array_coreopsindexIndexInst T Idx N inst.(core_ops_index_IndexMut_indexInst); + core_ops_index_IndexMut_indexInst := core_ops_index_IndexArrayInst T Idx N inst.(core_ops_index_IndexMut_indexInst); core_ops_index_IndexMut_index_mut := core_array_Array_index_mut T Idx N inst; core_ops_index_IndexMut_index_mut_back := core_array_Array_index_mut_back T Idx N inst; |}. @@ -765,13 +765,13 @@ Axiom core_slice_index_usize_index_mut_back : forall (T : Type), usize -> slice T -> T -> result (slice T). (* Trait implementation: [core::slice::index::private_slice_index::usize] *) -Definition core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedUsizeInst : core_slice_index_private_slice_index_Sealed usize := tt. (* Trait implementation: [core::slice::index::usize] *) -Definition core_slice_index_usize_coresliceindexSliceIndexInst (T : Type) : +Definition core_slice_index_SliceIndexUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex usize (slice T) := {| - core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst; + core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedUsizeInst; core_slice_index_SliceIndex_Output := T; core_slice_index_SliceIndex_get := core_slice_index_usize_get T; core_slice_index_SliceIndex_get_mut := core_slice_index_usize_get_mut T; @@ -815,8 +815,16 @@ Definition alloc_vec_Vec_coreopsindexIndexMutInst (T Idx : Type) (*** Theorems *) +Axiom alloc_vec_Vec_index_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + +Axiom alloc_vec_Vec_index_mut_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + Axiom alloc_vec_Vec_index_mut_back_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), - alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x = + alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x = alloc_vec_Vec_update_usize v i x. End Primitives. diff --git a/tests/coq/traits/Primitives.v b/tests/coq/traits/Primitives.v index 85e38f01..83f860b6 100644 --- a/tests/coq/traits/Primitives.v +++ b/tests/coq/traits/Primitives.v @@ -467,14 +467,14 @@ Definition alloc_boxed_Box_deref_mut (T : Type) (x : T) : result T := Return x. Definition alloc_boxed_Box_deref_mut_back (T : Type) (_ : T) (x : T) : result T := Return x. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| +Definition alloc_boxed_Box_coreopsDerefInst (Self : Type) : core_ops_deref_Deref Self := {| core_ops_deref_Deref_target := Self; core_ops_deref_Deref_deref := alloc_boxed_Box_deref Self; |}. (* Trait instance *) -Definition alloc_boxed_Box_coreOpsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| - core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreOpsDerefInst Self; +Definition alloc_boxed_Box_coreopsDerefMutInst (Self : Type) : core_ops_deref_DerefMut Self := {| + core_ops_deref_DerefMut_derefInst := alloc_boxed_Box_coreopsDerefInst Self; core_ops_deref_DerefMut_deref_mut := alloc_boxed_Box_deref_mut Self; core_ops_deref_DerefMut_deref_mut_back := alloc_boxed_Box_deref_mut_back Self; |}. @@ -576,7 +576,7 @@ Definition alloc_vec_Vec_insert (T: Type) (v: alloc_vec_Vec T) (i: usize) (x: T) else Fail_ Failure). (* Helper *) -Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result T. +Axiom alloc_vec_Vec_index_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize), result T. (* Helper *) Axiom alloc_vec_Vec_update_usize : forall {T : Type} (v : alloc_vec_Vec T) (i : usize) (x : T), result (alloc_vec_Vec T). @@ -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 *) @@ -683,44 +683,44 @@ Axiom core_array_Array_index_mut_back : forall (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) (a : array T N) (i : Idx) (x : inst.(core_ops_index_IndexMut_indexInst).(core_ops_index_Index_Output)), result (array T N). -(* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexInst (T Idx : Type) - (inst : core_slice_index_SliceIndex Idx (slice T)) : - core_ops_index_Index (slice T) Idx := {| - core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); - core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; -|}. - (* Trait implementation: [core::slice::index::private_slice_index::Range] *) -Definition core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedRangeUsizeInst : core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) := tt. (* Trait implementation: [core::slice::index::Range] *) -Definition core_slice_index_Range_coresliceindexSliceIndexInst (T : Type) : +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_Range_coresliceindexprivate_slice_indexSealedInst; + 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]] *) +Definition core_ops_index_IndexSliceTIInst (T Idx : Type) + (inst : core_slice_index_SliceIndex Idx (slice T)) : + core_ops_index_Index (slice T) Idx := {| + core_ops_index_Index_Output := inst.(core_slice_index_SliceIndex_Output); + core_ops_index_Index_index := core_slice_index_Slice_index T Idx inst; |}. (* Trait implementation: [core::slice::index::[T]] *) -Definition core_slice_index_Slice_coreopsindexIndexMutInst (T Idx : Type) +Definition core_ops_index_IndexMutSliceTIInst (T Idx : Type) (inst : core_slice_index_SliceIndex Idx (slice T)) : core_ops_index_IndexMut (slice T) Idx := {| - core_ops_index_IndexMut_indexInst := core_slice_index_Slice_coreopsindexIndexInst T Idx inst; + core_ops_index_IndexMut_indexInst := core_ops_index_IndexSliceTIInst T Idx inst; core_ops_index_IndexMut_index_mut := core_slice_index_Slice_index_mut T Idx inst; core_ops_index_IndexMut_index_mut_back := core_slice_index_Slice_index_mut_back T Idx inst; |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_Index (slice T) Idx) : core_ops_index_Index (array T N) Idx := {| core_ops_index_Index_Output := inst.(core_ops_index_Index_Output); @@ -728,10 +728,10 @@ Definition core_array_Array_coreopsindexIndexInst (T Idx : Type) (N : usize) |}. (* Trait implementation: [core::array::[T; N]] *) -Definition core_array_Array_coreopsindexIndexMutInst (T Idx : Type) (N : usize) +Definition core_ops_index_IndexMutArrayInst (T Idx : Type) (N : usize) (inst : core_ops_index_IndexMut (slice T) Idx) : core_ops_index_IndexMut (array T N) Idx := {| - core_ops_index_IndexMut_indexInst := core_array_Array_coreopsindexIndexInst T Idx N inst.(core_ops_index_IndexMut_indexInst); + core_ops_index_IndexMut_indexInst := core_ops_index_IndexArrayInst T Idx N inst.(core_ops_index_IndexMut_indexInst); core_ops_index_IndexMut_index_mut := core_array_Array_index_mut T Idx N inst; core_ops_index_IndexMut_index_mut_back := core_array_Array_index_mut_back T Idx N inst; |}. @@ -765,13 +765,13 @@ Axiom core_slice_index_usize_index_mut_back : forall (T : Type), usize -> slice T -> T -> result (slice T). (* Trait implementation: [core::slice::index::private_slice_index::usize] *) -Definition core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst +Definition core_slice_index_private_slice_index_SealedUsizeInst : core_slice_index_private_slice_index_Sealed usize := tt. (* Trait implementation: [core::slice::index::usize] *) -Definition core_slice_index_usize_coresliceindexSliceIndexInst (T : Type) : +Definition core_slice_index_SliceIndexUsizeSliceTInst (T : Type) : core_slice_index_SliceIndex usize (slice T) := {| - core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst; + core_slice_index_SliceIndex_sealedInst := core_slice_index_private_slice_index_SealedUsizeInst; core_slice_index_SliceIndex_Output := T; core_slice_index_SliceIndex_get := core_slice_index_usize_get T; core_slice_index_SliceIndex_get_mut := core_slice_index_usize_get_mut T; @@ -815,8 +815,16 @@ Definition alloc_vec_Vec_coreopsindexIndexMutInst (T Idx : Type) (*** Theorems *) +Axiom alloc_vec_Vec_index_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + +Axiom alloc_vec_Vec_index_mut_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), + alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i = + alloc_vec_Vec_index_usize v i. + Axiom alloc_vec_Vec_index_mut_back_eq : forall {a : Type} (v : alloc_vec_Vec a) (i : usize) (x : a), - alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x = + alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x = alloc_vec_Vec_update_usize v i x. End Primitives. -- cgit v1.2.3