Skip to content

Commit 9eacd04

Browse files
authored
Merge pull request #1273 from cryspen/various-core-additions
Various F* core lib additions.
2 parents dca12c9 + 4e679c3 commit 9eacd04

17 files changed

+72
-18
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
module Alloc.Collections.Btree.Set
2+
open Rust_primitives
23

34
val t_BTreeSet (t:Type0) (u:unit): eqtype
5+
6+
val t_Iter (t:Type0): eqtype
7+
8+
val impl_13__new #t (): t_BTreeSet t ()
9+
10+
val impl_14__len #t #u (x:t_BTreeSet t u) : usize
11+
12+
val impl_14__insert #t #u (x:t_BTreeSet t u) (y:t) : (t_BTreeSet t u & bool)

proof-libs/fstar/core/Alloc.Slice.fsti

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ open Alloc.Vec
44

55
let impl__to_vec #a (s: t_Slice a): t_Vec a Alloc.Alloc.t_Global = s
66

7+
let impl__into_vec #t #a (s: Alloc.Boxed.t_Box (t_Slice t) a): t_Vec t a = s
8+
79
val impl__concat #t1 #t2 (s: t_Slice t1): t_Slice t2

proof-libs/fstar/core/Core.Cmp.fsti

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,46 @@ instance min_inttype (#t:inttype): min_tc (int_t t) = {
99
min = fun a b -> if a <. b then a else b
1010
}
1111

12+
class t_PartialEq (v_Self: Type) (v_Rhs: Type) = {
13+
// __constraint_1069563329_t_PartialEq:t_PartialEq v_Self v_Rhs;
14+
f_eq_pre: v_Self -> v_Rhs -> Type0;
15+
f_eq_post: v_Self -> v_Rhs -> bool -> Type0;
16+
f_eq:v_Self -> v_Rhs -> bool;
17+
}
18+
19+
class t_Eq (v_Self: Type) = {
20+
[@@@FStar.Tactics.Typeclasses.tcresolve]
21+
__constraint_t_Eq_t_PartialEq:t_PartialEq v_Self v_Self;
22+
}
23+
1224
type t_Ordering =
1325
| Ordering_Less : t_Ordering
1426
| Ordering_Equal : t_Ordering
1527
| Ordering_Greater : t_Ordering
1628

29+
30+
class t_PartialOrd (v_Self: Type) (v_Rhs:Type) = {
31+
_super_9014672428308350468: t_PartialEq v_Self v_Rhs;
32+
f_partial_cmp_pre: v_Self -> v_Rhs -> Type0;
33+
f_partial_cmp_post: v_Self -> v_Rhs -> Core.Option.t_Option t_Ordering -> Type0;
34+
f_partial_cmp:v_Self -> v_Rhs -> Core.Option.t_Option t_Ordering;
35+
}
36+
1737
class t_Ord (v_Self: Type) = {
38+
_super_8099741844003281729: t_Eq v_Self;
39+
_super_12866954522599331834: t_PartialOrd v_Self v_Self;
40+
f_cmp_pre: v_Self -> v_Self -> Type0;
41+
f_cmp_post: v_Self -> v_Self -> t_Ordering -> Type0;
1842
f_cmp:v_Self -> v_Self -> t_Ordering;
1943
// f_max:v_Self -> v_Self -> v_Self;
2044
// f_min:v_Self -> v_Self -> v_Self;
2145
// f_clamp:v_Self -> v_Self -> v_Self -> v_Self
2246
}
2347

24-
class t_PartialEq (v_Self: Type) (v_Rhs: Type) = {
25-
// __constraint_1069563329_t_PartialEq:t_PartialEq v_Self v_Rhs;
26-
f_eq:v_Self -> v_Rhs -> bool;
27-
f_ne:v_Self -> v_Rhs -> bool
28-
}
29-
3048
instance all_eq (a: eqtype): t_PartialEq a a = {
49+
f_eq_pre = (fun x y -> True);
50+
f_eq_post = (fun x y r -> True);
3151
f_eq = (fun x y -> x = y);
32-
f_ne = (fun x y -> x <> y);
33-
}
34-
35-
class t_PartialOrd (v_Self: Type) (v_Rhs: Type) = {
36-
__constraint_Rhs_t_PartialEq:t_PartialEq v_Self v_Rhs;
37-
// __constraint_Rhs_t_PartialOrd:t_PartialOrd v_Self v_Rhs;
38-
f_partial_cmp:v_Self -> v_Rhs -> Core.Option.t_Option t_Ordering;
39-
// f_lt:v_Self -> v_Rhs -> bool;
40-
// f_le:v_Self -> v_Rhs -> bool;
41-
// f_gt:v_Self -> v_Rhs -> bool;
42-
// f_ge:v_Self -> v_Rhs -> bool
4352
}
4453

4554
type t_Reverse t = | Reverse of t
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Core.Core_arch.X86.Pclmulqdq
2+
3+
val v__mm_clmulepi64_si128 : Rust_primitives.Integers.i32 -> Core.Core_arch.X86.t____m128i -> Core.Core_arch.X86.t____m128i -> Core.Core_arch.X86.t____m128i
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Core.Core_arch.X86.Sse2
2+
3+
val v__mm_set_epi64x: Rust_primitives.Integers.i64 -> Rust_primitives.Integers.i64 -> Core.Core_arch.X86.t____m128i
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Core.Core_arch.X86_64_.Sse2
2+
3+
val v__mm_cvtsi128_si64: Core.Core_arch.X86.t____m128i -> Rust_primitives.Integers.i64

proof-libs/fstar/core/Core.Fmt.fsti

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class t_Debug t_Self = {
2121
val t_Arguments: Type0
2222
val impl_2__new_v1 (sz1: usize) (sz2: usize) (pieces: t_Slice string) (args: t_Slice Core.Fmt.Rt.t_Argument): t_Arguments
2323
val impl_7__write_fmt (fmt: t_Formatter) (args: t_Arguments): t_Formatter & t_Result
24-
val impl_2__new_const (args: t_Slice string): t_Arguments
24+
val impl_2__new_const (u:usize) (args: t_Slice string): t_Arguments
2525

2626

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Core.Iter.Adapters.Map
2+
3+
type t_Map (k:Type0) (v:Type0)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Core.Iter.Adapters.Zip
2+
3+
type t_Zip (t1:Type0) (t2:Type0)

proof-libs/fstar/core/Core.Marker.fst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,7 @@ class t_Clone (h: Type) = {
4848
instance t_Clone_all t: t_Clone t = {
4949
dummy_clone_field = ()
5050
}
51+
52+
class t_StructuralPartialEq (h: Type) = {
53+
dummy_eq_field: unit
54+
}

proof-libs/fstar/core/Core.Num.Error.fsti

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ module Core.Num.Error
22
open Rust_primitives
33

44
type t_ParseIntError = unit
5+
type t_TryFromIntError = unit
6+

proof-libs/fstar/core/Core.Num.fsti

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let impl__u8__wrapping_add: u8 -> u8 -> u8 = add_mod
77
let impl__u8__wrapping_sub: u8 -> u8 -> u8 = sub_mod
88
let impl__u16__wrapping_add: u16 -> u16 -> u16 = add_mod
99
val impl__u16__to_be_bytes: u16 -> t_Array u8 (sz 2)
10+
val impl__u16__from_be_bytes: t_Array u8 (sz 2) -> u16
1011
let impl__i32__wrapping_add: i32 -> i32 -> i32 = add_mod
1112
let impl__i32__abs (a:i32{minint i32_inttype < v a}) : i32 = abs_int a
1213

proof-libs/fstar/core/Core.Slice.fsti

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ instance impl__index t n: t_Index (t_Slice t) (int_t n)
2727
}
2828

2929
let impl__copy_from_slice #t (x: t_Slice t) (y:t_Slice t) : t_Slice t = y
30+
let impl__clone_from_slice #t (x: t_Slice t) (y:t_Slice t) : t_Slice t = y
3031

3132
val impl__split_at #t (s: t_Slice t) (mid: usize): Pure (t_Slice t * t_Slice t)
3233
(requires (v mid <= Seq.length s))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Rand.Distributions.Distribution
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Rand.Distributions.Integer

proof-libs/fstar/core/Rand.Rng.fsti

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module Rand.Rng

proof-libs/fstar/rust_primitives/Rust_primitives.Hax.fst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ unfold let array_of_list (#t:Type)
5555
(l: list t {FStar.List.Tot.length l == n})
5656
: t_Array t (sz n)
5757
= Seq.seq_of_list l
58+
59+
let box_new (#t:Type) (v: t): Alloc.Boxed.t_Box t Alloc.Alloc.t_Global = v
60+
61+
class iterator_return (self: Type u#0): Type u#1 = {
62+
[@@@FStar.Tactics.Typeclasses.tcresolve]
63+
parent_iterator: Core.Iter.Traits.Iterator.iterator self;
64+
f_fold_return: #b:Type0 -> s:self -> b -> (b -> i:parent_iterator.f_Item{parent_iterator.f_contains s i} -> Core.Ops.Control_flow.t_ControlFlow b b) -> Core.Ops.Control_flow.t_ControlFlow b b;
65+
}

0 commit comments

Comments
 (0)