Skip to content

Commit

Permalink
chore(engine/deps): update tests snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Nov 28, 2024
1 parent 39896ee commit 9113e10
Show file tree
Hide file tree
Showing 28 changed files with 1,779 additions and 1,509 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Attribute_opaque
open Core
open FStar.Mul

val t_OpaqueEnum (v_X: usize) (#v_T #v_U: Type0) : Type0

val t_OpaqueStruct (v_X: usize) (#v_T #v_U: Type0) : Type0

val t_OpaqueEnum (v_X: usize) (#v_T #v_U: Type0) : Type0
'''
156 changes: 78 additions & 78 deletions test-harness/src/snapshots/toolchain__attributes into-fstar.snap
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ open FStar.Mul

unfold type t_Int = int

unfold let add x y = x + y

unfold instance impl: Core.Ops.Arith.t_Sub t_Int t_Int =
{
f_Output = t_Int;
f_sub_pre = (fun (self: t_Int) (other: t_Int) -> true);
f_sub_post = (fun (self: t_Int) (other: t_Int) (out: t_Int) -> true);
f_sub = fun (self: t_Int) (other: t_Int) -> self + other
}

unfold let add x y = x + y
'''
"Attributes.Nested_refinement_elim.fst" = '''
module Attributes.Nested_refinement_elim
Expand All @@ -118,11 +118,16 @@ module Attributes.Newtype_pattern
open Core
open FStar.Mul

let v_MAX: usize = sz 10

type t_SafeIndex = { f_i:f_i: usize{f_i <. v_MAX} }

let impl__SafeIndex__as_usize (self: t_SafeIndex) : usize = self.f_i
let impl__SafeIndex__new (i: usize) : Core.Option.t_Option t_SafeIndex =
if i <. v_MAX
then Core.Option.Option_Some ({ f_i = i } <: t_SafeIndex) <: Core.Option.t_Option t_SafeIndex
else Core.Option.Option_None <: Core.Option.t_Option t_SafeIndex

let v_MAX: usize = sz 10
let impl__SafeIndex__as_usize (self: t_SafeIndex) : usize = self.f_i

[@@ FStar.Tactics.Typeclasses.tcinstance]
let impl_1 (#v_T: Type0) : Core.Ops.Index.t_Index (t_Array v_T (sz 10)) t_SafeIndex =
Expand All @@ -132,11 +137,6 @@ let impl_1 (#v_T: Type0) : Core.Ops.Index.t_Index (t_Array v_T (sz 10)) t_SafeIn
f_index_post = (fun (self: t_Array v_T (sz 10)) (index: t_SafeIndex) (out: v_T) -> true);
f_index = fun (self: t_Array v_T (sz 10)) (index: t_SafeIndex) -> self.[ index.f_i ]
}

let impl__SafeIndex__new (i: usize) : Core.Option.t_Option t_SafeIndex =
if i <. v_MAX
then Core.Option.Option_Some ({ f_i = i } <: t_SafeIndex) <: Core.Option.t_Option t_SafeIndex
else Core.Option.Option_None <: Core.Option.t_Option t_SafeIndex
'''
"Attributes.Pre_post_on_traits_and_impls.fst" = '''
module Attributes.Pre_post_on_traits_and_impls
Expand All @@ -162,13 +162,6 @@ class t_Operation (v_Self: Type0) = {
f_double:x0: u8 -> Prims.Pure u8 (f_double_pre x0) (fun result -> f_double_post x0 result)
}

class t_TraitWithRequiresAndEnsures (v_Self: Type0) = {
f_method_pre:self___: v_Self -> x: u8 -> pred: Type0{x <. 100uy ==> pred};
f_method_post:self___: v_Self -> x: u8 -> r: u8 -> pred: Type0{pred ==> r >. 88uy};
f_method:x0: v_Self -> x1: u8
-> Prims.Pure u8 (f_method_pre x0 x1) (fun result -> f_method_post x0 x1 result)
}

type t_ViaAdd = | ViaAdd : t_ViaAdd

type t_ViaMul = | ViaMul : t_ViaMul
Expand Down Expand Up @@ -207,6 +200,13 @@ let impl_1: t_Operation t_ViaMul =
f_double = fun (x: u8) -> x *! 2uy
}

class t_TraitWithRequiresAndEnsures (v_Self: Type0) = {
f_method_pre:self___: v_Self -> x: u8 -> pred: Type0{x <. 100uy ==> pred};
f_method_post:self___: v_Self -> x: u8 -> r: u8 -> pred: Type0{pred ==> r >. 88uy};
f_method:x0: v_Self -> x1: u8
-> Prims.Pure u8 (f_method_pre x0 x1) (fun result -> f_method_post x0 x1 result)
}

let test
(#v_T: Type0)
(#[FStar.Tactics.Typeclasses.tcresolve ()] i1: t_TraitWithRequiresAndEnsures v_T)
Expand Down Expand Up @@ -247,9 +247,18 @@ module Attributes.Refined_indexes
open Core
open FStar.Mul

let v_MAX: usize = sz 10

type t_MyArray = | MyArray : t_Array u8 (sz 10) -> t_MyArray

let v_MAX: usize = sz 10
[@@ FStar.Tactics.Typeclasses.tcinstance]
let impl: Core.Ops.Index.t_Index t_MyArray usize =
{
f_Output = u8;
f_index_pre = (fun (self___: t_MyArray) (index: usize) -> index <. v_MAX);
f_index_post = (fun (self: t_MyArray) (index: usize) (out: u8) -> true);
f_index = fun (self: t_MyArray) (index: usize) -> self.[ index ]
}

/// Triple dash comment
(** Multiline double star comment Maecenas blandit accumsan feugiat.
Expand All @@ -272,43 +281,27 @@ let mutation_example
use_generic_update_at, use_specialized_update_at, specialized_as_well
<:
(t_MyArray & t_Slice u8 & Alloc.Vec.t_Vec u8 Alloc.Alloc.t_Global)

[@@ FStar.Tactics.Typeclasses.tcinstance]
let impl: Core.Ops.Index.t_Index t_MyArray usize =
{
f_Output = u8;
f_index_pre = (fun (self___: t_MyArray) (index: usize) -> index <. v_MAX);
f_index_post = (fun (self: t_MyArray) (index: usize) (out: u8) -> true);
f_index = fun (self: t_MyArray) (index: usize) -> self.[ index ]
}
'''
"Attributes.Refinement_types.fst" = '''
module Attributes.Refinement_types
#set-options "--fuel 0 --ifuel 1 --z3rlimit 15"
open Core
open FStar.Mul

/// Example of a specific constraint on a value
let t_CompressionFactor = x: u8{x =. 4uy || x =. 5uy || x =. 10uy || x =. 11uy}

let t_BoundedU8 (v_MIN v_MAX: u8) = x: u8{x >=. v_MIN && x <=. v_MAX}

/// A field element
let t_FieldElement = x: u16{x <=. 2347us}
let bounded_u8 (x: t_BoundedU8 12uy 15uy) (y: t_BoundedU8 10uy 11uy) : t_BoundedU8 1uy 23uy =
(x <: u8) +! (y <: u8) <: t_BoundedU8 1uy 23uy

/// Even `u8` numbers. Constructing pub Even values triggers static
/// proofs in the extraction.
let t_Even = x: u8{(x %! 2uy <: u8) =. 0uy}

/// A modular mutliplicative inverse
let t_ModInverse (v_MOD: u32) =
n:
u32
{ (((cast (n <: u32) <: u128) *! (cast (v_MOD <: u32) <: u128) <: u128) %!
(cast (v_MOD <: u32) <: u128)
<:
u128) =.
pub_u128 1 }
let double (x: u8) : Prims.Pure t_Even (requires x <. 127uy) (fun _ -> Prims.l_True) =
x +! x <: t_Even

let double_refine (x: u8) : Prims.Pure t_Even (requires x <. 127uy) (fun _ -> Prims.l_True) =
x +! x <: t_Even

/// A string that contains no space.
let t_NoE =
Expand All @@ -330,14 +323,21 @@ let t_NoE =
in
~.out }

let double_refine (x: u8) : Prims.Pure t_Even (requires x <. 127uy) (fun _ -> Prims.l_True) =
x +! x <: t_Even
/// A modular mutliplicative inverse
let t_ModInverse (v_MOD: u32) =
n:
u32
{ (((cast (n <: u32) <: u128) *! (cast (v_MOD <: u32) <: u128) <: u128) %!
(cast (v_MOD <: u32) <: u128)
<:
u128) =.
pub_u128 1 }

let bounded_u8 (x: t_BoundedU8 12uy 15uy) (y: t_BoundedU8 10uy 11uy) : t_BoundedU8 1uy 23uy =
(x <: u8) +! (y <: u8) <: t_BoundedU8 1uy 23uy
/// A field element
let t_FieldElement = x: u16{x <=. 2347us}

let double (x: u8) : Prims.Pure t_Even (requires x <. 127uy) (fun _ -> Prims.l_True) =
x +! x <: t_Even
/// Example of a specific constraint on a value
let t_CompressionFactor = x: u8{x =. 4uy || x =. 5uy || x =. 10uy || x =. 11uy}
'''
"Attributes.Requires_mut.fst" = '''
module Attributes.Requires_mut
Expand Down Expand Up @@ -417,6 +417,12 @@ module Attributes.Verifcation_status
open Core
open FStar.Mul

#push-options "--admit_smt_queries true"

let a_function_which_only_laxes (_: Prims.unit) : Prims.unit = Hax_lib.v_assert false

#pop-options

let a_panicfree_function (_: Prims.unit)
: Prims.Pure u8
Prims.l_True
Expand All @@ -441,36 +447,27 @@ let another_panicfree_function (_: Prims.unit)
let nothing:i32 = 0l in
let still_not_much:i32 = not_much +! nothing in
admit () (* Panic freedom *)

#push-options "--admit_smt_queries true"

let a_function_which_only_laxes (_: Prims.unit) : Prims.unit = Hax_lib.v_assert false

#pop-options
'''
"Attributes.fst" = '''
module Attributes
#set-options "--fuel 0 --ifuel 1 --z3rlimit 15"
open Core
open FStar.Mul

type t_Foo = {
f_x:u32;
f_y:f_y: u32{f_y >. 3ul};
f_z:f_z: u32{((f_y +! f_x <: u32) +! f_z <: u32) >. 3ul}
}

let inlined_code__V: u8 = 12uy
let u32_max: u32 = 90000ul

let issue_844_ (v__x: u8)
: Prims.Pure u8
Prims.l_True
/// A doc comment on `add3`
///another doc comment on add3
let add3 (x y z: u32)
: Prims.Pure u32
(requires x >. 10ul && y >. 10ul && z >. 10ul && ((x +! y <: u32) +! z <: u32) <. u32_max)
(ensures
fun v__x_future ->
let v__x_future:u8 = v__x_future in
true) = v__x

let u32_max: u32 = 90000ul
fun result ->
let result:u32 = result in
Hax_lib.implies true
(fun temp_0_ ->
let _:Prims.unit = temp_0_ in
result >. 32ul <: bool)) = (x +! y <: u32) +! z

let swap_and_mut_req_ens (x y: u32)
: Prims.Pure (u32 & u32 & u32)
Expand All @@ -485,25 +482,28 @@ let swap_and_mut_req_ens (x y: u32)
let hax_temp_output:u32 = x +! y in
x, y, hax_temp_output <: (u32 & u32 & u32)

/// A doc comment on `add3`
///another doc comment on add3
let add3 (x y z: u32)
: Prims.Pure u32
(requires x >. 10ul && y >. 10ul && z >. 10ul && ((x +! y <: u32) +! z <: u32) <. u32_max)
let issue_844_ (v__x: u8)
: Prims.Pure u8
Prims.l_True
(ensures
fun result ->
let result:u32 = result in
Hax_lib.implies true
(fun temp_0_ ->
let _:Prims.unit = temp_0_ in
result >. 32ul <: bool)) = (x +! y <: u32) +! z
fun v__x_future ->
let v__x_future:u8 = v__x_future in
true) = v__x

let add3_lemma (x: u32)
: Lemma Prims.l_True
(ensures
x <=. 10ul || x >=. (u32_max /! 3ul <: u32) || (add3 x x x <: u32) =. (x *! 3ul <: u32)) =
()

type t_Foo = {
f_x:u32;
f_y:f_y: u32{f_y >. 3ul};
f_z:f_z: u32{((f_y +! f_x <: u32) +! f_z <: u32) >. 3ul}
}

let inlined_code__V: u8 = 12uy

let before_inlined_code = "example before"

let inlined_code (foo: t_Foo) : Prims.unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ module Constructor_as_closure
open Core
open FStar.Mul

type t_Context =
| Context_A : i32 -> t_Context
| Context_B : i32 -> t_Context

type t_Test = | Test : i32 -> t_Test

let impl__Test__test (x: Core.Option.t_Option i32) : Core.Option.t_Option t_Test =
Core.Option.impl__map #i32 #t_Test x Test

type t_Context =
| Context_A : i32 -> t_Context
| Context_B : i32 -> t_Context

let impl__Context__test (x: Core.Option.t_Option i32) : Core.Option.t_Option t_Context =
Core.Option.impl__map #i32 #t_Context x Context_B
'''
Loading

0 comments on commit 9113e10

Please sign in to comment.