Skip to content

Commit 7086fd3

Browse files
authored
Merge pull request #1728 from cryspen/vec-deque-lib
Better VecDeque model and other F* proof lib improvements/fixes.
2 parents 2112a4a + 2e936af commit 7086fd3

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Change to cargo-hax:
4040
Changes to hax-lib:
4141
- New behavior for `hax_lib::include`: it now forces inclusion when in contradiction with `-i` flag.
4242
- hax-lib requires edition 2021 instead of 2024 (#1726)
43+
- Improved `VecDeque` model in F* proof lib (#1728)
4344

4445
Changes to the Lean backend:
4546
- Improve support for functionalized loops (#1695)
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
module Alloc.Collections.Vec_deque
22
open Rust_primitives
33

4-
type t_VecDeque: Type0 -> unit -> Type0
4+
unfold type t_VecDeque t (_: unit) = t_Slice t
55

66
val impl_5__push_back #t #a (v: t_VecDeque t a) (x: t): t_VecDeque t a
77

8-
val impl_5__len #t #a (v: t_VecDeque t a): usize
8+
let impl_5__len #t #a (v: t_VecDeque t a): usize = sz (Seq.length v)
99

10-
val impl_5__pop_front #t #a (v: t_VecDeque t a): t_VecDeque t a & Core.Option.t_Option t
10+
let impl_5__pop_front #t #a (v: t_VecDeque t a): t_VecDeque t a & Core.Option.t_Option t =
11+
match Seq.seq_to_list v with
12+
| h::tail -> Seq.seq_of_list tail, Core.Option.Option_Some h
13+
| [] -> v, Core.Option.Option_None
1114

1215

1316
[@FStar.Tactics.Typeclasses.tcinstance]
1417
val from_vec_deque_array t a n: Core.Convert.t_From (Alloc.Collections.Vec_deque.t_VecDeque t a)
1518
(Rust_primitives.Arrays.t_Array t
1619
(Rust_primitives.Integers.mk_usize n))
1720

18-
[@FStar.Tactics.Typeclasses.tcinstance]
19-
val index_vec_deque t a: Core.Ops.Index.t_Index (Alloc.Collections.Vec_deque.t_VecDeque t a)
20-
Rust_primitives.Integers.usize
2121

22-
[@FStar.Tactics.Typeclasses.tcinstance]
23-
val update_at t a: Rust_primitives.Hax.update_at_tc (Alloc.Collections.Vec_deque.t_VecDeque t a)
24-
Rust_primitives.Integers.usize

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type t_Ordering =
2828

2929

3030
class t_PartialOrd (v_Self: Type) (v_Rhs:Type) = {
31-
_super_17767811571638026139: t_PartialEq v_Self v_Rhs;
31+
_super_14602337363870446881: t_PartialEq v_Self v_Rhs;
3232
f_partial_cmp_pre: v_Self -> v_Rhs -> Type0;
3333
f_partial_cmp_post: v_Self -> v_Rhs -> Core.Option.t_Option t_Ordering -> Type0;
3434
f_partial_cmp:v_Self -> v_Rhs -> Core.Option.t_Option t_Ordering;
@@ -55,8 +55,8 @@ let f_ge #v_Self #v_Rhs {| t_PartialOrd v_Self v_Rhs |} (self: v_Self) (rhs: v_R
5555
| _ -> true
5656

5757
class t_Ord (v_Self: Type) = {
58-
_super_8562072132021960682: t_Eq v_Self;
59-
_super_17650760217149814164: t_PartialOrd v_Self v_Self;
58+
_super_6686490714486791726: t_Eq v_Self;
59+
_super_7232954788087520964: t_PartialOrd v_Self v_Self;
6060
f_cmp_pre: v_Self -> v_Self -> Type0;
6161
f_cmp_post: v_Self -> v_Self -> t_Ordering -> Type0;
6262
f_cmp:v_Self -> v_Self -> t_Ordering;
@@ -86,7 +86,7 @@ instance eq_int_t t : t_Eq (int_t t) = {
8686
}
8787

8888
instance partialOrd_int t : (t_PartialOrd (int_t t) (int_t t)) = {
89-
_super_17767811571638026139 = (FStar.Tactics.Typeclasses.solve);
89+
_super_14602337363870446881 = (FStar.Tactics.Typeclasses.solve);
9090

9191
f_partial_cmp_pre = (fun x y -> True);
9292
f_partial_cmp_post = (fun x y z -> match z with
@@ -104,8 +104,8 @@ instance partialOrd_int t : (t_PartialOrd (int_t t) (int_t t)) = {
104104

105105
[@FStar.Tactics.Typeclasses.tcinstance]
106106
instance ord_int t : t_Ord (int_t t) = {
107-
_super_8562072132021960682 = (FStar.Tactics.Typeclasses.solve);
108-
_super_17650760217149814164 = (FStar.Tactics.Typeclasses.solve);
107+
_super_6686490714486791726 = (FStar.Tactics.Typeclasses.solve);
108+
_super_7232954788087520964 = (FStar.Tactics.Typeclasses.solve);
109109
f_cmp_pre = (fun x y -> True) ;
110110
f_cmp_post = (fun x y r ->
111111
match r with

hax-lib/proof-libs/fstar/core/Core.Iter.Traits.Iterator.fst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ assume val flat_map_iter (t: Type0) (u: Type0) (v: Type0) : Core.Iter.Traits.Ite
7272
[@FStar.Tactics.Typeclasses.tcinstance]
7373
assume val t_split_iter (pattern: Type) :
7474
(Core.Str.Iter.t_Split pattern) -> t_Iterator (Core.Str.Iter.t_Split pattern)
75+
76+
[@@ FStar.Tactics.Typeclasses.tcinstance]
77+
assume val iterator_map (t: Type0) (u: Type0):
78+
t_Iterator (Core.Iter.Adapters.Map.t_Map t u)

0 commit comments

Comments
 (0)