Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lib) New sandwich core changes #1192

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/barrett/proofs/fstar/extraction/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ FSTAR_FLAGS = --cmi \
--warn_error -331 \
--cache_checked_modules --cache_dir $(CACHE_DIR) \
--already_cached "+Prims+FStar+LowStar+C+Spec.Loops+TestLib" \
--ext context_pruning \
$(addprefix --include ,$(FSTAR_INCLUDE_DIRS))

FSTAR = $(FSTAR_BIN) $(FSTAR_FLAGS)
Expand Down
1 change: 1 addition & 0 deletions examples/barrett/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) const FIELD_MODULUS: i32 = 3329;
/// `|result| ≤ FIELD_MODULUS / 2 · (|value|/BARRETT_R + 1)
///
/// In particular, if `|value| < BARRETT_R`, then `|result| < FIELD_MODULUS`.
#[hax::fstar::options("--z3rlimit 200 --ext context_prune")]
#[hax::requires((i64::from(value) >= -BARRETT_R && i64::from(value) <= BARRETT_R))]
#[hax::ensures(|result| result > -FIELD_MODULUS && result < FIELD_MODULUS &&
result % FIELD_MODULUS == value % FIELD_MODULUS)]
Expand Down
2 changes: 2 additions & 0 deletions proof-libs/fstar/core/Alloc.Boxed.fst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module Alloc.Boxed

type t_Box t t_Global = t

assume val impl__pin #t (x: t) : Core.Pin.t_Pin (t_Box t Alloc.Alloc.t_Global)
2 changes: 2 additions & 0 deletions proof-libs/fstar/core/Alloc.Slice.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ open Alloc.Vec
let impl__to_vec #a (s: t_Slice a): t_Vec a Alloc.Alloc.t_Global = s

val impl__concat #t1 #t2 (s: t_Slice t1): t_Slice t2

let impl__into_vec #a #t (s: t_Slice a): t_Vec a t= s
7 changes: 7 additions & 0 deletions proof-libs/fstar/core/Core.Pin.fsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Core.Pin

val t_Pin (v_T: Type0) : eqtype

val impl_6__as_ref #t (x: t_Pin t): t_Pin t

val impl_8__into_inner_unchecked #t (x: t_Pin t): t
3 changes: 3 additions & 0 deletions proof-libs/fstar/core/Core.Ptr.Non_null.fsti
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Core.Ptr.Non_null

val t_NonNull (v_T: Type0) : eqtype
4 changes: 4 additions & 0 deletions proof-libs/fstar/core/Core.Result.fst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ let impl__and_then #t #e #u (self: t_Result t e) (op: t -> t_Result u e): t_Resu
| Result_Ok v -> op v
| Result_Err e -> Result_Err e

let impl__is_err #t #e (self: t_Result t e) : bool =
match self with
| Result_Ok v -> true
| Result_Err e -> false
2 changes: 1 addition & 1 deletion proof-libs/fstar/core/Std.Collections.Hash.Map.fsti
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Std.Collections.Hash.Map

type t_HashMap (k v s:Type0)
type t_HashMap ([@@@ strictly_positive] k [@@@ strictly_positive] v [@@@ strictly_positive] s:Type0): eqtype

val impl__new #k #v: unit -> t_HashMap k v Std.Hash.Random.t_RandomState
2 changes: 1 addition & 1 deletion proof-libs/fstar/core/Std.Hash.Random.fsti
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Std.Hash.Random

type t_RandomState
type t_RandomState: eqtype
2 changes: 2 additions & 0 deletions proof-libs/fstar/rust_primitives/Rust_primitives.Hax.fst
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ unfold let array_of_list (#t:Type)
(l: list t {FStar.List.Tot.length l == n})
: t_Array t (sz n)
= Seq.seq_of_list l

let box_new (#t:Type) (v: t): Alloc.Boxed.t_Box t Alloc.Alloc.t_Global = v
Loading