summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorSon HO2023-11-22 15:06:43 +0100
committerGitHub2023-11-22 15:06:43 +0100
commitbacf3f5f6f5f6a9aa650d5ae8d12a132fd747039 (patch)
tree9953d7af1fe406cdc750030a43a5e4d6245cd763 /backends
parent587f1ebc0178acb19029d3fc9a729c197082aba7 (diff)
parent01cfd899119174ef7c5941c99dd251711f4ee701 (diff)
Merge pull request #45 from AeneasVerif/son_merge_types
Big cleanup
Diffstat (limited to '')
-rw-r--r--backends/coq/Primitives.v88
-rw-r--r--backends/fstar/Primitives.fst88
-rw-r--r--backends/lean/Base/Primitives/Alloc.lean6
-rw-r--r--backends/lean/Base/Primitives/ArraySlice.lean71
-rw-r--r--backends/lean/Base/Primitives/Vec.lean6
5 files changed, 133 insertions, 126 deletions
diff --git a/backends/coq/Primitives.v b/backends/coq/Primitives.v
index 85e38f01..83f860b6 100644
--- a/backends/coq/Primitives.v
+++ b/backends/coq/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/backends/fstar/Primitives.fst b/backends/fstar/Primitives.fst
index 3297803c..94322ead 100644
--- a/backends/fstar/Primitives.fst
+++ b/backends/fstar/Primitives.fst
@@ -351,14 +351,14 @@ let alloc_boxed_Box_deref_mut (t : Type0) (x : t) : result t = Return x
let alloc_boxed_Box_deref_mut_back (t : Type) (_ : t) (x : t) : result t = Return x
// Trait instance
-let alloc_boxed_Box_coreOpsDerefInst (self : Type0) : core_ops_deref_Deref self = {
+let alloc_boxed_Box_coreopsDerefInst (self : Type0) : core_ops_deref_Deref self = {
target = self;
deref = alloc_boxed_Box_deref self;
}
// Trait instance
-let alloc_boxed_Box_coreOpsDerefMutInst (self : Type0) : core_ops_deref_DerefMut self = {
- derefInst = alloc_boxed_Box_coreOpsDerefInst self;
+let alloc_boxed_Box_coreopsDerefMutInst (self : Type0) : core_ops_deref_DerefMut self = {
+ derefInst = alloc_boxed_Box_coreopsDerefInst self;
deref_mut = alloc_boxed_Box_deref_mut self;
deref_mut_back = alloc_boxed_Box_deref_mut_back self;
}
@@ -483,23 +483,23 @@ let core_slice_index_Slice_index
| Some x -> Return x
// [core::slice::index::Range:::get]: forward function
-let core_slice_index_Range_get (t : Type0) (i : core_ops_range_Range usize) (s : slice t) :
+let core_slice_index_RangeUsize_get (t : Type0) (i : core_ops_range_Range usize) (s : slice t) :
result (option (slice t)) =
admit () // TODO
// [core::slice::index::Range::get_mut]: forward function
-let core_slice_index_Range_get_mut
+let core_slice_index_RangeUsize_get_mut
(t : Type0) : core_ops_range_Range usize → slice t → result (option (slice t)) =
admit () // TODO
// [core::slice::index::Range::get_mut]: backward function 0
-let core_slice_index_Range_get_mut_back
+let core_slice_index_RangeUsize_get_mut_back
(t : Type0) :
core_ops_range_Range usize → slice t → option (slice t) → result (slice t) =
admit () // TODO
// [core::slice::index::Range::get_unchecked]: forward function
-let core_slice_index_Range_get_unchecked
+let core_slice_index_RangeUsize_get_unchecked
(t : Type0) :
core_ops_range_Range usize → const_raw_ptr (slice t) → result (const_raw_ptr (slice t)) =
// Don't know what the model should be - for now we always fail to make
@@ -507,7 +507,7 @@ let core_slice_index_Range_get_unchecked
fun _ _ -> Fail Failure
// [core::slice::index::Range::get_unchecked_mut]: forward function
-let core_slice_index_Range_get_unchecked_mut
+let core_slice_index_RangeUsize_get_unchecked_mut
(t : Type0) :
core_ops_range_Range usize → mut_raw_ptr (slice t) → result (mut_raw_ptr (slice t)) =
// Don't know what the model should be - for now we always fail to make
@@ -515,17 +515,17 @@ let core_slice_index_Range_get_unchecked_mut
fun _ _ -> Fail Failure
// [core::slice::index::Range::index]: forward function
-let core_slice_index_Range_index
+let core_slice_index_RangeUsize_index
(t : Type0) : core_ops_range_Range usize → slice t → result (slice t) =
admit () // TODO
// [core::slice::index::Range::index_mut]: forward function
-let core_slice_index_Range_index_mut
+let core_slice_index_RangeUsize_index_mut
(t : Type0) : core_ops_range_Range usize → slice t → result (slice t) =
admit () // TODO
// [core::slice::index::Range::index_mut]: backward function 0
-let core_slice_index_Range_index_mut_back
+let core_slice_index_RangeUsize_index_mut_back
(t : Type0) : core_ops_range_Range usize → slice t → slice t → result (slice t) =
admit () // TODO
@@ -559,44 +559,44 @@ let core_array_Array_index_mut_back
(a : array t n) (i : idx) (x : inst.indexInst.output) : result (array t n) =
admit () // TODO
-// Trait implementation: [core::slice::index::[T]]
-let core_slice_index_Slice_coreopsindexIndexInst (t idx : Type0)
- (inst : core_slice_index_SliceIndex idx (slice t)) :
- core_ops_index_Index (slice t) idx = {
- output = inst.output;
- index = core_slice_index_Slice_index t idx inst;
-}
-
// Trait implementation: [core::slice::index::private_slice_index::Range]
-let core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst
+let core_slice_index_private_slice_index_SealedRangeUsizeInst
: core_slice_index_private_slice_index_Sealed (core_ops_range_Range usize) = ()
// Trait implementation: [core::slice::index::Range]
-let core_slice_index_Range_coresliceindexSliceIndexInst (t : Type0) :
+let core_slice_index_SliceIndexRangeUsizeSliceTInst (t : Type0) :
core_slice_index_SliceIndex (core_ops_range_Range usize) (slice t) = {
- sealedInst = core_slice_index_private_slice_index_Range_coresliceindexprivate_slice_indexSealedInst;
+ sealedInst = core_slice_index_private_slice_index_SealedRangeUsizeInst;
output = slice t;
- get = core_slice_index_Range_get t;
- get_mut = core_slice_index_Range_get_mut t;
- get_mut_back = core_slice_index_Range_get_mut_back t;
- get_unchecked = core_slice_index_Range_get_unchecked t;
- get_unchecked_mut = core_slice_index_Range_get_unchecked_mut t;
- index = core_slice_index_Range_index t;
- index_mut = core_slice_index_Range_index_mut t;
- index_mut_back = core_slice_index_Range_index_mut_back t;
+ get = core_slice_index_RangeUsize_get t;
+ get_mut = core_slice_index_RangeUsize_get_mut t;
+ get_mut_back = core_slice_index_RangeUsize_get_mut_back t;
+ get_unchecked = core_slice_index_RangeUsize_get_unchecked t;
+ get_unchecked_mut = core_slice_index_RangeUsize_get_unchecked_mut t;
+ index = core_slice_index_RangeUsize_index t;
+ index_mut = core_slice_index_RangeUsize_index_mut t;
+ index_mut_back = core_slice_index_RangeUsize_index_mut_back t;
+}
+
+// Trait implementation: [core::slice::index::[T]]
+let core_ops_index_IndexSliceTIInst (t idx : Type0)
+ (inst : core_slice_index_SliceIndex idx (slice t)) :
+ core_ops_index_Index (slice t) idx = {
+ output = inst.output;
+ index = core_slice_index_Slice_index t idx inst;
}
// Trait implementation: [core::slice::index::[T]]
-let core_slice_index_Slice_coreopsindexIndexMutInst (t idx : Type0)
+let core_ops_index_IndexMutSliceTIInst (t idx : Type0)
(inst : core_slice_index_SliceIndex idx (slice t)) :
core_ops_index_IndexMut (slice t) idx = {
- indexInst = core_slice_index_Slice_coreopsindexIndexInst t idx inst;
+ indexInst = core_ops_index_IndexSliceTIInst t idx inst;
index_mut = core_slice_index_Slice_index_mut t idx inst;
index_mut_back = core_slice_index_Slice_index_mut_back t idx inst;
}
// Trait implementation: [core::array::[T; N]]
-let core_array_Array_coreopsindexIndexInst (t idx : Type0) (n : usize)
+let core_ops_index_IndexArrayInst (t idx : Type0) (n : usize)
(inst : core_ops_index_Index (slice t) idx) :
core_ops_index_Index (array t n) idx = {
output = inst.output;
@@ -604,10 +604,10 @@ let core_array_Array_coreopsindexIndexInst (t idx : Type0) (n : usize)
}
// Trait implementation: [core::array::[T; N]]
-let core_array_Array_coreopsindexIndexMutInst (t idx : Type0) (n : usize)
+let core_ops_index_IndexMutArrayIInst (t idx : Type0) (n : usize)
(inst : core_ops_index_IndexMut (slice t) idx) :
core_ops_index_IndexMut (array t n) idx = {
- indexInst = core_array_Array_coreopsindexIndexInst t idx n inst.indexInst;
+ indexInst = core_ops_index_IndexArrayInst t idx n inst.indexInst;
index_mut = core_array_Array_index_mut t idx n inst;
index_mut_back = core_array_Array_index_mut_back t idx n inst;
}
@@ -651,13 +651,13 @@ let core_slice_index_usize_index_mut_back
admit () // TODO
// Trait implementation: [core::slice::index::private_slice_index::usize]
-let core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst
+let core_slice_index_private_slice_index_SealedUsizeInst
: core_slice_index_private_slice_index_Sealed usize = ()
// Trait implementation: [core::slice::index::usize]
-let core_slice_index_usize_coresliceindexSliceIndexInst (t : Type0) :
+let core_slice_index_SliceIndexUsizeSliceTInst (t : Type0) :
core_slice_index_SliceIndex usize (slice t) = {
- sealedInst = core_slice_index_private_slice_index_usize_coresliceindexprivate_slice_indexSealedInst;
+ sealedInst = core_slice_index_private_slice_index_SealedUsizeInst;
output = t;
get = core_slice_index_usize_get t;
get_mut = core_slice_index_usize_get_mut t;
@@ -706,24 +706,24 @@ let alloc_vec_Vec_coreopsindexIndexMutInst (t idx : Type0)
let alloc_vec_Vec_index_eq (#a : Type0) (v : alloc_vec_Vec a) (i : usize) :
Lemma (
- alloc_vec_Vec_index a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i ==
+ alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i ==
alloc_vec_Vec_index_usize v i)
- [SMTPat (alloc_vec_Vec_index a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i)]
+ [SMTPat (alloc_vec_Vec_index a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i)]
=
admit()
let alloc_vec_Vec_index_mut_eq (#a : Type0) (v : alloc_vec_Vec a) (i : usize) :
Lemma (
- alloc_vec_Vec_index_mut a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i ==
+ alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i ==
alloc_vec_Vec_index_usize v i)
- [SMTPat (alloc_vec_Vec_index_mut a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i)]
+ [SMTPat (alloc_vec_Vec_index_mut a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i)]
=
admit()
let alloc_vec_Vec_index_mut_back_eq (#a : Type0) (v : alloc_vec_Vec a) (i : usize) (x : a) :
Lemma (
- 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)
- [SMTPat (alloc_vec_Vec_index_mut_back a usize (core_slice_index_usize_coresliceindexSliceIndexInst a) v i x)]
+ [SMTPat (alloc_vec_Vec_index_mut_back a usize (core_slice_index_SliceIndexUsizeSliceTInst a) v i x)]
=
admit()
diff --git a/backends/lean/Base/Primitives/Alloc.lean b/backends/lean/Base/Primitives/Alloc.lean
index 34590499..6c89c6bb 100644
--- a/backends/lean/Base/Primitives/Alloc.lean
+++ b/backends/lean/Base/Primitives/Alloc.lean
@@ -16,16 +16,16 @@ def deref_mut (T : Type) (x : T) : Result T := ret x
def deref_mut_back (T : Type) (_ : T) (x : T) : Result T := ret x
/-- Trait instance -/
-def coreOpsDerefInst (Self : Type) :
+def coreopsDerefInst (Self : Type) :
core.ops.deref.Deref Self := {
Target := Self
deref := deref Self
}
/-- Trait instance -/
-def coreOpsDerefMutInst (Self : Type) :
+def coreopsDerefMutInst (Self : Type) :
core.ops.deref.DerefMut Self := {
- derefInst := coreOpsDerefInst Self
+ derefInst := coreopsDerefInst Self
deref_mut := deref_mut Self
deref_mut_back := deref_mut_back Self
}
diff --git a/backends/lean/Base/Primitives/ArraySlice.lean b/backends/lean/Base/Primitives/ArraySlice.lean
index cfc9a6b2..f68c0846 100644
--- a/backends/lean/Base/Primitives/ArraySlice.lean
+++ b/backends/lean/Base/Primitives/ArraySlice.lean
@@ -363,23 +363,23 @@ def core.slice.index.Slice.index
| some x => ret x
/- [core::slice::index::Range:::get]: forward function -/
-def core.slice.index.Range.get (T : Type) (i : Range Usize) (slice : Slice T) :
+def core.slice.index.RangeUsize.get (T : Type) (i : Range Usize) (slice : Slice T) :
Result (Option (Slice T)) :=
sorry -- TODO
/- [core::slice::index::Range::get_mut]: forward function -/
-def core.slice.index.Range.get_mut
+def core.slice.index.RangeUsize.get_mut
(T : Type) : Range Usize → Slice T → Result (Option (Slice T)) :=
sorry -- TODO
/- [core::slice::index::Range::get_mut]: backward function 0 -/
-def core.slice.index.Range.get_mut_back
+def core.slice.index.RangeUsize.get_mut_back
(T : Type) :
Range Usize → Slice T → Option (Slice T) → Result (Slice T) :=
sorry -- TODO
/- [core::slice::index::Range::get_unchecked]: forward function -/
-def core.slice.index.Range.get_unchecked
+def core.slice.index.RangeUsize.get_unchecked
(T : Type) :
Range Usize → ConstRawPtr (Slice T) → Result (ConstRawPtr (Slice T)) :=
-- Don't know what the model should be - for now we always fail to make
@@ -387,7 +387,7 @@ def core.slice.index.Range.get_unchecked
fun _ _ => fail panic
/- [core::slice::index::Range::get_unchecked_mut]: forward function -/
-def core.slice.index.Range.get_unchecked_mut
+def core.slice.index.RangeUsize.get_unchecked_mut
(T : Type) :
Range Usize → MutRawPtr (Slice T) → Result (MutRawPtr (Slice T)) :=
-- Don't know what the model should be - for now we always fail to make
@@ -395,17 +395,17 @@ def core.slice.index.Range.get_unchecked_mut
fun _ _ => fail panic
/- [core::slice::index::Range::index]: forward function -/
-def core.slice.index.Range.index
+def core.slice.index.RangeUsize.index
(T : Type) : Range Usize → Slice T → Result (Slice T) :=
sorry -- TODO
/- [core::slice::index::Range::index_mut]: forward function -/
-def core.slice.index.Range.index_mut
+def core.slice.index.RangeUsize.index_mut
(T : Type) : Range Usize → Slice T → Result (Slice T) :=
sorry -- TODO
/- [core::slice::index::Range::index_mut]: backward function 0 -/
-def core.slice.index.Range.index_mut_back
+def core.slice.index.RangeUsize.index_mut_back
(T : Type) : Range Usize → Slice T → Slice T → Result (Slice T) :=
sorry -- TODO
@@ -439,45 +439,44 @@ def core.array.Array.index_mut_back
(a : Array T N) (i : I) (x : inst.indexInst.Output) : Result (Array T N) :=
sorry -- TODO
-/- Trait implementation: [core::slice::index::[T]] -/
-def core.slice.index.Slice.coreopsindexIndexInst (T I : Type)
- (inst : core.slice.index.SliceIndex I (Slice T)) :
- core.ops.index.Index (Slice T) I := {
- Output := inst.Output
- index := core.slice.index.Slice.index T I inst
-}
-
/- Trait implementation: [core::slice::index::private_slice_index::Range] -/
-def core.slice.index.private_slice_index.Range.coresliceindexprivate_slice_indexSealedInst
+def core.slice.index.private_slice_index.SealedRangeUsizeInst
: core.slice.index.private_slice_index.Sealed (Range Usize) := {}
/- Trait implementation: [core::slice::index::Range] -/
-def core.slice.index.Range.coresliceindexSliceIndexInst (T : Type) :
+def core.slice.index.SliceIndexRangeUsizeSliceTInst (T : Type) :
core.slice.index.SliceIndex (Range Usize) (Slice T) := {
- sealedInst :=
- core.slice.index.private_slice_index.Range.coresliceindexprivate_slice_indexSealedInst
+ sealedInst := core.slice.index.private_slice_index.SealedRangeUsizeInst
Output := Slice T
- get := core.slice.index.Range.get T
- get_mut := core.slice.index.Range.get_mut T
- get_mut_back := core.slice.index.Range.get_mut_back T
- get_unchecked := core.slice.index.Range.get_unchecked T
- get_unchecked_mut := core.slice.index.Range.get_unchecked_mut T
- index := core.slice.index.Range.index T
- index_mut := core.slice.index.Range.index_mut T
- index_mut_back := core.slice.index.Range.index_mut_back T
+ get := core.slice.index.RangeUsize.get T
+ get_mut := core.slice.index.RangeUsize.get_mut T
+ get_mut_back := core.slice.index.RangeUsize.get_mut_back T
+ get_unchecked := core.slice.index.RangeUsize.get_unchecked T
+ get_unchecked_mut := core.slice.index.RangeUsize.get_unchecked_mut T
+ index := core.slice.index.RangeUsize.index T
+ index_mut := core.slice.index.RangeUsize.index_mut T
+ index_mut_back := core.slice.index.RangeUsize.index_mut_back T
+}
+
+/- Trait implementation: [core::slice::index::[T]] -/
+def core.ops.index.IndexSliceTIInst (T I : Type)
+ (inst : core.slice.index.SliceIndex I (Slice T)) :
+ core.ops.index.Index (Slice T) I := {
+ Output := inst.Output
+ index := core.slice.index.Slice.index T I inst
}
/- Trait implementation: [core::slice::index::[T]] -/
-def core.slice.index.Slice.coreopsindexIndexMutInst (T I : Type)
+def core.ops.index.IndexMutSliceTIInst (T I : Type)
(inst : core.slice.index.SliceIndex I (Slice T)) :
core.ops.index.IndexMut (Slice T) I := {
- indexInst := core.slice.index.Slice.coreopsindexIndexInst T I inst
+ indexInst := core.ops.index.IndexSliceTIInst T I inst
index_mut := core.slice.index.Slice.index_mut T I inst
index_mut_back := core.slice.index.Slice.index_mut_back T I inst
}
/- Trait implementation: [core::array::[T; N]] -/
-def core.array.Array.coreopsindexIndexInst (T I : Type) (N : Usize)
+def core.ops.index.IndexArrayIInst (T I : Type) (N : Usize)
(inst : core.ops.index.Index (Slice T) I) :
core.ops.index.Index (Array T N) I := {
Output := inst.Output
@@ -485,10 +484,10 @@ def core.array.Array.coreopsindexIndexInst (T I : Type) (N : Usize)
}
/- Trait implementation: [core::array::[T; N]] -/
-def core.array.Array.coreopsindexIndexMutInst (T I : Type) (N : Usize)
+def core.ops.index.IndexMutArrayIInst (T I : Type) (N : Usize)
(inst : core.ops.index.IndexMut (Slice T) I) :
core.ops.index.IndexMut (Array T N) I := {
- indexInst := core.array.Array.coreopsindexIndexInst T I N inst.indexInst
+ indexInst := core.ops.index.IndexArrayIInst T I N inst.indexInst
index_mut := core.array.Array.index_mut T I N inst
index_mut_back := core.array.Array.index_mut_back T I N inst
}
@@ -532,13 +531,13 @@ def core.slice.index.Usize.index_mut_back
sorry -- TODO
/- Trait implementation: [core::slice::index::private_slice_index::usize] -/
-def core.slice.index.private_slice_index.usize.coresliceindexprivate_slice_indexSealedInst
+def core.slice.index.private_slice_index.SealedUsizeInst
: core.slice.index.private_slice_index.Sealed Usize := {}
/- Trait implementation: [core::slice::index::usize] -/
-def core.slice.index.usize.coresliceindexSliceIndexInst (T : Type) :
+def core.slice.index.SliceIndexUsizeSliceTInst (T : Type) :
core.slice.index.SliceIndex Usize (Slice T) := {
- sealedInst := core.slice.index.private_slice_index.usize.coresliceindexprivate_slice_indexSealedInst
+ sealedInst := core.slice.index.private_slice_index.SealedUsizeInst
Output := T
get := core.slice.index.Usize.get T
get_mut := core.slice.index.Usize.get_mut T
diff --git a/backends/lean/Base/Primitives/Vec.lean b/backends/lean/Base/Primitives/Vec.lean
index bbed6082..e600a151 100644
--- a/backends/lean/Base/Primitives/Vec.lean
+++ b/backends/lean/Base/Primitives/Vec.lean
@@ -153,19 +153,19 @@ def Vec.coreopsindexIndexMutInst (T I : Type)
@[simp]
theorem Vec.index_slice_index {α : Type} (v : Vec α) (i : Usize) :
- Vec.index α Usize (core.slice.index.usize.coresliceindexSliceIndexInst α) v i =
+ Vec.index α Usize (core.slice.index.SliceIndexUsizeSliceTInst α) v i =
Vec.index_usize v i :=
sorry
@[simp]
theorem Vec.index_mut_slice_index {α : Type} (v : Vec α) (i : Usize) :
- Vec.index_mut α Usize (core.slice.index.usize.coresliceindexSliceIndexInst α) v i =
+ Vec.index_mut α Usize (core.slice.index.SliceIndexUsizeSliceTInst α) v i =
Vec.index_usize v i :=
sorry
@[simp]
theorem Vec.index_mut_back_slice_index {α : Type} (v : Vec α) (i : Usize) (x : α) :
- Vec.index_mut_back α Usize (core.slice.index.usize.coresliceindexSliceIndexInst α) v i x =
+ Vec.index_mut_back α Usize (core.slice.index.SliceIndexUsizeSliceTInst α) v i x =
Vec.update_usize v i x :=
sorry