effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Tot | val quad32_shl32 (q: quad32) : quad32 | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let quad32_shl32 (q:quad32) : quad32 =
let Mkfour v0 v1 v2 v3 = q in
Mkfour 0 v0 v1 v2 | val quad32_shl32 (q: quad32) : quad32
let quad32_shl32 (q: quad32) : quad32 = | false | null | false | let Mkfour v0 v1 v2 v3 = q in
Mkfour 0 v0 v1 v2 | {
"checked_file": "Vale.AES.AES_helpers.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.AES_helpers.fsti"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.Mkfour"
] | [] | module Vale.AES.AES_helpers
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_s
open FStar.Mul
// syntax for seq accesses, s.[index] and s.[index] <- value
unfold let (.[]) (#a:Type) (s:seq a) (i:nat{ i < length s}) : Tot a = index s i
unfold let (.[]<-) = Seq.upd
unfold let ( *^ ) = nat32_xor
unfold let ( *^^ ) = quad32_xor | false | true | Vale.AES.AES_helpers.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val quad32_shl32 (q: quad32) : quad32 | [] | Vale.AES.AES_helpers.quad32_shl32 | {
"file_name": "vale/code/crypto/aes/Vale.AES.AES_helpers.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | q: Vale.Def.Types_s.quad32 -> Vale.Def.Types_s.quad32 | {
"end_col": 19,
"end_line": 19,
"start_col": 38,
"start_line": 17
} |
Prims.Tot | val op_String_Access (#a: Type) (s: seq a) (i: nat{i < length s}) : Tot a | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (.[]) (#a:Type) (s:seq a) (i:nat{ i < length s}) : Tot a = index s i | val op_String_Access (#a: Type) (s: seq a) (i: nat{i < length s}) : Tot a
let op_String_Access (#a: Type) (s: seq a) (i: nat{i < length s}) : Tot a = | false | null | false | index s i | {
"checked_file": "Vale.AES.AES_helpers.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.AES_helpers.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"FStar.Seq.Base.index"
] | [] | module Vale.AES.AES_helpers
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_s
open FStar.Mul | false | false | Vale.AES.AES_helpers.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_String_Access (#a: Type) (s: seq a) (i: nat{i < length s}) : Tot a | [] | Vale.AES.AES_helpers.op_String_Access | {
"file_name": "vale/code/crypto/aes/Vale.AES.AES_helpers.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq a -> i: Prims.nat{i < FStar.Seq.Base.length s} -> a | {
"end_col": 79,
"end_line": 11,
"start_col": 70,
"start_line": 11
} |
Prims.Pure | val expand_key_128_def (key: seq nat32) (round: nat)
: Pure quad32 (requires is_aes_key_LE AES_128 key) (ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec expand_key_128_def (key:seq nat32) (round:nat) : Pure quad32
(requires is_aes_key_LE AES_128 key)
(ensures fun _ -> True)
=
if round = 0 then Mkfour key.[0] key.[1] key.[2] key.[3]
else round_key_128 (expand_key_128_def key (round - 1)) round | val expand_key_128_def (key: seq nat32) (round: nat)
: Pure quad32 (requires is_aes_key_LE AES_128 key) (ensures fun _ -> True)
let rec expand_key_128_def (key: seq nat32) (round: nat)
: Pure quad32 (requires is_aes_key_LE AES_128 key) (ensures fun _ -> True) = | false | null | false | if round = 0
then Mkfour key.[ 0 ] key.[ 1 ] key.[ 2 ] key.[ 3 ]
else round_key_128 (expand_key_128_def key (round - 1)) round | {
"checked_file": "Vale.AES.AES_helpers.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.AES_helpers.fsti"
} | [] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat32",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Vale.Def.Words_s.Mkfour",
"Vale.AES.AES_helpers.op_String_Access",
"Prims.bool",
"Vale.AES.AES_helpers.round_key_128",
"Vale.AES.AES_helpers.expand_key_128_def",
"Prims.op_Subtraction",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.is_aes_key_LE",
"Vale.AES.AES_common_s.AES_128",
"Prims.l_True"
] | [] | module Vale.AES.AES_helpers
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_s
open FStar.Mul
// syntax for seq accesses, s.[index] and s.[index] <- value
unfold let (.[]) (#a:Type) (s:seq a) (i:nat{ i < length s}) : Tot a = index s i
unfold let (.[]<-) = Seq.upd
unfold let ( *^ ) = nat32_xor
unfold let ( *^^ ) = quad32_xor
let quad32_shl32 (q:quad32) : quad32 =
let Mkfour v0 v1 v2 v3 = q in
Mkfour 0 v0 v1 v2
// Redefine key expansion in terms of quad32 values rather than nat32 values,
// then prove both definitions are equivalent.
let round_key_128_rcon (prev:quad32) (rcon:nat32) : quad32 =
let Mkfour v0 v1 v2 v3 = prev in
let w0 = v0 *^ (sub_word (rot_word_LE v3) *^ rcon) in
let w1 = v1 *^ w0 in
let w2 = v2 *^ w1 in
let w3 = v3 *^ w2 in
Mkfour w0 w1 w2 w3
let round_key_128 (prev:quad32) (round:nat) : quad32 =
round_key_128_rcon prev (aes_rcon (round - 1))
let rec expand_key_128_def (key:seq nat32) (round:nat) : Pure quad32
(requires is_aes_key_LE AES_128 key)
(ensures fun _ -> True) | false | false | Vale.AES.AES_helpers.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val expand_key_128_def (key: seq nat32) (round: nat)
: Pure quad32 (requires is_aes_key_LE AES_128 key) (ensures fun _ -> True) | [
"recursion"
] | Vale.AES.AES_helpers.expand_key_128_def | {
"file_name": "vale/code/crypto/aes/Vale.AES.AES_helpers.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | key: FStar.Seq.Base.seq Vale.Def.Types_s.nat32 -> round: Prims.nat
-> Prims.Pure Vale.Def.Types_s.quad32 | {
"end_col": 63,
"end_line": 41,
"start_col": 2,
"start_line": 40
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | let t64_no_mod = | false | null | false | TD_Buffer TUInt8 TUInt64 ({ modified = false; strict_disjointness = false; taint = MS.Secret }) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.TD_Buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.Interop.Base.Mkbuffer_qualifiers",
"Vale.Arch.HeapTypes_s.Secret"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t64_no_mod : Vale.Interop.Base.td | [] | Vale.AsLowStar.Test.t64_no_mod | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.td | {
"end_col": 104,
"end_line": 26,
"start_col": 17,
"start_line": 26
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ib64 = ibuf_t TUInt8 TUInt64 | let ib64 = | false | null | false | ibuf_t TUInt8 TUInt64 | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.ibuf_t",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64 | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ib64 : Type0 | [] | Vale.AsLowStar.Test.ib64 | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 32,
"end_line": 22,
"start_col": 11,
"start_line": 22
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | let t64_imm = | false | null | false | TD_ImmBuffer TUInt8 TUInt64 ({ modified = false; strict_disjointness = false; taint = MS.Secret }) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.TD_ImmBuffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.Interop.Base.Mkbuffer_qualifiers",
"Vale.Arch.HeapTypes_s.Secret"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t64_imm : Vale.Interop.Base.td | [] | Vale.AsLowStar.Test.t64_imm | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.td | {
"end_col": 104,
"end_line": 28,
"start_col": 14,
"start_line": 28
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq | let t64_mod = | false | null | false | TD_Buffer TUInt8 TUInt64 default_bq | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.TD_Buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.Interop.Base.default_bq"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64 | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t64_mod : Vale.Interop.Base.td | [] | Vale.AsLowStar.Test.t64_mod | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.td | {
"end_col": 49,
"end_line": 24,
"start_col": 14,
"start_line": 24
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let b64 = buf_t TUInt8 TUInt64 | let b64 = | false | null | false | buf_t TUInt8 TUInt64 | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.buf_t",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val b64 : Type0 | [] | Vale.AsLowStar.Test.b64 | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 30,
"end_line": 20,
"start_col": 10,
"start_line": 20
} |
|
Prims.Tot | val vm_pre:VSig.vale_pre vm_dom | [
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) | val vm_pre:VSig.vale_pre vm_dom
let vm_pre:VSig.vale_pre vm_dom = | false | null | false | fun (c: V.va_code) (dst: b64) (src: ib64) (va_s0: V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.b64",
"Vale.AsLowStar.Test.ib64",
"Vale.X64.Decls.va_state",
"Vale.Test.X64.Vale_memcpy.va_req_Memcpy",
"Vale.Interop.Assumptions.win",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Prims.prop"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vm_pre:VSig.vale_pre vm_dom | [] | Vale.AsLowStar.Test.vm_pre | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_pre Vale.AsLowStar.Test.vm_dom | {
"end_col": 82,
"end_line": 65,
"start_col": 2,
"start_line": 61
} |
Prims.Tot | val vm_post:VSig.vale_post vm_dom | [
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f | val vm_post:VSig.vale_post vm_dom
let vm_post:VSig.vale_post vm_dom = | false | null | false | fun (c: V.va_code) (dst: b64) (src: ib64) (va_s0: V.va_state) (va_s1: V.va_state) (f: V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.b64",
"Vale.AsLowStar.Test.ib64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.Test.X64.Vale_memcpy.va_ens_Memcpy",
"Vale.Interop.Assumptions.win",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Prims.prop"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vm_post:VSig.vale_post vm_dom | [] | Vale.AsLowStar.Test.vm_post | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_post Vale.AsLowStar.Test.vm_dom | {
"end_col": 90,
"end_line": 75,
"start_col": 2,
"start_line": 69
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vm_dom = [t64_mod; t64_imm] | let vm_dom = | false | null | false | [t64_mod; t64_imm] | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Prims.Cons",
"Vale.Interop.Base.td",
"Vale.AsLowStar.Test.t64_mod",
"Vale.AsLowStar.Test.t64_imm",
"Prims.Nil"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vm_dom : Prims.list Vale.Interop.Base.td | [] | Vale.AsLowStar.Test.vm_dom | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Vale.Interop.Base.td | {
"end_col": 31,
"end_line": 56,
"start_col": 13,
"start_line": 56
} |
|
Prims.Tot | val call_c_normal_t:normal call_c_t | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c | val call_c_normal_t:normal call_c_t
let call_c_normal_t:normal call_c_t = | false | null | false | as_normal_t #call_c_t call_c | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_normal_t",
"Vale.AsLowStar.Test.call_c_t",
"Vale.AsLowStar.Test.call_c"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win)) | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val call_c_normal_t:normal call_c_t | [] | Vale.AsLowStar.Test.call_c_normal_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Pervasives.norm [
FStar.Pervasives.iota;
FStar.Pervasives.zeta;
FStar.Pervasives.delta_attr ["Vale.Arch.HeapTypes_s.__reduce__"; "FStar.BigOps.__reduce__"];
FStar.Pervasives.delta_only [
"Vale.Interop.Base.uu___is_TD_Buffer";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_regs";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_flags";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_heap";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_stack";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_stackTaint";
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_trace";
"FStar.FunctionalExtensionality.on_dom"; "FStar.FunctionalExtensionality.on";
"FStar.List.Tot.Base.fold_right_gtot"; "FStar.List.Tot.Base.map_gtot";
"FStar.List.Tot.Base.length"; "FStar.Pervasives.Native.fst"; "FStar.Pervasives.Native.snd";
"FStar.Pervasives.Native.__proj__Mktuple2__item___1";
"FStar.Pervasives.Native.__proj__Mktuple2__item___2"
];
FStar.Pervasives.primops;
FStar.Pervasives.simplify
]
Vale.AsLowStar.Test.call_c_t
<:
Type0 | {
"end_col": 68,
"end_line": 48,
"start_col": 40,
"start_line": 48
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let code_Memcpy = VM.va_code_Memcpy IA.win | let code_Memcpy = | false | null | false | VM.va_code_Memcpy IA.win | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Test.X64.Vale_memcpy.va_code_Memcpy",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma' | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val code_Memcpy : Vale.X64.Decls.va_code | [] | Vale.AsLowStar.Test.code_Memcpy | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.X64.Decls.va_code | {
"end_col": 42,
"end_line": 110,
"start_col": 18,
"start_line": 110
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy | let lowstar_Memcpy_normal_t = | false | null | false | as_normal_t #lowstar_Memcpy_t lowstar_Memcpy | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_normal_t",
"Vale.AsLowStar.Test.lowstar_Memcpy_t",
"Vale.AsLowStar.Test.lowstar_Memcpy"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win)) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_Memcpy_normal_t : Vale.Interop.Base.normal Vale.AsLowStar.Test.lowstar_Memcpy_t | [] | Vale.AsLowStar.Test.lowstar_Memcpy_normal_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.normal Vale.AsLowStar.Test.lowstar_Memcpy_t | {
"end_col": 48,
"end_line": 131,
"start_col": 4,
"start_line": 131
} |
|
Prims.Tot | val ta_pre:VSig.vale_pre ta_dom | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7) | val ta_pre:VSig.vale_pre ta_dom
let ta_pre:VSig.vale_pre ta_dom = | false | null | false | fun
(c: V.va_code)
(arg0: ib64)
(arg1: ib64)
(arg2: ib64)
(arg3: ib64)
(arg4: ib64)
(arg5: ib64)
(arg6: ib64)
(arg7: ib64)
(va_s0: V.va_state)
->
TA.va_req_Test c va_s0 IA.win (as_vale_immbuffer arg0) (as_vale_immbuffer arg1)
(as_vale_immbuffer arg2) (as_vale_immbuffer arg3) (as_vale_immbuffer arg4)
(as_vale_immbuffer arg5) (as_vale_immbuffer arg6) (as_vale_immbuffer arg7) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.ib64",
"Vale.X64.Decls.va_state",
"Vale.Test.X64.Args.va_req_Test",
"Vale.Interop.Assumptions.win",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Prims.prop"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ta_pre:VSig.vale_pre ta_dom | [] | Vale.AsLowStar.Test.ta_pre | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_pre Vale.AsLowStar.Test.ta_dom | {
"end_col": 30,
"end_line": 300,
"start_col": 2,
"start_line": 282
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni | let lowstar_aesni_normal_t = | false | null | false | as_normal_t #lowstar_aesni_t lowstar_aesni | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_normal_t",
"Vale.AsLowStar.Test.lowstar_aesni_t",
"Vale.AsLowStar.Test.lowstar_aesni"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win)) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_aesni_normal_t : Vale.Interop.Base.normal Vale.AsLowStar.Test.lowstar_aesni_t | [] | Vale.AsLowStar.Test.lowstar_aesni_normal_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.normal Vale.AsLowStar.Test.lowstar_aesni_t | {
"end_col": 46,
"end_line": 255,
"start_col": 4,
"start_line": 255
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let code_ta = TA.va_code_Test IA.win | let code_ta = | false | null | false | TA.va_code_Test IA.win | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Test.X64.Args.va_code_Test",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__]
let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
=
let va_s1, f = TA.va_lemma_Test code va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
in
va_s1, f
(* Prove that vm_lemma' has the required type *)
let ta_lemma = as_t #(VSig.vale_sig_stdcall ta_pre ta_post) ta_lemma' | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val code_ta : Vale.X64.Decls.va_code | [] | Vale.AsLowStar.Test.code_ta | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.X64.Decls.va_code | {
"end_col": 36,
"end_line": 375,
"start_col": 14,
"start_line": 375
} |
|
Prims.Tot | val aesni_post:VSig.vale_post aesni_dom | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f | val aesni_post:VSig.vale_post aesni_dom
let aesni_post:VSig.vale_post aesni_dom = | false | null | false | fun (c: V.va_code) (va_s0: V.va_state) (va_s1: V.va_state) (f: V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.Lib.X64.Cpuidstdcall.va_ens_Check_aesni_stdcall",
"Vale.Interop.Assumptions.win",
"Prims.prop"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aesni_post:VSig.vale_post aesni_dom | [] | Vale.AsLowStar.Test.aesni_post | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_post Vale.AsLowStar.Test.aesni_dom | {
"end_col": 58,
"end_line": 203,
"start_col": 2,
"start_line": 199
} |
Prims.Tot | val aesni_pre:VSig.vale_pre aesni_dom | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win | val aesni_pre:VSig.vale_pre aesni_dom
let aesni_pre:VSig.vale_pre aesni_dom = | false | null | false | fun (c: V.va_code) (va_s0: V.va_state) -> VC.va_req_Check_aesni_stdcall c va_s0 IA.win | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.Lib.X64.Cpuidstdcall.va_req_Check_aesni_stdcall",
"Vale.Interop.Assumptions.win",
"Prims.prop"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aesni_pre:VSig.vale_pre aesni_dom | [] | Vale.AsLowStar.Test.aesni_pre | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_pre Vale.AsLowStar.Test.aesni_dom | {
"end_col": 50,
"end_line": 195,
"start_col": 2,
"start_line": 193
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let code_aesni = VC.va_code_Check_aesni_stdcall IA.win | let code_aesni = | false | null | false | VC.va_code_Check_aesni_stdcall IA.win | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Lib.X64.Cpuidstdcall.va_code_Check_aesni_stdcall",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma' | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val code_aesni : Vale.X64.Decls.va_code | [] | Vale.AsLowStar.Test.code_aesni | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.X64.Decls.va_code | {
"end_col": 54,
"end_line": 234,
"start_col": 17,
"start_line": 234
} |
|
Prims.Tot | val ta_post:VSig.vale_post ta_dom | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f | val ta_post:VSig.vale_post ta_dom
let ta_post:VSig.vale_post ta_dom = | false | null | false | fun
(c: V.va_code)
(arg0: ib64)
(arg1: ib64)
(arg2: ib64)
(arg3: ib64)
(arg4: ib64)
(arg5: ib64)
(arg6: ib64)
(arg7: ib64)
(va_s0: V.va_state)
(va_s1: V.va_state)
(f: V.va_fuel)
->
TA.va_ens_Test c va_s0 IA.win (as_vale_immbuffer arg0) (as_vale_immbuffer arg1)
(as_vale_immbuffer arg2) (as_vale_immbuffer arg3) (as_vale_immbuffer arg4)
(as_vale_immbuffer arg5) (as_vale_immbuffer arg6) (as_vale_immbuffer arg7) va_s1 f | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.ib64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.Test.X64.Args.va_ens_Test",
"Vale.Interop.Assumptions.win",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Prims.prop"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ta_post:VSig.vale_post ta_dom | [] | Vale.AsLowStar.Test.ta_post | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_post Vale.AsLowStar.Test.ta_dom | {
"end_col": 13,
"end_line": 325,
"start_col": 2,
"start_line": 304
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_ta_normal_t //: normal lowstar_ta_t
= as_normal_t #lowstar_ta_t lowstar_ta | let lowstar_ta_normal_t = | false | null | false | as_normal_t #lowstar_ta_t lowstar_ta | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_normal_t",
"Vale.AsLowStar.Test.lowstar_ta_t",
"Vale.AsLowStar.Test.lowstar_ta"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__]
let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
=
let va_s1, f = TA.va_lemma_Test code va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
in
va_s1, f
(* Prove that vm_lemma' has the required type *)
let ta_lemma = as_t #(VSig.vale_sig_stdcall ta_pre ta_post) ta_lemma'
let code_ta = TA.va_code_Test IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_ta_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_ta)
ta_dom
[]
_
_
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_ta : lowstar_ta_t =
IX64.wrap_weak_stdcall
(coerce code_ta)
ta_dom
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win)) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_ta_normal_t : Vale.Interop.Base.normal Vale.AsLowStar.Test.lowstar_ta_t | [] | Vale.AsLowStar.Test.lowstar_ta_normal_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.normal Vale.AsLowStar.Test.lowstar_ta_t | {
"end_col": 40,
"end_line": 396,
"start_col": 4,
"start_line": 396
} |
|
Prims.Tot | val as_t (#a: Type) (x: normal a) : a | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_t (#a:Type) (x:normal a) : a = x | val as_t (#a: Type) (x: normal a) : a
let as_t (#a: Type) (x: normal a) : a = | false | null | false | x | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.normal"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_t (#a: Type) (x: normal a) : a | [] | Vale.AsLowStar.Test.as_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.Interop.Base.normal a -> a | {
"end_col": 39,
"end_line": 14,
"start_col": 38,
"start_line": 14
} |
Prims.Tot | val as_normal_t (#a: Type) (x: a) : normal a | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_normal_t (#a:Type) (x:a) : normal a = x | val as_normal_t (#a: Type) (x: a) : normal a
let as_normal_t (#a: Type) (x: a) : normal a = | false | null | false | x | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.Base.normal"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *) | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_normal_t (#a: Type) (x: a) : normal a | [] | Vale.AsLowStar.Test.as_normal_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: a -> Vale.Interop.Base.normal a | {
"end_col": 46,
"end_line": 15,
"start_col": 45,
"start_line": 15
} |
Prims.Tot | val dom:dom: list td {List.length dom <= 20} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y | val dom:dom: list td {List.length dom <= 20}
let dom:dom: list td {List.length dom <= 20} = | false | null | false | let y = [t64_mod; t64_imm] in
assert_norm (List.length y = 2);
y | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Prims.Cons",
"Vale.AsLowStar.Test.t64_mod",
"Vale.AsLowStar.Test.t64_imm",
"Prims.Nil"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val dom:dom: list td {List.length dom <= 20} | [] | Vale.AsLowStar.Test.dom | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length dom <= 20} | {
"end_col": 3,
"end_line": 34,
"start_col": 44,
"start_line": 31
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win)) | let call_c_t = | false | null | false | IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.AsLowStar.Test.c",
"Vale.AsLowStar.Test.dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.AsLowStar.Test.pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.v",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val call_c_t : Type0 | [] | Vale.AsLowStar.Test.call_c_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 102,
"end_line": 42,
"start_col": 15,
"start_line": 42
} |
|
Prims.Tot | val call_c:call_c_t | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win)) | val call_c:call_c_t
let call_c:call_c_t = | false | null | false | IX64.wrap_weak_stdcall c dom (W.mk_prediction c dom [] (v c IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.AsLowStar.Test.c",
"Vale.AsLowStar.Test.dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Test.pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.v",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win)) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val call_c:call_c_t | [] | Vale.AsLowStar.Test.call_c | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.Test.call_c_t | {
"end_col": 47,
"end_line": 46,
"start_col": 24,
"start_line": 45
} |
Prims.Tot | val lowstar_Memcpy:lowstar_Memcpy_t | [
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win)) | val lowstar_Memcpy:lowstar_Memcpy_t
let lowstar_Memcpy:lowstar_Memcpy_t = | false | null | false | IX64.wrap_weak_stdcall code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.AsLowStar.Test.code_Memcpy",
"Vale.AsLowStar.Test.vm_dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Test.vm_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.vm_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.vm_lemma",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_Memcpy:lowstar_Memcpy_t | [] | Vale.AsLowStar.Test.lowstar_Memcpy | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.Test.lowstar_Memcpy_t | {
"end_col": 73,
"end_line": 128,
"start_col": 2,
"start_line": 125
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win)) | let lowstar_Memcpy_t = | false | null | false | IX64.as_lowstar_sig_t_weak_stdcall code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.AsLowStar.Test.code_Memcpy",
"Vale.AsLowStar.Test.vm_dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.AsLowStar.Test.vm_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.vm_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.vm_lemma",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_Memcpy_t : Type0 | [] | Vale.AsLowStar.Test.lowstar_Memcpy_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 73,
"end_line": 121,
"start_col": 2,
"start_line": 115
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma' | let aesni_lemma = | false | null | false | as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma' | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_t",
"Vale.AsLowStar.ValeSig.vale_sig_stdcall",
"Vale.AsLowStar.Test.aesni_dom",
"Vale.AsLowStar.Test.aesni_pre",
"Vale.AsLowStar.Test.aesni_post",
"Vale.AsLowStar.Test.aesni_lemma'"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2" | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aesni_lemma : Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.AsLowStar.Test.aesni_pre Vale.AsLowStar.Test.aesni_post | [] | Vale.AsLowStar.Test.aesni_lemma | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.AsLowStar.Test.aesni_pre Vale.AsLowStar.Test.aesni_post | {
"end_col": 81,
"end_line": 232,
"start_col": 18,
"start_line": 232
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8) | let test (x: b64) = | false | null | false | assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.b64",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.buffer_length",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Prims.op_Division",
"LowStar.Monotonic.Buffer.length",
"Vale.Interop.Types.base_typ_as_type",
"LowStar.Buffer.trivial_preorder",
"Prims.unit",
"FStar.Mul.op_Star",
"Vale.Interop.Types.view_n"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val test : x: Vale.AsLowStar.Test.b64 -> Prims.unit | [] | Vale.AsLowStar.Test.test | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.AsLowStar.Test.b64 -> Prims.unit | {
"end_col": 63,
"end_line": 142,
"start_col": 2,
"start_line": 141
} |
|
Prims.Tot | val ta_dom:ta_dom: list td {List.length ta_dom <= 20} | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y | val ta_dom:ta_dom: list td {List.length ta_dom <= 20}
let ta_dom:ta_dom: list td {List.length ta_dom <= 20} = | false | null | false | let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Prims.Cons",
"Vale.AsLowStar.Test.t64_imm",
"Prims.Nil"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ta_dom:ta_dom: list td {List.length ta_dom <= 20} | [] | Vale.AsLowStar.Test.ta_dom | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ta_dom: Prims.list Vale.Interop.Base.td {FStar.List.Tot.Base.length ta_dom <= 20} | {
"end_col": 3,
"end_line": 277,
"start_col": 48,
"start_line": 274
} |
Prims.Tot | val lowstar_aesni:lowstar_aesni_t | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win)) | val lowstar_aesni:lowstar_aesni_t
let lowstar_aesni:lowstar_aesni_t = | false | null | false | IX64.wrap_weak_stdcall (coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.X64.MemoryAdapters.coerce",
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.code_aesni",
"Vale.AsLowStar.Test.aesni_dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Test.aesni_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.aesni_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.aesni_lemma",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_aesni:lowstar_aesni_t | [] | Vale.AsLowStar.Test.lowstar_aesni | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.Test.lowstar_aesni_t | {
"end_col": 77,
"end_line": 252,
"start_col": 2,
"start_line": 249
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma' | let vm_lemma = | false | null | false | as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma' | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_t",
"Vale.AsLowStar.ValeSig.vale_sig_stdcall",
"Vale.AsLowStar.Test.vm_dom",
"Vale.AsLowStar.Test.vm_pre",
"Vale.AsLowStar.Test.vm_post",
"Vale.AsLowStar.Test.vm_lemma'"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vm_lemma : Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.AsLowStar.Test.vm_pre Vale.AsLowStar.Test.vm_post | [] | Vale.AsLowStar.Test.vm_lemma | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.AsLowStar.Test.vm_pre Vale.AsLowStar.Test.vm_post | {
"end_col": 69,
"end_line": 108,
"start_col": 15,
"start_line": 108
} |
|
FStar.HyperStack.ST.Stack | val aesni_Test: Prims.unit
-> Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) | [
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x | val aesni_Test: Prims.unit
-> Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) = | true | null | false | let x, _ = lowstar_aesni_normal_t () in
x | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [] | [
"Prims.unit",
"FStar.UInt64.t",
"FStar.Ghost.erased",
"Vale.Interop.X64.as_lowstar_sig_ret",
"Vale.Interop.X64.als_ret",
"Vale.AsLowStar.Test.lowstar_aesni_normal_t",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_True",
"Prims.l_imp",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"FStar.UInt64.v",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.CPU_Features_s.aesni_enabled",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aesni_Test: Prims.unit
-> Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled) | [] | Vale.AsLowStar.Test.aesni_Test | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.HyperStack.ST.Stack FStar.UInt64.t | {
"end_col": 3,
"end_line": 268,
"start_col": 3,
"start_line": 266
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_ta_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_ta)
ta_dom
[]
_
_
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win)) | let lowstar_ta_t = | false | null | false | IX64.as_lowstar_sig_t_weak_stdcall (coerce code_ta)
ta_dom
[]
_
_
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.X64.MemoryAdapters.coerce",
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.code_ta",
"Vale.AsLowStar.Test.ta_dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.AsLowStar.Test.ta_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.ta_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.ta_lemma",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__]
let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
=
let va_s1, f = TA.va_lemma_Test code va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
in
va_s1, f
(* Prove that vm_lemma' has the required type *)
let ta_lemma = as_t #(VSig.vale_sig_stdcall ta_pre ta_post) ta_lemma'
let code_ta = TA.va_code_Test IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_ta_t : Type0 | [] | Vale.AsLowStar.Test.lowstar_ta_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 65,
"end_line": 386,
"start_col": 2,
"start_line": 380
} |
|
Prims.Tot | val aesni_dom:IX64.arity_ok_stdcall td | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aesni_dom : IX64.arity_ok_stdcall td = [] | val aesni_dom:IX64.arity_ok_stdcall td
let aesni_dom:IX64.arity_ok_stdcall td = | false | null | false | [] | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Prims.Nil",
"Vale.Interop.Base.td"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = [] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aesni_dom:IX64.arity_ok_stdcall td | [] | Vale.AsLowStar.Test.aesni_dom | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.X64.arity_ok_stdcall Vale.Interop.Base.td | {
"end_col": 45,
"end_line": 188,
"start_col": 43,
"start_line": 188
} |
Prims.Tot | val empty_list (#a: _) : l: list a {List.length l = 0} | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let empty_list #a : l:list a {List.length l = 0} = [] | val empty_list (#a: _) : l: list a {List.length l = 0}
let empty_list #a : l: list a {List.length l = 0} = | false | null | false | [] | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Prims.Nil",
"Prims.list",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val empty_list (#a: _) : l: list a {List.length l = 0} | [] | Vale.AsLowStar.Test.empty_list | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | l: Prims.list a {FStar.List.Tot.Base.length l = 0} | {
"end_col": 53,
"end_line": 185,
"start_col": 51,
"start_line": 185
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win)) | let lowstar_aesni_t = | false | null | false | IX64.as_lowstar_sig_t_weak_stdcall (coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.X64.MemoryAdapters.coerce",
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.code_aesni",
"Vale.AsLowStar.Test.aesni_dom",
"Vale.AsLowStar.Test.empty_list",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.AsLowStar.Test.aesni_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.aesni_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.aesni_lemma",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__] | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_aesni_t : Type0 | [] | Vale.AsLowStar.Test.lowstar_aesni_t | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 77,
"end_line": 245,
"start_col": 2,
"start_line": 239
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8) | let itest (x: ib64) = | false | null | false | assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.ib64",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.buffer_length",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Prims.op_Division",
"LowStar.Monotonic.Buffer.length",
"Vale.Interop.Types.base_typ_as_type",
"LowStar.ImmutableBuffer.immutable_preorder",
"Prims.unit",
"FStar.Mul.op_Star",
"Vale.Interop.Types.view_n"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val itest : x: Vale.AsLowStar.Test.ib64 -> Prims.unit | [] | Vale.AsLowStar.Test.itest | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.AsLowStar.Test.ib64 -> Prims.unit | {
"end_col": 66,
"end_line": 145,
"start_col": 2,
"start_line": 144
} |
|
Prims.Pure | val with_len (l: list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m == l /\ List.length m == normalize_term (List.length l)) | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l | val with_len (l: list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m == l /\ List.length m == normalize_term (List.length l))
let with_len (l: list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m == l /\ List.length m == normalize_term (List.length l)) = | false | null | false | l | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [] | [
"Prims.list",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"FStar.List.Tot.Base.length",
"FStar.Pervasives.normalize_term"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True) | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val with_len (l: list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m == l /\ List.length m == normalize_term (List.length l)) | [] | Vale.AsLowStar.Test.with_len | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | l: Prims.list 'a -> Prims.Pure (Prims.list 'a) | {
"end_col": 5,
"end_line": 210,
"start_col": 4,
"start_line": 210
} |
Prims.Tot | val lowstar_ta:lowstar_ta_t | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lowstar_ta : lowstar_ta_t =
IX64.wrap_weak_stdcall
(coerce code_ta)
ta_dom
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win)) | val lowstar_ta:lowstar_ta_t
let lowstar_ta:lowstar_ta_t = | false | null | false | IX64.wrap_weak_stdcall (coerce code_ta)
ta_dom
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win)) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.X64.MemoryAdapters.coerce",
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Decls.va_code",
"Vale.AsLowStar.Test.code_ta",
"Vale.AsLowStar.Test.ta_dom",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Test.ta_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.AsLowStar.Test.ta_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.AsLowStar.Test.ta_lemma",
"Vale.Interop.Assumptions.win"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__]
let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
=
let va_s1, f = TA.va_lemma_Test code va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
in
va_s1, f
(* Prove that vm_lemma' has the required type *)
let ta_lemma = as_t #(VSig.vale_sig_stdcall ta_pre ta_post) ta_lemma'
let code_ta = TA.va_code_Test IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_ta_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_ta)
ta_dom
[]
_
_
(W.mk_prediction code_ta ta_dom [] (ta_lemma code_ta IA.win))
(* And here's the check_aesni wrapper itself *) | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lowstar_ta:lowstar_ta_t | [] | Vale.AsLowStar.Test.lowstar_ta | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.Test.lowstar_ta_t | {
"end_col": 65,
"end_line": 393,
"start_col": 2,
"start_line": 390
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ta_lemma = as_t #(VSig.vale_sig_stdcall ta_pre ta_post) ta_lemma' | let ta_lemma = | false | null | false | as_t #(VSig.vale_sig_stdcall ta_pre ta_post) ta_lemma' | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [
"total"
] | [
"Vale.AsLowStar.Test.as_t",
"Vale.AsLowStar.ValeSig.vale_sig_stdcall",
"Vale.AsLowStar.Test.ta_dom",
"Vale.AsLowStar.Test.ta_pre",
"Vale.AsLowStar.Test.ta_post",
"Vale.AsLowStar.Test.ta_lemma'"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__]
let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
=
let va_s1, f = TA.va_lemma_Test code va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
in
va_s1, f | false | true | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ta_lemma : Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.AsLowStar.Test.ta_pre Vale.AsLowStar.Test.ta_post | [] | Vale.AsLowStar.Test.ta_lemma | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.AsLowStar.Test.ta_pre Vale.AsLowStar.Test.ta_post | {
"end_col": 69,
"end_line": 373,
"start_col": 15,
"start_line": 373
} |
|
Prims.Ghost | val vm_lemma' (code: V.va_code) (_win: bool) (dst: b64) (src: ib64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires vm_pre code dst src va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) | [
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f) | val vm_lemma' (code: V.va_code) (_win: bool) (dst: b64) (src: ib64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires vm_pre code dst src va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1)))
let vm_lemma' (code: V.va_code) (_win: bool) (dst: b64) (src: ib64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires vm_pre code dst src va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) = | false | null | false | let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f) | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.AsLowStar.Test.b64",
"Vale.AsLowStar.Test.ib64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.Test.X64.Vale_memcpy.va_lemma_Memcpy",
"Vale.Interop.Assumptions.win",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Vale.AsLowStar.Test.vm_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall",
"Vale.AsLowStar.Test.vm_post",
"Vale.X64.Memory.buffer_readable",
"Vale.X64.State.vs_get_vale_heap",
"Vale.X64.Memory.buffer_writeable",
"Vale.X64.Memory.modifies",
"Vale.X64.Memory.loc_union",
"Vale.X64.Memory.loc_buffer",
"Vale.X64.Memory.loc_none"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1) | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vm_lemma' (code: V.va_code) (_win: bool) (dst: b64) (src: ib64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires vm_pre code dst src va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) | [] | Vale.AsLowStar.Test.vm_lemma' | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
dst: Vale.AsLowStar.Test.b64 ->
src: Vale.AsLowStar.Test.ib64 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 12,
"end_line": 105,
"start_col": 3,
"start_line": 102
} |
Prims.Ghost | val aesni_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires aesni_pre code va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f)) | [
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win | val aesni_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires aesni_pre code va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
let aesni_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires aesni_pre code va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f)) = | false | null | false | VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.X64.Decls.va_state",
"Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_aesni_stdcall",
"Vale.Interop.Assumptions.win",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.Decls.va_fuel",
"Vale.AsLowStar.Test.aesni_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall",
"Vale.AsLowStar.Test.aesni_post"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\ | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aesni_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires aesni_pre code va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f)) | [] | Vale.AsLowStar.Test.aesni_lemma' | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | code: Vale.X64.Decls.va_code -> _win: Prims.bool -> va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 52,
"end_line": 227,
"start_col": 3,
"start_line": 227
} |
Prims.Ghost | val ta_lemma'
(code: V.va_code)
(_win: bool)
(arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: ib64)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1))) | [
{
"abbrev": true,
"full_module": "Vale.Test.X64.Args",
"short_module": "TA"
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.X64.Cpuidstdcall",
"short_module": "VC"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "LBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": "MB"
},
{
"abbrev": true,
"full_module": "LowStar.ImmutableBuffer",
"short_module": "IB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Test.X64.Vale_memcpy",
"short_module": "VM"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AsLowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
=
let va_s1, f = TA.va_lemma_Test code va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
in
va_s1, f | val ta_lemma'
(code: V.va_code)
(_win: bool)
(arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: ib64)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))
let ta_lemma'
(code: V.va_code)
(_win: bool)
(arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: ib64)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1))) = | false | null | false | let va_s1, f =
TA.va_lemma_Test code va_s0 IA.win (as_vale_immbuffer arg0) (as_vale_immbuffer arg1)
(as_vale_immbuffer arg2) (as_vale_immbuffer arg3) (as_vale_immbuffer arg4)
(as_vale_immbuffer arg5) (as_vale_immbuffer arg6) (as_vale_immbuffer arg7)
in
va_s1, f | {
"checked_file": "Vale.AsLowStar.Test.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Test.X64.Vale_memcpy.fsti.checked",
"Vale.Test.X64.Args.fsti.checked",
"Vale.Lib.X64.Cpuidstdcall.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.ImmutableBuffer.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AsLowStar.Test.fst"
} | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.AsLowStar.Test.ib64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.Test.X64.Args.va_lemma_Test",
"Vale.Interop.Assumptions.win",
"Vale.X64.MemoryAdapters.as_vale_immbuffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt64",
"Vale.AsLowStar.Test.ta_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall",
"Vale.AsLowStar.Test.ta_post",
"Vale.X64.Memory.buffer_readable",
"Vale.X64.State.vs_get_vale_heap",
"Vale.X64.Memory.modifies",
"Vale.X64.Memory.loc_none"
] | [] | module Vale.AsLowStar.Test
open FStar.Mul
open Vale.Interop.Base
module ME = Vale.X64.Memory
module IA = Vale.Interop.Assumptions
module V = Vale.X64.Decls
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module W = Vale.AsLowStar.Wrapper
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
////////////////////////////////////////////////////////////////////////////////
//First a little standalone, toy experiment
[@__reduce__]
let b64 = buf_t TUInt8 TUInt64
[@__reduce__]
let ib64 = ibuf_t TUInt8 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt8 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let t64_imm = TD_ImmBuffer TUInt8 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let (dom : list td{List.length dom <= 20}) =
let y = [t64_mod;t64_imm] in
assert_norm (List.length y = 2);
y
assume val pre : VSig.vale_pre dom
assume val post : VSig.vale_post dom
assume val v: VSig.vale_sig_stdcall pre post
assume val c: V.va_code
[@__reduce__]
let call_c_t = IX64.as_lowstar_sig_t_weak_stdcall c dom [] _ _ (W.mk_prediction c dom [] (v c IA.win))
let call_c : call_c_t = IX64.wrap_weak_stdcall
c dom (W.mk_prediction c dom [] (v c IA.win))
let call_c_normal_t : normal call_c_t = as_normal_t #call_c_t call_c
//You can ask emacs to show you the type of call_c_normal_t ...
////////////////////////////////////////////////////////////////////////////////
//Now memcpy
module VM = Vale.Test.X64.Vale_memcpy
[@__reduce__]
let vm_dom = [t64_mod; t64_imm]
open Vale.X64.MemoryAdapters
(* Need to rearrange the order of arguments *)
[@__reduce__]
let vm_pre : VSig.vale_pre vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state) ->
VM.va_req_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src)
[@__reduce__]
let vm_post : VSig.vale_post vm_dom =
fun (c:V.va_code)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VM.va_ens_Memcpy c va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) va_s1 f
module VS = Vale.X64.State
#reset-options "--print_effect_args --z3rlimit 200"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let vm_lemma'
(code:V.va_code)
(_win:bool)
(dst:b64)
(src:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
vm_pre code dst src va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
vm_post code dst src va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\
ME.buffer_writeable (as_vale_buffer dst) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
))
=
let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;
(va_s1, f)
(* Prove that vm_lemma' has the required type *)
let vm_lemma = as_t #(VSig.vale_sig_stdcall vm_pre vm_post) vm_lemma'
let code_Memcpy = VM.va_code_Memcpy IA.win
(* Here's the type expected for the memcpy wrapper *)
[@__reduce__]
let lowstar_Memcpy_t =
IX64.as_lowstar_sig_t_weak_stdcall
code_Memcpy
vm_dom
[]
_
_
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
(* And here's the memcpy wrapper itself *)
let lowstar_Memcpy : lowstar_Memcpy_t =
IX64.wrap_weak_stdcall
code_Memcpy
vm_dom
(W.mk_prediction code_Memcpy vm_dom [] (vm_lemma code_Memcpy IA.win))
let lowstar_Memcpy_normal_t //: normal lowstar_Memcpy_t
= as_normal_t #lowstar_Memcpy_t lowstar_Memcpy
module B = LowStar.Buffer
module IB = LowStar.ImmutableBuffer
module MB = LowStar.Monotonic.Buffer
open FStar.HyperStack.ST
module M = Vale.X64.Memory
let test (x:b64) =
assert (V.buffer_length (as_vale_buffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_buffer x) == B.length x / 8)
let itest (x:ib64) =
assert (V.buffer_length (as_vale_immbuffer x) == (B.length x * view_n TUInt8) / view_n TUInt64);
assert (V.buffer_length (as_vale_immbuffer x) == B.length x / 8)
module T = FStar.Tactics
#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection'"
module LBV = LowStar.BufferView.Up
module DV = LowStar.BufferView.Down
#push-options "--ext compat:normalizer_memo_ignore_cfg"
let memcpy_Test
(dst:B.buffer UInt8.t{B.length dst % 8 == 0})
(src:IB.ibuffer UInt8.t{B.length src % 8 == 0})
: Stack UInt64.t
(requires fun h0 ->
B.live h0 dst /\
B.live h0 src /\
B.disjoint dst src /\
B.length dst == 16 /\
B.length src == 16)
(ensures fun h0 _ h1 ->
B.modifies (B.loc_buffer dst) h0 h1 /\
B.live h1 src /\
B.live h1 dst)
// B.as_seq h1 dst == B.as_seq h1 src)
// by (T.dump "A") (* in case you want to look at the VC *)
= IB.inhabited_immutable_buffer_is_distinct_from_buffer (UInt8.uint_to_t 0) src dst;
let (x, _) = lowstar_Memcpy_normal_t dst src () in //This is a call to the interop wrapper
let h1 = get () in
// let v = Vale.Interop.Views.up_view64 in
// assert (DV.length_eq (get_downview dst);
// DV.length_eq (get_downview src);
// Seq.equal (LBV.as_seq h1 (LBV.mk_buffer (get_downview dst) v))
// (LBV.as_seq h1 (LBV.mk_buffer (get_downview src) v)));
// lbv_as_seq_eq dst src Vale.Interop.Views.up_view64 h1; //And a lemma to rephrase the Vale postcondition
x //with equalities of buffer views
//back to equalities of buffers
#pop-options
module VC = Vale.Lib.X64.Cpuidstdcall
[@__reduce__]
let empty_list #a : l:list a {List.length l = 0} = []
[@__reduce__]
let aesni_dom : IX64.arity_ok_stdcall td = []
(* Need to rearrange the order of arguments *)
[@__reduce__]
let aesni_pre : VSig.vale_pre aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state) ->
VC.va_req_Check_aesni_stdcall c va_s0 IA.win
[@__reduce__]
let aesni_post : VSig.vale_post aesni_dom =
fun (c:V.va_code)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f
[@__reduce__]
let with_len (l:list 'a)
: Pure (list 'a)
(requires True)
(ensures fun m -> m==l /\ List.length m == normalize_term (List.length l))
= l
#set-options "--max_fuel 0 --max_ifuel 1 --z3rlimit_factor 2"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let aesni_lemma'
(code:V.va_code)
(_win:bool)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
aesni_pre code va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
aesni_post code va_s0 va_s1 f))
= VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit_factor 2"
(* Prove that vm_lemma' has the required type *)
let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'
let code_aesni = VC.va_code_Check_aesni_stdcall IA.win
(* Here's the type expected for the check_aesni wrapper *)
[@__reduce__]
let lowstar_aesni_t =
IX64.as_lowstar_sig_t_weak_stdcall
(coerce code_aesni)
aesni_dom
empty_list
_
_
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
(* And here's the check_aesni wrapper itself *)
let lowstar_aesni : lowstar_aesni_t =
IX64.wrap_weak_stdcall
(coerce code_aesni)
aesni_dom
(W.mk_prediction code_aesni aesni_dom [] (aesni_lemma code_aesni IA.win))
let lowstar_aesni_normal_t //: normal lowstar_aesni_t
= as_normal_t #lowstar_aesni_t lowstar_aesni
open Vale.X64.CPU_Features_s
#set-options "--print_full_names"
let aesni_Test ()
: Stack UInt64.t
(requires fun h0 -> True)
(ensures fun h0 ret_val h1 -> (UInt64.v ret_val) =!= 0 ==> aesni_enabled /\ pclmulqdq_enabled)
// by (T.dump "A") (* in case you want to look at the VC *)
=
let (x, _) = lowstar_aesni_normal_t () in //This is a call to the interop wrapper
x
module TA = Vale.Test.X64.Args
[@__reduce__]
let (ta_dom:list td{List.length ta_dom <= 20}) =
let y = [t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm; t64_imm] in
assert_norm (List.length y = 8);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let ta_pre : VSig.vale_pre ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state) ->
TA.va_req_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
[@__reduce__]
let ta_post : VSig.vale_post ta_dom =
fun (c:V.va_code)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
TA.va_ens_Test c va_s0 IA.win
(as_vale_immbuffer arg0)
(as_vale_immbuffer arg1)
(as_vale_immbuffer arg2)
(as_vale_immbuffer arg3)
(as_vale_immbuffer arg4)
(as_vale_immbuffer arg5)
(as_vale_immbuffer arg6)
(as_vale_immbuffer arg7)
va_s1 f
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
(* The vale lemma doesn't quite suffice to prove the modifies clause
expected of the interop layer *)
[@__reduce__]
let ta_lemma'
(code:V.va_code)
(_win:bool)
(arg0:ib64)
(arg1:ib64)
(arg2:ib64)
(arg3:ib64)
(arg4:ib64)
(arg5:ib64)
(arg6:ib64)
(arg7:ib64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\ | false | false | Vale.AsLowStar.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ta_lemma'
(code: V.va_code)
(_win: bool)
(arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: ib64)
(va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\
ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1))) | [] | Vale.AsLowStar.Test.ta_lemma' | {
"file_name": "vale/code/arch/x64/interop/Vale.AsLowStar.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
arg0: Vale.AsLowStar.Test.ib64 ->
arg1: Vale.AsLowStar.Test.ib64 ->
arg2: Vale.AsLowStar.Test.ib64 ->
arg3: Vale.AsLowStar.Test.ib64 ->
arg4: Vale.AsLowStar.Test.ib64 ->
arg5: Vale.AsLowStar.Test.ib64 ->
arg6: Vale.AsLowStar.Test.ib64 ->
arg7: Vale.AsLowStar.Test.ib64 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 12,
"end_line": 370,
"start_col": 2,
"start_line": 359
} |
Prims.Tot | [@@ FStar.Tactics.Typeclasses.tcinstance]
val showable_list: a: Type -> tac_showable a -> tac_showable (list a) | [
{
"abbrev": false,
"full_module": "Pulse.Syntax.Printer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | instance showable_list (a:Type) (_ : tac_showable a) : tac_showable (list a) = {
show = string_of_list show;
} | [@@ FStar.Tactics.Typeclasses.tcinstance]
val showable_list: a: Type -> tac_showable a -> tac_showable (list a)
[@@ FStar.Tactics.Typeclasses.tcinstance]
let showable_list (a: Type) (_: tac_showable a) : tac_showable (list a) = | false | null | false | { show = string_of_list show } | {
"checked_file": "Pulse.Show.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Show.fst"
} | [
"total"
] | [
"Pulse.Show.tac_showable",
"Pulse.Show.Mktac_showable",
"Prims.list",
"FStar.Tactics.Util.string_of_list",
"Pulse.Show.show"
] | [] | module Pulse.Show
open FStar.Tactics
open FStar.Tactics.Typeclasses
open Pulse.Typing
open Pulse.Syntax.Base
open Pulse.Syntax.Printer
class tac_showable (a:Type) = {
show : a -> Tac string;
}
instance _ : tac_showable string = {
show = (fun s -> s);
}
instance _ : tac_showable unit = {
show = (fun () -> "()");
}
instance _ : tac_showable bool = {
show = (fun b -> string_of_bool b);
}
instance _ : tac_showable int = {
show = (fun b -> string_of_int b);
}
instance showable_option (a:Type) (_ : tac_showable a) : tac_showable (option a) = {
show = (function None -> "None"
| Some v -> "Some " ^ show v);
} | false | false | Pulse.Show.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | [@@ FStar.Tactics.Typeclasses.tcinstance]
val showable_list: a: Type -> tac_showable a -> tac_showable (list a) | [] | Pulse.Show.showable_list | {
"file_name": "lib/steel/pulse/Pulse.Show.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | a: Type -> _: Pulse.Show.tac_showable a -> Pulse.Show.tac_showable (Prims.list a) | {
"end_col": 29,
"end_line": 35,
"start_col": 2,
"start_line": 35
} |
Prims.Tot | [@@ FStar.Tactics.Typeclasses.tcinstance]
val showable_option: a: Type -> tac_showable a -> tac_showable (option a) | [
{
"abbrev": false,
"full_module": "Pulse.Syntax.Printer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Typeclasses",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | instance showable_option (a:Type) (_ : tac_showable a) : tac_showable (option a) = {
show = (function None -> "None"
| Some v -> "Some " ^ show v);
} | [@@ FStar.Tactics.Typeclasses.tcinstance]
val showable_option: a: Type -> tac_showable a -> tac_showable (option a)
[@@ FStar.Tactics.Typeclasses.tcinstance]
let showable_option (a: Type) (_: tac_showable a) : tac_showable (option a) = | false | null | false | {
show
=
(function
| None -> "None"
| Some v -> "Some " ^ show v)
} | {
"checked_file": "Pulse.Show.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Show.fst"
} | [
"total"
] | [
"Pulse.Show.tac_showable",
"Pulse.Show.Mktac_showable",
"FStar.Pervasives.Native.option",
"Prims.string",
"Prims.op_Hat",
"Pulse.Show.show"
] | [] | module Pulse.Show
open FStar.Tactics
open FStar.Tactics.Typeclasses
open Pulse.Typing
open Pulse.Syntax.Base
open Pulse.Syntax.Printer
class tac_showable (a:Type) = {
show : a -> Tac string;
}
instance _ : tac_showable string = {
show = (fun s -> s);
}
instance _ : tac_showable unit = {
show = (fun () -> "()");
}
instance _ : tac_showable bool = {
show = (fun b -> string_of_bool b);
}
instance _ : tac_showable int = {
show = (fun b -> string_of_int b);
} | false | false | Pulse.Show.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | [@@ FStar.Tactics.Typeclasses.tcinstance]
val showable_option: a: Type -> tac_showable a -> tac_showable (option a) | [] | Pulse.Show.showable_option | {
"file_name": "lib/steel/pulse/Pulse.Show.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | a: Type -> _: Pulse.Show.tac_showable a
-> Pulse.Show.tac_showable (FStar.Pervasives.Native.option a) | {
"end_col": 47,
"end_line": 31,
"start_col": 2,
"start_line": 30
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) | let tabs_t (d: 'a) = | false | null | false |
#g: stt_env ->
#u: universe ->
#ty: term ->
q: option qualifier ->
ppname: ppname ->
t_typing: tot_typing g ty (tm_type u) {t_typing << d} ->
#body: st_term ->
#x: var{None? (lookup g x) /\ ~(x `Set.mem` (freevars_st body))} ->
#c: comp ->
body_typing: st_typing (push_binding g x ppname ty) (open_st_term body x) c {body_typing << d}
-> GTot
(RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name
(elab_term ty)
(elab_qual q)
(RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow ({ binder_ty = ty; binder_ppname = ppname }) q (close_comp c x)))) | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"total"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.qualifier",
"Pulse.Syntax.Base.ppname",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Pure.tm_type",
"Prims.precedes",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.var",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"Prims.l_not",
"FStar.Set.mem",
"Pulse.Syntax.Naming.freevars_st",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Naming.open_st_term",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Reflection.Util.mk_abs_with_name",
"Pulse.Syntax.Base.__proj__Mkppname__item__name",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Elaborate.Pure.elab_qual",
"FStar.Reflection.Typing.close_term",
"Pulse.Elaborate.Core.elab_st_typing",
"Pulse.Syntax.Pure.tm_arrow",
"Pulse.Syntax.Base.Mkbinder",
"Pulse.Syntax.Naming.close_comp"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tabs_t : d: 'a -> Type0 | [] | Pulse.Soundness.tabs_t | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | d: 'a -> Type0 | {
"end_col": 90,
"end_line": 46,
"start_col": 4,
"start_line": 34
} |
|
FStar.Pervasives.Lemma | val soundness_lemma (g: stt_env) (t: st_term) (c: comp) (d: st_typing g t c)
: Lemma (ensures RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let soundness_lemma
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c)
: Lemma (ensures RT.tot_typing (elab_env g)
(elab_st_typing d)
(elab_comp c))
= FStar.Squash.bind_squash
#(st_typing g t c)
()
(fun dd -> FStar.Squash.return_squash (soundness g t c d)) | val soundness_lemma (g: stt_env) (t: st_term) (c: comp) (d: st_typing g t c)
: Lemma (ensures RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let soundness_lemma (g: stt_env) (t: st_term) (c: comp) (d: st_typing g t c)
: Lemma (ensures RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = | false | null | true | FStar.Squash.bind_squash #(st_typing g t c)
()
(fun dd -> FStar.Squash.return_squash (soundness g t c d)) | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"lemma"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"FStar.Squash.bind_squash",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Core.elab_st_typing",
"Pulse.Elaborate.Pure.elab_comp",
"FStar.Squash.return_squash",
"Pulse.Soundness.soundness",
"Prims.squash",
"Prims.unit",
"Prims.l_True",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing
let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ ->
Lift.elab_lift_stt_atomic_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a, reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
_ (tot_typing_soundness reveal_a_typing)
let frame_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Frame? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Frame _ e c frame frame_typing e_typing = d in
let r_e_typing = soundness _ _ _ e_typing in
LN.st_typing_ln e_typing;
Frame.elab_frame_typing g _ _ frame frame_typing r_e_typing
let stapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STApp _ head formal q res arg head_typing arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_head_typing
: RT.tot_typing _ r_head
(elab_term (tm_arrow {binder_ty=formal;binder_ppname=ppname_default} q res))
= tot_typing_soundness head_typing
in
let r_arg_typing = tot_typing_soundness arg_typing in
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing
//
// We have G |- head : Ghost (x:t -> Total res) -- (1)
// G |- arg : Ghost t -- (2)
// G,x:t |- non_informative (open res x) -- (3)
//
// We first lift (1) to G |- head : Ghost (x:t -> Ghost res)
// Then apply T_App in reflection typing to derive
// G |- head arg : Ghost (open res arg) -- (4)
// and then promote (4) to Total using a substitution lemma on (3)
//
let stghostapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STGhostApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STGhostApp _ head formal q res arg x head_typing d_non_info arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_binder = {binder_ty=formal;binder_ppname=ppname_default} in
let head_t = tm_arrow r_binder q res in
let r_head_t = mk_arrow_with_name ppname_default.name (elab_term formal, elab_qual q)
(elab_comp res) in
let r_head_typing : RT.ghost_typing _ r_head r_head_t
= ghost_typing_soundness head_typing in
let r_arg_typing = ghost_typing_soundness arg_typing in
assume (elab_env (push_binding g x ppname_default formal) ==
RT.extend_env (elab_env g) x (elab_term formal));
assume ((T.E_Total, elab_comp (open_comp_with res (null_var x))) ==
RT.open_comp_typ (T.E_Total, elab_comp res) x);
assume ((T.E_Ghost, elab_comp (open_comp_with res (null_var x))) ==
RT.open_comp_typ (T.E_Ghost, elab_comp res) x);
let d_rel_comp
: RT.related_comp (elab_env (push_binding g x ppname_default formal))
(T.E_Total, elab_comp (open_comp_with res (null_var x)))
RT.R_Sub
(T.E_Ghost, elab_comp (open_comp_with res (null_var x))) =
RT.Relc_total_ghost _ _ in
let r_head_t_ghost = mk_ghost_arrow_with_name ppname_default.name (elab_term formal, elab_qual q)
(elab_comp res) in
assert (r_head_t == RT.mk_arrow_ct (elab_term formal) (elab_qual q) (T.E_Total, elab_comp res));
assert (r_head_t_ghost == RT.mk_arrow_ct (elab_term formal) (elab_qual q) (T.E_Ghost, elab_comp res));
assume (None? (RT.lookup_bvar (elab_env g) x) /\
~ (x `Set.mem` ((RT.freevars_comp_typ (T.E_Total, elab_comp res)) `Set.union`
(RT.freevars_comp_typ (T.E_Ghost, elab_comp res)))));
let d_rel_t_arrow
: RT.related (elab_env g)
r_head_t
RT.R_Sub
r_head_t_ghost
= RT.Rel_arrow _ (elab_term formal) (elab_term formal) (elab_qual q) (T.E_Total, elab_comp res) (T.E_Ghost, elab_comp res)
RT.R_Sub x (RT.Rel_equiv _ _ _ _ (RT.Rel_refl _ _ _))
d_rel_comp in
let r_head_typing : RT.ghost_typing _ r_head r_head_t_ghost =
RT.T_Sub _ _ _ _ r_head_typing (RT.Relc_typ _ _ _ T.E_Ghost _ d_rel_t_arrow) in
let d : RT.typing (elab_env g) (elab_st_typing d) (T.E_Ghost, elab_comp (open_comp_with res arg)) =
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing in
let E d_non_info = d_non_info in
let d_non_info
: RT.non_informative (elab_env (push_binding g x ppname_default formal))
(elab_comp (open_comp_with res (null_var x))) =
d_non_info in
// TODO: substitution lemma in RT for non_informative judgment
let d_non_info
: RT.non_informative (elab_env g) (elab_comp (open_comp_with res arg)) = magic () in
RT.T_Sub _ _ _ _ d (RT.Relc_ghost_total _ _ d_non_info)
let stequiv_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Equiv? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Equiv _ e c c' e_typing equiv = d in
LN.st_typing_ln d;
LN.st_typing_ln e_typing;
let r_e_typing = soundness _ _ _ e_typing in
STEquiv.st_equiv_soundness _ _ _ equiv _ r_e_typing
#push-options "--query_stats --fuel 2 --ifuel 2 --z3rlimit_factor 30"
let bind_soundness
(#g:stt_env)
(#t:st_term)
(#c:comp)
(d:st_typing g t c{T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g)
(elab_st_typing d)
(elab_comp c))
= let T_Bind _ e1 e2 c1 c2 _ x c e1_typing t_typing e2_typing bc = d in
LN.st_typing_ln e1_typing;
LN.st_typing_ln e2_typing;
FV.st_typing_freevars_inv e1_typing x;
let r1_typing
: RT.tot_typing _ _ (elab_comp c1)
= soundness _ _ _ e1_typing
in
let r2_typing
: RT.tot_typing _ _ (elab_term (tm_arrow (null_binder (comp_res c1)) None (close_comp c2 x)))
= mk_t_abs None _ t_typing e2_typing
in
match bc with
| Bind_comp _ _ _ _ t2_typing y post2_typing ->
Bind.elab_bind_typing g _ _ _ x _ r1_typing _ r2_typing bc
(tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
| Bind_comp_ghost_l _ _ _ _ (| reveal_a, reveal_a_typing |) t2_typing y post2_typing ->
Bind.elab_bind_ghost_l_typing g _ _ _ x _ r1_typing
_ r2_typing bc
(tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
(elab_term reveal_a)
(tot_typing_soundness reveal_a_typing)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b, reveal_b_typing |) t2_typing y post2_typing ->
Bind.elab_bind_ghost_r_typing g _ _ _ x _ r1_typing
_ r2_typing bc
(tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
(elab_term reveal_b)
(tot_typing_soundness reveal_b_typing)
#pop-options
#push-options "--z3rlimit_factor 4 --fuel 4 --ifuel 2"
let if_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_If? d})
(soundness:soundness_t d)
(ct_soundness: (g:stt_env -> c:comp -> uc:universe ->
d':comp_typing g c uc{d' << d} ->
GTot (RT.tot_typing (elab_env g)
(elab_comp c)
(RT.tm_type uc))))
: GTot (RT.tot_typing (elab_env g)
(elab_st_typing d)
(elab_comp c)) =
let T_If _ b e1 e2 _ u_c hyp b_typing e1_typing e2_typing (E c_typing) = d in
let rb_typing : RT.tot_typing (elab_env g)
(elab_term b)
RT.bool_ty =
tot_typing_soundness b_typing in
let g_then = push_binding g hyp ppname_default (mk_eq2 u0 tm_bool b tm_true) in
elab_push_binding g hyp (mk_eq2 u0 tm_bool b tm_true);
let re1_typing
: RT.tot_typing (RT.extend_env (elab_env g)
hyp
(RT.eq2 (R.pack_universe R.Uv_Zero)
RT.bool_ty
(elab_term b)
RT.true_bool))
(elab_st_typing e1_typing)
(elab_comp c) =
soundness g_then e1 c e1_typing in
let g_else = push_binding g hyp ppname_default (mk_eq2 u0 tm_bool b tm_false) in
elab_push_binding g hyp (mk_eq2 u0 tm_bool b tm_false);
let re2_typing
: RT.tot_typing (RT.extend_env (elab_env g)
hyp
(RT.eq2 (R.pack_universe R.Uv_Zero)
RT.bool_ty
(elab_term b)
RT.false_bool))
(elab_st_typing e2_typing)
(elab_comp c) =
soundness g_else e2 c e2_typing in
let c_typing =
ct_soundness _ _ _ c_typing
in
assume (~(hyp `Set.mem` RT.freevars (elab_st_typing e1_typing)));
assume (~(hyp `Set.mem` RT.freevars (elab_st_typing e2_typing)));
RT.T_If _ _ _ _ _ _ _ _ _ rb_typing re1_typing re2_typing c_typing
#pop-options
#push-options "--query_stats --fuel 2 --ifuel 2"
let rec soundness (g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
(decreases d)
= let mk_t_abs (#g:stt_env)
(#u:universe)
(#ty:term)
(q:option qualifier)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u) { t_typing << d })
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d })
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = soundness _ _ _ body_typing in
mk_t_abs g #_ #_ #_ #t_typing ppname r_t_typing r_body_typing
in
LN.st_typing_ln d;
match d with
| T_Lift _ _ _ _ _ _ ->
lift_soundness _ _ _ d soundness
| T_Frame _ _ _ _ _ _ ->
frame_soundness _ _ _ d soundness
| T_Abs _ x q ty u body c t_typing body_typing ->
mk_t_abs q ppname_default t_typing body_typing
| T_STApp _ _ _ _ _ _ _ _ ->
stapp_soundness _ _ _ d soundness
| T_STGhostApp _ _ _ _ _ _ _ _ _ _ ->
stghostapp_soundness _ _ _ d soundness
| T_Bind _ _e1 _e2 _c1 _c2 _b _x _c _e1_typing _t_typing _e2_typing _bc ->
bind_soundness d soundness mk_t_abs
| T_TotBind _ _ _ _ _ _ _ _ _ ->
Bind.tot_bind_typing d soundness
| T_GhostBind _ _ _ _ _ _ _ _ _ _ ->
Bind.ghost_bind_typing d soundness
| T_Equiv _ _ _ _ _ _ ->
stequiv_soundness _ _ _ d soundness
| T_Return _ _ _ _ _ _ _ _ _ _ _ ->
Return.return_soundess d
| T_If _ _ _ _ _ _ _ _ _ _ _->
let ct_soundness g c uc (d':_ {d' << d}) =
Comp.comp_typing_soundness g c uc d'
in
if_soundness _ _ _ d soundness ct_soundness
| T_Match _ _ _ _ _ _ _ _ _ _->
let ct_soundness g c uc (d':_ {d' << d}) =
Comp.comp_typing_soundness g c uc d'
in
Pulse.Soundness.Match.match_soundness _ _ _ d soundness ct_soundness
| T_IntroPure _ _ _ _ ->
admit()
| T_ElimExists _ _ _ _ _ _ _ ->
Exists.elim_exists_soundness d
| T_IntroExists _ _ _ _ _ _ _ _ ->
Exists.intro_exists_soundness d
| T_While _ _ _ _ _ _ _ ->
While.while_soundness d soundness
| T_Par _ _ _ _ _ _ _ _ _ _ ->
Par.par_soundness d soundness
| T_WithLocal _ _ _ _ _ _ _ _ _ _ ->
WithLocal.withlocal_soundness d soundness
| T_WithLocalArray _ _ _ _ _ _ _ _ _ _ _ _ ->
WithLocalArray.withlocalarray_soundness d soundness
| T_Rewrite _ _ _ _ _ ->
Rewrite.rewrite_soundness d
| T_Admit _ _ _ _ -> Admit.admit_soundess d
#pop-options
let soundness_lemma
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c)
: Lemma (ensures RT.tot_typing (elab_env g)
(elab_st_typing d) | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val soundness_lemma (g: stt_env) (t: st_term) (c: comp) (d: st_typing g t c)
: Lemma (ensures RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [] | Pulse.Soundness.soundness_lemma | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Soundness.Common.stt_env ->
t: Pulse.Syntax.Base.st_term ->
c: Pulse.Syntax.Base.comp ->
d: Pulse.Typing.st_typing g t c
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Core.elab_st_typing d)
(Pulse.Elaborate.Pure.elab_comp c)) | {
"end_col": 64,
"end_line": 407,
"start_col": 4,
"start_line": 404
} |
Prims.GTot | val frame_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Frame? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frame_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Frame? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Frame _ e c frame frame_typing e_typing = d in
let r_e_typing = soundness _ _ _ e_typing in
LN.st_typing_ln e_typing;
Frame.elab_frame_typing g _ _ frame frame_typing r_e_typing | val frame_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Frame? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let frame_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Frame? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = | false | null | false | let T_Frame _ e c frame frame_typing e_typing = d in
let r_e_typing = soundness _ _ _ e_typing in
LN.st_typing_ln e_typing;
Frame.elab_frame_typing g _ _ frame frame_typing r_e_typing | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Prims.b2t",
"Pulse.Typing.uu___is_T_Frame",
"Pulse.Soundness.Common.soundness_t",
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp_st",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Soundness.Frame.elab_frame_typing",
"Pulse.Elaborate.Core.elab_st_typing",
"Prims.unit",
"Pulse.Typing.LN.st_typing_ln",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_comp"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing
let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ ->
Lift.elab_lift_stt_atomic_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a, reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
_ (tot_typing_soundness reveal_a_typing)
let frame_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Frame? d}) | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val frame_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Frame? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [] | Pulse.Soundness.frame_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Soundness.Common.stt_env ->
t: Pulse.Syntax.Base.st_term ->
c: Pulse.Syntax.Base.comp ->
d: Pulse.Typing.st_typing g t c {T_Frame? d} ->
soundness: Pulse.Soundness.Common.soundness_t d
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Core.elab_st_typing d)
(Pulse.Elaborate.Pure.elab_comp c)) | {
"end_col": 61,
"end_line": 79,
"start_col": 72,
"start_line": 74
} |
Prims.GTot | val stapp_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_STApp? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let stapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STApp _ head formal q res arg head_typing arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_head_typing
: RT.tot_typing _ r_head
(elab_term (tm_arrow {binder_ty=formal;binder_ppname=ppname_default} q res))
= tot_typing_soundness head_typing
in
let r_arg_typing = tot_typing_soundness arg_typing in
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing | val stapp_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_STApp? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let stapp_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_STApp? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = | false | null | false | let T_STApp _ head formal q res arg head_typing arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_head_typing:RT.tot_typing _
r_head
(elab_term (tm_arrow ({ binder_ty = formal; binder_ppname = ppname_default }) q res)) =
tot_typing_soundness head_typing
in
let r_arg_typing = tot_typing_soundness arg_typing in
RT.T_App _
_
_
(binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Prims.b2t",
"Pulse.Typing.uu___is_T_STApp",
"Pulse.Soundness.Common.soundness_t",
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.qualifier",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Pure.tm_arrow",
"Pulse.Typing.as_binder",
"FStar.Reflection.Typing.T_App",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Reflection.Util.binder_of_t_q_s",
"Pulse.Elaborate.Pure.elab_qual",
"FStar.Reflection.Typing.pp_name_default",
"Pulse.Elaborate.Pure.elab_comp",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Soundness.Common.tot_typing_soundness",
"Pulse.Syntax.Base.Mkbinder",
"Pulse.Syntax.Base.ppname_default",
"FStar.Reflection.Types.term",
"Pulse.Elaborate.Core.elab_st_typing"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing
let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ ->
Lift.elab_lift_stt_atomic_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a, reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
_ (tot_typing_soundness reveal_a_typing)
let frame_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Frame? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Frame _ e c frame frame_typing e_typing = d in
let r_e_typing = soundness _ _ _ e_typing in
LN.st_typing_ln e_typing;
Frame.elab_frame_typing g _ _ frame frame_typing r_e_typing
let stapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STApp? d}) | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val stapp_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_STApp? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [] | Pulse.Soundness.stapp_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Soundness.Common.stt_env ->
t: Pulse.Syntax.Base.st_term ->
c: Pulse.Syntax.Base.comp ->
d: Pulse.Typing.st_typing g t c {T_STApp? d} ->
soundness: Pulse.Soundness.Common.soundness_t d
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Core.elab_st_typing d)
(Pulse.Elaborate.Pure.elab_comp c)) | {
"end_col": 29,
"end_line": 102,
"start_col": 72,
"start_line": 87
} |
Prims.GTot | val stequiv_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Equiv? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let stequiv_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Equiv? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Equiv _ e c c' e_typing equiv = d in
LN.st_typing_ln d;
LN.st_typing_ln e_typing;
let r_e_typing = soundness _ _ _ e_typing in
STEquiv.st_equiv_soundness _ _ _ equiv _ r_e_typing | val stequiv_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Equiv? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let stequiv_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Equiv? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = | false | null | false | let T_Equiv _ e c c' e_typing equiv = d in
LN.st_typing_ln d;
LN.st_typing_ln e_typing;
let r_e_typing = soundness _ _ _ e_typing in
STEquiv.st_equiv_soundness _ _ _ equiv _ r_e_typing | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Prims.b2t",
"Pulse.Typing.uu___is_T_Equiv",
"Pulse.Soundness.Common.soundness_t",
"Pulse.Typing.Env.env",
"Pulse.Typing.st_equiv",
"Pulse.Soundness.STEquiv.st_equiv_soundness",
"Pulse.Elaborate.Core.elab_st_typing",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_comp",
"Prims.unit",
"Pulse.Typing.LN.st_typing_ln"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing
let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ ->
Lift.elab_lift_stt_atomic_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a, reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
_ (tot_typing_soundness reveal_a_typing)
let frame_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Frame? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Frame _ e c frame frame_typing e_typing = d in
let r_e_typing = soundness _ _ _ e_typing in
LN.st_typing_ln e_typing;
Frame.elab_frame_typing g _ _ frame frame_typing r_e_typing
let stapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STApp _ head formal q res arg head_typing arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_head_typing
: RT.tot_typing _ r_head
(elab_term (tm_arrow {binder_ty=formal;binder_ppname=ppname_default} q res))
= tot_typing_soundness head_typing
in
let r_arg_typing = tot_typing_soundness arg_typing in
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing
//
// We have G |- head : Ghost (x:t -> Total res) -- (1)
// G |- arg : Ghost t -- (2)
// G,x:t |- non_informative (open res x) -- (3)
//
// We first lift (1) to G |- head : Ghost (x:t -> Ghost res)
// Then apply T_App in reflection typing to derive
// G |- head arg : Ghost (open res arg) -- (4)
// and then promote (4) to Total using a substitution lemma on (3)
//
let stghostapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STGhostApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STGhostApp _ head formal q res arg x head_typing d_non_info arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_binder = {binder_ty=formal;binder_ppname=ppname_default} in
let head_t = tm_arrow r_binder q res in
let r_head_t = mk_arrow_with_name ppname_default.name (elab_term formal, elab_qual q)
(elab_comp res) in
let r_head_typing : RT.ghost_typing _ r_head r_head_t
= ghost_typing_soundness head_typing in
let r_arg_typing = ghost_typing_soundness arg_typing in
assume (elab_env (push_binding g x ppname_default formal) ==
RT.extend_env (elab_env g) x (elab_term formal));
assume ((T.E_Total, elab_comp (open_comp_with res (null_var x))) ==
RT.open_comp_typ (T.E_Total, elab_comp res) x);
assume ((T.E_Ghost, elab_comp (open_comp_with res (null_var x))) ==
RT.open_comp_typ (T.E_Ghost, elab_comp res) x);
let d_rel_comp
: RT.related_comp (elab_env (push_binding g x ppname_default formal))
(T.E_Total, elab_comp (open_comp_with res (null_var x)))
RT.R_Sub
(T.E_Ghost, elab_comp (open_comp_with res (null_var x))) =
RT.Relc_total_ghost _ _ in
let r_head_t_ghost = mk_ghost_arrow_with_name ppname_default.name (elab_term formal, elab_qual q)
(elab_comp res) in
assert (r_head_t == RT.mk_arrow_ct (elab_term formal) (elab_qual q) (T.E_Total, elab_comp res));
assert (r_head_t_ghost == RT.mk_arrow_ct (elab_term formal) (elab_qual q) (T.E_Ghost, elab_comp res));
assume (None? (RT.lookup_bvar (elab_env g) x) /\
~ (x `Set.mem` ((RT.freevars_comp_typ (T.E_Total, elab_comp res)) `Set.union`
(RT.freevars_comp_typ (T.E_Ghost, elab_comp res)))));
let d_rel_t_arrow
: RT.related (elab_env g)
r_head_t
RT.R_Sub
r_head_t_ghost
= RT.Rel_arrow _ (elab_term formal) (elab_term formal) (elab_qual q) (T.E_Total, elab_comp res) (T.E_Ghost, elab_comp res)
RT.R_Sub x (RT.Rel_equiv _ _ _ _ (RT.Rel_refl _ _ _))
d_rel_comp in
let r_head_typing : RT.ghost_typing _ r_head r_head_t_ghost =
RT.T_Sub _ _ _ _ r_head_typing (RT.Relc_typ _ _ _ T.E_Ghost _ d_rel_t_arrow) in
let d : RT.typing (elab_env g) (elab_st_typing d) (T.E_Ghost, elab_comp (open_comp_with res arg)) =
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing in
let E d_non_info = d_non_info in
let d_non_info
: RT.non_informative (elab_env (push_binding g x ppname_default formal))
(elab_comp (open_comp_with res (null_var x))) =
d_non_info in
// TODO: substitution lemma in RT for non_informative judgment
let d_non_info
: RT.non_informative (elab_env g) (elab_comp (open_comp_with res arg)) = magic () in
RT.T_Sub _ _ _ _ d (RT.Relc_ghost_total _ _ d_non_info)
let stequiv_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Equiv? d}) | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val stequiv_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Equiv? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [] | Pulse.Soundness.stequiv_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Soundness.Common.stt_env ->
t: Pulse.Syntax.Base.st_term ->
c: Pulse.Syntax.Base.comp ->
d: Pulse.Typing.st_typing g t c {T_Equiv? d} ->
soundness: Pulse.Soundness.Common.soundness_t d
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Core.elab_st_typing d)
(Pulse.Elaborate.Pure.elab_comp c)) | {
"end_col": 53,
"end_line": 199,
"start_col": 72,
"start_line": 193
} |
Prims.GTot | val lift_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Lift? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ ->
Lift.elab_lift_stt_atomic_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a, reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
_ (tot_typing_soundness reveal_a_typing) | val lift_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Lift? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let lift_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Lift? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = | false | null | false | LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ -> Lift.elab_lift_stt_atomic_typing g c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a , reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1
c2
_
(soundness _ _ _ e_typing)
lc
_
(tot_typing_soundness reveal_a_typing) | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Prims.b2t",
"Pulse.Typing.uu___is_T_Lift",
"Pulse.Soundness.Common.soundness_t",
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.lift_comp",
"Prims.l_and",
"Pulse.Syntax.Base.uu___is_C_STAtomic",
"Prims.eq2",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.comp_inames",
"Pulse.Syntax.Base.tm_emp_inames",
"Pulse.Soundness.Lift.elab_lift_stt_atomic_typing",
"Pulse.Elaborate.Core.elab_st_typing",
"Pulse.Syntax.Base.uu___is_C_STGhost",
"Pulse.Typing.non_informative_c",
"Pulse.Typing.tot_typing",
"Pulse.Typing.non_informative_witness_t",
"Pulse.Syntax.Base.comp_u",
"Pulse.Syntax.Base.comp_res",
"Pulse.Soundness.Lift.elab_lift_stt_ghost_typing",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Soundness.Common.tot_typing_soundness",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_comp",
"Prims.unit",
"Pulse.Typing.LN.st_typing_ln"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing
let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d) | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lift_soundness
(g: stt_env)
(t: st_term)
(c: comp)
(d: st_typing g t c {T_Lift? d})
(soundness: soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [] | Pulse.Soundness.lift_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Soundness.Common.stt_env ->
t: Pulse.Syntax.Base.st_term ->
c: Pulse.Syntax.Base.comp ->
d: Pulse.Typing.st_typing g t c {T_Lift? d} ->
soundness: Pulse.Soundness.Common.soundness_t d
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Core.elab_st_typing d)
(Pulse.Elaborate.Pure.elab_comp c)) | {
"end_col": 46,
"end_line": 66,
"start_col": 2,
"start_line": 55
} |
Prims.GTot | val bind_soundness
(#g: stt_env)
(#t: st_term)
(#c: comp)
(d: st_typing g t c {T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [
{
"abbrev": true,
"full_module": "Pulse.Steel.Wrapper.Typing",
"short_module": "WT"
},
{
"abbrev": true,
"full_module": "Pulse.Elaborate.Pure",
"short_module": "EPure"
},
{
"abbrev": true,
"full_module": "Pulse.Typing",
"short_module": "Typing"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Comp",
"short_module": "Comp"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.STEquiv",
"short_module": "STEquiv"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Frame",
"short_module": "Frame"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Lift",
"short_module": "Lift"
},
{
"abbrev": true,
"full_module": "Pulse.Soundness.Bind",
"short_module": "Bind"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_soundness
(#g:stt_env)
(#t:st_term)
(#c:comp)
(d:st_typing g t c{T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g)
(elab_st_typing d)
(elab_comp c))
= let T_Bind _ e1 e2 c1 c2 _ x c e1_typing t_typing e2_typing bc = d in
LN.st_typing_ln e1_typing;
LN.st_typing_ln e2_typing;
FV.st_typing_freevars_inv e1_typing x;
let r1_typing
: RT.tot_typing _ _ (elab_comp c1)
= soundness _ _ _ e1_typing
in
let r2_typing
: RT.tot_typing _ _ (elab_term (tm_arrow (null_binder (comp_res c1)) None (close_comp c2 x)))
= mk_t_abs None _ t_typing e2_typing
in
match bc with
| Bind_comp _ _ _ _ t2_typing y post2_typing ->
Bind.elab_bind_typing g _ _ _ x _ r1_typing _ r2_typing bc
(tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
| Bind_comp_ghost_l _ _ _ _ (| reveal_a, reveal_a_typing |) t2_typing y post2_typing ->
Bind.elab_bind_ghost_l_typing g _ _ _ x _ r1_typing
_ r2_typing bc
(tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
(elab_term reveal_a)
(tot_typing_soundness reveal_a_typing)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b, reveal_b_typing |) t2_typing y post2_typing ->
Bind.elab_bind_ghost_r_typing g _ _ _ x _ r1_typing
_ r2_typing bc
(tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
(elab_term reveal_b)
(tot_typing_soundness reveal_b_typing) | val bind_soundness
(#g: stt_env)
(#t: st_term)
(#c: comp)
(d: st_typing g t c {T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))
let bind_soundness
(#g: stt_env)
(#t: st_term)
(#c: comp)
(d: st_typing g t c {T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) = | false | null | false | let T_Bind _ e1 e2 c1 c2 _ x c e1_typing t_typing e2_typing bc = d in
LN.st_typing_ln e1_typing;
LN.st_typing_ln e2_typing;
FV.st_typing_freevars_inv e1_typing x;
let r1_typing:RT.tot_typing _ _ (elab_comp c1) = soundness _ _ _ e1_typing in
let r2_typing:RT.tot_typing _
_
(elab_term (tm_arrow (null_binder (comp_res c1)) None (close_comp c2 x))) =
mk_t_abs None _ t_typing e2_typing
in
match bc with
| Bind_comp _ _ _ _ t2_typing y post2_typing ->
Bind.elab_bind_typing g _ _ _ x _ r1_typing _ r2_typing bc (tot_typing_soundness t2_typing)
(mk_t_abs_tot _ ppname_default t2_typing post2_typing)
| Bind_comp_ghost_l _ _ _ _ (| reveal_a , reveal_a_typing |) t2_typing y post2_typing ->
Bind.elab_bind_ghost_l_typing g _ _ _ x _ r1_typing _ r2_typing bc
(tot_typing_soundness t2_typing) (mk_t_abs_tot _ ppname_default t2_typing post2_typing)
(elab_term reveal_a) (tot_typing_soundness reveal_a_typing)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b , reveal_b_typing |) t2_typing y post2_typing ->
Bind.elab_bind_ghost_r_typing g _ _ _ x _ r1_typing _ r2_typing bc
(tot_typing_soundness t2_typing) (mk_t_abs_tot _ ppname_default t2_typing post2_typing)
(elab_term reveal_b) (tot_typing_soundness reveal_b_typing) | {
"checked_file": "Pulse.Soundness.fst.checked",
"dependencies": [
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Steel.Wrapper.Typing.fsti.checked",
"Pulse.Soundness.WithLocalArray.fsti.checked",
"Pulse.Soundness.WithLocal.fsti.checked",
"Pulse.Soundness.While.fsti.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.STEquiv.fsti.checked",
"Pulse.Soundness.Rewrite.fsti.checked",
"Pulse.Soundness.Return.fsti.checked",
"Pulse.Soundness.Par.fsti.checked",
"Pulse.Soundness.Match.fsti.checked",
"Pulse.Soundness.Lift.fsti.checked",
"Pulse.Soundness.Frame.fsti.checked",
"Pulse.Soundness.Exists.fsti.checked",
"Pulse.Soundness.Comp.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Soundness.Bind.fsti.checked",
"Pulse.Soundness.Admit.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Prims.b2t",
"Pulse.Typing.uu___is_T_Bind",
"Pulse.Soundness.Common.soundness_t",
"Pulse.Soundness.tabs_t",
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp_st",
"Pulse.Syntax.Base.binder",
"Prims.eq2",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Base.var",
"Prims.l_and",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"Prims.l_not",
"FStar.Set.mem",
"Pulse.Syntax.Naming.freevars_st",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Pure.tm_type",
"Pulse.Syntax.Base.comp_u",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Naming.open_st_term_nv",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ppname",
"Pulse.Typing.bind_comp",
"Pulse.Typing.bind_comp_pre",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.comp_post",
"Pulse.Syntax.Naming.open_term",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Soundness.Bind.elab_bind_typing",
"Pulse.Elaborate.Core.elab_st_typing",
"Pulse.Reflection.Util.mk_abs_with_name",
"Pulse.Syntax.Base.__proj__Mkppname__item__name",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Elaborate.Pure.elab_qual",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.qualifier",
"FStar.Reflection.Typing.close_term",
"Pulse.Syntax.Naming.open_st_term",
"Pulse.Soundness.Common.tot_typing_soundness",
"Pulse.Soundness.Common.mk_t_abs_tot",
"Pulse.Typing.bind_comp_ghost_l_pre",
"Pulse.Typing.non_informative_witness_t",
"Pulse.Soundness.Bind.elab_bind_ghost_l_typing",
"Pulse.Typing.bind_comp_ghost_r_pre",
"Pulse.Soundness.Bind.elab_bind_ghost_r_typing",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_comp",
"Pulse.Syntax.Pure.tm_arrow",
"Pulse.Syntax.Base.null_binder",
"Pulse.Syntax.Naming.close_comp",
"Prims.unit",
"Pulse.Typing.FV.st_typing_freevars_inv",
"Pulse.Typing.LN.st_typing_ln"
] | [] | module Pulse.Soundness
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
open Pulse.Soundness.Common
module Bind = Pulse.Soundness.Bind
module Lift = Pulse.Soundness.Lift
module Frame = Pulse.Soundness.Frame
module STEquiv = Pulse.Soundness.STEquiv
module Return = Pulse.Soundness.Return
module Exists = Pulse.Soundness.Exists
module While = Pulse.Soundness.While
module Admit = Pulse.Soundness.Admit
module Par = Pulse.Soundness.Par
module WithLocal = Pulse.Soundness.WithLocal
module WithLocalArray = Pulse.Soundness.WithLocalArray
module Rewrite = Pulse.Soundness.Rewrite
module Comp = Pulse.Soundness.Comp
module LN = Pulse.Typing.LN
module FV = Pulse.Typing.FV
module STT = Pulse.Soundness.STT
module Typing = Pulse.Typing
module EPure = Pulse.Elaborate.Pure
module WT= Pulse.Steel.Wrapper.Typing
let tabs_t (d:'a) =
#g:stt_env ->
#u:universe ->
#ty:term ->
q:option qualifier ->
ppname:ppname ->
t_typing:tot_typing g ty (tm_type u) { t_typing << d } ->
#body:st_term ->
#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) } ->
#c:comp ->
body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c { body_typing << d } ->
GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
let lift_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Lift? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
LN.st_typing_ln d;
let T_Lift _ e c1 c2 e_typing lc = d in
LN.st_typing_ln e_typing;
match lc with
| Lift_STAtomic_ST _ _ ->
Lift.elab_lift_stt_atomic_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
| Lift_STGhost_STAtomic _ _ w ->
let (| reveal_a, reveal_a_typing |) = w in
Lift.elab_lift_stt_ghost_typing g
c1 c2 _ (soundness _ _ _ e_typing) lc
_ (tot_typing_soundness reveal_a_typing)
let frame_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Frame? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Frame _ e c frame frame_typing e_typing = d in
let r_e_typing = soundness _ _ _ e_typing in
LN.st_typing_ln e_typing;
Frame.elab_frame_typing g _ _ frame frame_typing r_e_typing
let stapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STApp _ head formal q res arg head_typing arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_head_typing
: RT.tot_typing _ r_head
(elab_term (tm_arrow {binder_ty=formal;binder_ppname=ppname_default} q res))
= tot_typing_soundness head_typing
in
let r_arg_typing = tot_typing_soundness arg_typing in
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing
//
// We have G |- head : Ghost (x:t -> Total res) -- (1)
// G |- arg : Ghost t -- (2)
// G,x:t |- non_informative (open res x) -- (3)
//
// We first lift (1) to G |- head : Ghost (x:t -> Ghost res)
// Then apply T_App in reflection typing to derive
// G |- head arg : Ghost (open res arg) -- (4)
// and then promote (4) to Total using a substitution lemma on (3)
//
let stghostapp_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_STGhostApp? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_STGhostApp _ head formal q res arg x head_typing d_non_info arg_typing = d in
let r_head = elab_term head in
let r_arg = elab_term arg in
let r_binder = {binder_ty=formal;binder_ppname=ppname_default} in
let head_t = tm_arrow r_binder q res in
let r_head_t = mk_arrow_with_name ppname_default.name (elab_term formal, elab_qual q)
(elab_comp res) in
let r_head_typing : RT.ghost_typing _ r_head r_head_t
= ghost_typing_soundness head_typing in
let r_arg_typing = ghost_typing_soundness arg_typing in
assume (elab_env (push_binding g x ppname_default formal) ==
RT.extend_env (elab_env g) x (elab_term formal));
assume ((T.E_Total, elab_comp (open_comp_with res (null_var x))) ==
RT.open_comp_typ (T.E_Total, elab_comp res) x);
assume ((T.E_Ghost, elab_comp (open_comp_with res (null_var x))) ==
RT.open_comp_typ (T.E_Ghost, elab_comp res) x);
let d_rel_comp
: RT.related_comp (elab_env (push_binding g x ppname_default formal))
(T.E_Total, elab_comp (open_comp_with res (null_var x)))
RT.R_Sub
(T.E_Ghost, elab_comp (open_comp_with res (null_var x))) =
RT.Relc_total_ghost _ _ in
let r_head_t_ghost = mk_ghost_arrow_with_name ppname_default.name (elab_term formal, elab_qual q)
(elab_comp res) in
assert (r_head_t == RT.mk_arrow_ct (elab_term formal) (elab_qual q) (T.E_Total, elab_comp res));
assert (r_head_t_ghost == RT.mk_arrow_ct (elab_term formal) (elab_qual q) (T.E_Ghost, elab_comp res));
assume (None? (RT.lookup_bvar (elab_env g) x) /\
~ (x `Set.mem` ((RT.freevars_comp_typ (T.E_Total, elab_comp res)) `Set.union`
(RT.freevars_comp_typ (T.E_Ghost, elab_comp res)))));
let d_rel_t_arrow
: RT.related (elab_env g)
r_head_t
RT.R_Sub
r_head_t_ghost
= RT.Rel_arrow _ (elab_term formal) (elab_term formal) (elab_qual q) (T.E_Total, elab_comp res) (T.E_Ghost, elab_comp res)
RT.R_Sub x (RT.Rel_equiv _ _ _ _ (RT.Rel_refl _ _ _))
d_rel_comp in
let r_head_typing : RT.ghost_typing _ r_head r_head_t_ghost =
RT.T_Sub _ _ _ _ r_head_typing (RT.Relc_typ _ _ _ T.E_Ghost _ d_rel_t_arrow) in
let d : RT.typing (elab_env g) (elab_st_typing d) (T.E_Ghost, elab_comp (open_comp_with res arg)) =
RT.T_App _ _ _ (binder_of_t_q_s (elab_term formal) (elab_qual q) RT.pp_name_default)
(elab_comp res)
_
r_head_typing
r_arg_typing in
let E d_non_info = d_non_info in
let d_non_info
: RT.non_informative (elab_env (push_binding g x ppname_default formal))
(elab_comp (open_comp_with res (null_var x))) =
d_non_info in
// TODO: substitution lemma in RT for non_informative judgment
let d_non_info
: RT.non_informative (elab_env g) (elab_comp (open_comp_with res arg)) = magic () in
RT.T_Sub _ _ _ _ d (RT.Relc_ghost_total _ _ d_non_info)
let stequiv_soundness
(g:stt_env)
(t:st_term)
(c:comp)
(d:st_typing g t c{T_Equiv? d})
(soundness:soundness_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) =
let T_Equiv _ e c c' e_typing equiv = d in
LN.st_typing_ln d;
LN.st_typing_ln e_typing;
let r_e_typing = soundness _ _ _ e_typing in
STEquiv.st_equiv_soundness _ _ _ equiv _ r_e_typing
#push-options "--query_stats --fuel 2 --ifuel 2 --z3rlimit_factor 30"
let bind_soundness
(#g:stt_env)
(#t:st_term)
(#c:comp)
(d:st_typing g t c{T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g)
(elab_st_typing d) | false | false | Pulse.Soundness.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 30,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_soundness
(#g: stt_env)
(#t: st_term)
(#c: comp)
(d: st_typing g t c {T_Bind? d})
(soundness: soundness_t d)
(mk_t_abs: tabs_t d)
: GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c)) | [] | Pulse.Soundness.bind_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
d: Pulse.Typing.st_typing g t c {T_Bind? d} ->
soundness: Pulse.Soundness.Common.soundness_t d ->
mk_t_abs: Pulse.Soundness.tabs_t d
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Core.elab_st_typing d)
(Pulse.Elaborate.Pure.elab_comp c)) | {
"end_col": 49,
"end_line": 245,
"start_col": 3,
"start_line": 214
} |
Prims.Tot | val return (a: Type) (x: a) (p: (a -> slprop)) (post: ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post | [
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Instantiate",
"short_module": "Ins"
},
{
"abbrev": false,
"full_module": "Steel.Semantics.Instantiate",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Hoare.MST",
"short_module": "Sem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
= Sem.Ret p x post | val return (a: Type) (x: a) (p: (a -> slprop)) (post: ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
let return (a: Type) (x: a) (p: (a -> slprop)) (post: ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post = | false | null | false | Sem.Ret p x post | {
"checked_file": "Steel.Effect.M.fst.checked",
"dependencies": [
"Steel.Semantics.Instantiate.fsti.checked",
"Steel.Semantics.Hoare.MST.fst.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.Effect.M.fst"
} | [
"total"
] | [
"Steel.Memory.slprop",
"Steel.Effect.M.ens_t",
"Steel.Semantics.Hoare.MST.Ret",
"Steel.Semantics.Instantiate.state",
"Steel.Effect.M.repr",
"Steel.Semantics.Hoare.MST.return_lpre"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Effect.M
//Note: This file is standalone and not used anywhere else in the Steel codebase
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module Ins = Steel.Semantics.Instantiate
open Steel.Memory
(*
* This module defines a layered effect over the CSL semantics
* from Steel.Semantics.Hoare.MST
*
* The effect is defined with action trees as the underlying representation
* for computations in the effect
*
* The effect combinators export the same specs as proved in the semantics
*
* The state typeclass in the semantics is instantiated with
* Steel.Semantics.Instantiate
*
* This module is for illustration, our examples rely on Steel.Effect.fst
* See the discussion towards the end of this file
*)
type pre_t = slprop u#1
type post_t (a:Type) = a -> slprop u#1
type req_t (pre:pre_t) = Sem.l_pre #state pre
type ens_t (pre:pre_t) (a:Type) (post:post_t a) = Sem.l_post #state #a pre post
/// Sem.m is the type of action trees in the semantics
type repr (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post) =
Sem.m state a pre post req ens
/// Effect return
let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p) | false | false | Steel.Effect.M.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val return (a: Type) (x: a) (p: (a -> slprop)) (post: ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post | [] | Steel.Effect.M.return | {
"file_name": "lib/steel/Steel.Effect.M.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | a: Type -> x: a -> p: (_: a -> Steel.Memory.slprop) -> post: Steel.Effect.M.ens_t (p x) a p
-> Steel.Effect.M.repr a (p x) p (Steel.Semantics.Hoare.MST.return_lpre x post) post | {
"end_col": 18,
"end_line": 60,
"start_col": 2,
"start_line": 60
} |
Prims.Tot | val lift_post (#a: _) (post: post_t u#a a) : post_t u#(max a b) (U.raise_t a) | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Instantiate",
"short_module": "Ins"
},
{
"abbrev": false,
"full_module": "Steel.Semantics.Instantiate",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Hoare.MST",
"short_module": "Sem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lift_post #a (post:post_t u#a a)
: post_t u#(max a b) (U.raise_t a)
= fun x -> post (U.downgrade_val x) | val lift_post (#a: _) (post: post_t u#a a) : post_t u#(max a b) (U.raise_t a)
let lift_post #a (post: post_t u#a a) : post_t u#(max a b) (U.raise_t a) = | false | null | false | fun x -> post (U.downgrade_val x) | {
"checked_file": "Steel.Effect.M.fst.checked",
"dependencies": [
"Steel.Semantics.Instantiate.fsti.checked",
"Steel.Semantics.Hoare.MST.fst.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.Effect.M.fst"
} | [
"total"
] | [
"Steel.Effect.M.post_t",
"FStar.Universe.raise_t",
"FStar.Universe.downgrade_val",
"Steel.Memory.slprop"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Effect.M
//Note: This file is standalone and not used anywhere else in the Steel codebase
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module Ins = Steel.Semantics.Instantiate
open Steel.Memory
(*
* This module defines a layered effect over the CSL semantics
* from Steel.Semantics.Hoare.MST
*
* The effect is defined with action trees as the underlying representation
* for computations in the effect
*
* The effect combinators export the same specs as proved in the semantics
*
* The state typeclass in the semantics is instantiated with
* Steel.Semantics.Instantiate
*
* This module is for illustration, our examples rely on Steel.Effect.fst
* See the discussion towards the end of this file
*)
type pre_t = slprop u#1
type post_t (a:Type) = a -> slprop u#1
type req_t (pre:pre_t) = Sem.l_pre #state pre
type ens_t (pre:pre_t) (a:Type) (post:post_t a) = Sem.l_post #state #a pre post
/// Sem.m is the type of action trees in the semantics
type repr (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post) =
Sem.m state a pre post req ens
/// Effect return
let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
= Sem.Ret p x post
/// Effect bind
let bind (a:Type) (b:Type)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
/// A combinator for parallel computations
let par
(aL:Type) (preL:pre_t) (postL:post_t aL) (reqL:req_t preL) (ensL:ens_t preL aL postL)
(f:repr aL preL postL reqL ensL)
(aR:Type) (preR:pre_t) (postR:post_t aR) (reqR:req_t preR) (ensR:ens_t preR aR postR)
(g:repr aR preR postR reqR ensR)
: repr (aL & aR)
(preL `star` preR)
(fun (xL, xR) -> postL xL `star` postR xR)
(Sem.par_lpre reqL reqR)
(Sem.par_lpost reqL ensL reqR ensR)
= Sem.Par f g
/// Framing combinator
let frame (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post)
(f:repr a pre post req ens)
(frame:slprop) (f_frame:Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> post x `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame)
= Sem.Frame f frame f_frame
(*
* However, the effect defined this way is not immediately usable from F*
*
* To see the issue, consider again the `bind` combinator we defined above with
* explicit universe annotations:
*)
let bind_explicit_univs (a:Type u#a) (b:Type u#a)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
(*
* In the combinator, both the computation return types are in the same universe,
* and the combinator itself is polymorphic in that single universe
*
* However, composing computations whose result types are in different universes
* is useful. For example, composition of a computation returning an existential
* (p:Type0 & x:int{p}) that lives in u#1 with a continuation that projects and returns
* the int that lives in u#0.
*
* Hence, as with other F* effects, we would like to support a bind that is doubly
* polymorphic in the result type of both the computations, e.g. something like
*
* let bind_double_univs (a:Type u#a) (b:Type u#b)
* (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
* (post_g:post_t b)
* (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
* (f:repr a pre_f post_f req_f ens_f)
* (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
* : repr u#(max a b) b pre_f post_g
* (Sem.bind_lpre req_f ens_f req_g)
* (Sem.bind_lpost req_f ens_f ens_g) = ...
*
* But F*, like Lean and Agda, and unlike Coq, lacks cumulativity of universes.
* So the result type (repr u#(max a b) b ...) is not well-formed, since b has
* universe u#b and not u#(max a b)
*
* We could explicitly lift the universes to get the following type:
*
* let bind_double_univs_raise (a:Type u#a) (b:Type u#b)
* (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
* (post_g:post_t b)
* (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
* (f:repr a pre_f post_f req_f ens_f)
* (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
* : repr u#(max a b) (raise_t b) ...
*
* (In the file below, we sketch this in actual code.)
*
* But this results in other complications:
* 1. The user programs now have to explicitly eliminate raise_t (by downgrading)
* 2. F* effect system will reject this bind definition, since it is unaware of the
* universe lifting
*
* To get around this, we chose a different, more restrictive representation for the
* Steel effect in Steel.Effect.fst. That definition is suitably doubly universe
* polymorphic, at the expense of hiding the structure of the computation trees
* needed for a full fidelity interleaving semantics.
*
* Please see that file for further discussions on the limitations of that
* representation.
*
* In the meantime, we are working on adding universe cumulativity to F* that will
* allow bind_double_univs to be defined and then we can switch to the action trees
* based representation for the effect.
*)
/// Sketch for supporting different universes in the two computations
module U = FStar.Universe
module T = FStar.Tactics
/// Auxiliary functions for lifting post, ens, etc.
let lift_post #a (post:post_t u#a a) | false | false | Steel.Effect.M.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lift_post (#a: _) (post: post_t u#a a) : post_t u#(max a b) (U.raise_t a) | [] | Steel.Effect.M.lift_post | {
"file_name": "lib/steel/Steel.Effect.M.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | post: Steel.Effect.M.post_t a -> Steel.Effect.M.post_t (FStar.Universe.raise_t a) | {
"end_col": 35,
"end_line": 186,
"start_col": 2,
"start_line": 186
} |
Prims.Tot | val frame
(a: Type)
(pre: pre_t)
(post: post_t a)
(req: req_t pre)
(ens: ens_t pre a post)
(f: repr a pre post req ens)
(frame: slprop)
(f_frame: Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> (post x) `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame) | [
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Instantiate",
"short_module": "Ins"
},
{
"abbrev": false,
"full_module": "Steel.Semantics.Instantiate",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Hoare.MST",
"short_module": "Sem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frame (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post)
(f:repr a pre post req ens)
(frame:slprop) (f_frame:Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> post x `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame)
= Sem.Frame f frame f_frame | val frame
(a: Type)
(pre: pre_t)
(post: post_t a)
(req: req_t pre)
(ens: ens_t pre a post)
(f: repr a pre post req ens)
(frame: slprop)
(f_frame: Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> (post x) `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame)
let frame
(a: Type)
(pre: pre_t)
(post: post_t a)
(req: req_t pre)
(ens: ens_t pre a post)
(f: repr a pre post req ens)
(frame: slprop)
(f_frame: Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> (post x) `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame) = | false | null | false | Sem.Frame f frame f_frame | {
"checked_file": "Steel.Effect.M.fst.checked",
"dependencies": [
"Steel.Semantics.Instantiate.fsti.checked",
"Steel.Semantics.Hoare.MST.fst.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.Effect.M.fst"
} | [
"total"
] | [
"Steel.Effect.M.pre_t",
"Steel.Effect.M.post_t",
"Steel.Effect.M.req_t",
"Steel.Effect.M.ens_t",
"Steel.Effect.M.repr",
"Steel.Memory.slprop",
"Steel.Semantics.Hoare.MST.fp_prop",
"Steel.Semantics.Instantiate.state",
"Steel.Semantics.Hoare.MST.Frame",
"Steel.Memory.star",
"Steel.Semantics.Hoare.MST.frame_lpre",
"Steel.Semantics.Hoare.MST.frame_lpost"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Effect.M
//Note: This file is standalone and not used anywhere else in the Steel codebase
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module Ins = Steel.Semantics.Instantiate
open Steel.Memory
(*
* This module defines a layered effect over the CSL semantics
* from Steel.Semantics.Hoare.MST
*
* The effect is defined with action trees as the underlying representation
* for computations in the effect
*
* The effect combinators export the same specs as proved in the semantics
*
* The state typeclass in the semantics is instantiated with
* Steel.Semantics.Instantiate
*
* This module is for illustration, our examples rely on Steel.Effect.fst
* See the discussion towards the end of this file
*)
type pre_t = slprop u#1
type post_t (a:Type) = a -> slprop u#1
type req_t (pre:pre_t) = Sem.l_pre #state pre
type ens_t (pre:pre_t) (a:Type) (post:post_t a) = Sem.l_post #state #a pre post
/// Sem.m is the type of action trees in the semantics
type repr (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post) =
Sem.m state a pre post req ens
/// Effect return
let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
= Sem.Ret p x post
/// Effect bind
let bind (a:Type) (b:Type)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
/// A combinator for parallel computations
let par
(aL:Type) (preL:pre_t) (postL:post_t aL) (reqL:req_t preL) (ensL:ens_t preL aL postL)
(f:repr aL preL postL reqL ensL)
(aR:Type) (preR:pre_t) (postR:post_t aR) (reqR:req_t preR) (ensR:ens_t preR aR postR)
(g:repr aR preR postR reqR ensR)
: repr (aL & aR)
(preL `star` preR)
(fun (xL, xR) -> postL xL `star` postR xR)
(Sem.par_lpre reqL reqR)
(Sem.par_lpost reqL ensL reqR ensR)
= Sem.Par f g
/// Framing combinator
let frame (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post)
(f:repr a pre post req ens)
(frame:slprop) (f_frame:Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> post x `star` frame)
(Sem.frame_lpre req f_frame) | false | false | Steel.Effect.M.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val frame
(a: Type)
(pre: pre_t)
(post: post_t a)
(req: req_t pre)
(ens: ens_t pre a post)
(f: repr a pre post req ens)
(frame: slprop)
(f_frame: Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> (post x) `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame) | [] | Steel.Effect.M.frame | {
"file_name": "lib/steel/Steel.Effect.M.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
a: Type ->
pre: Steel.Effect.M.pre_t ->
post: Steel.Effect.M.post_t a ->
req: Steel.Effect.M.req_t pre ->
ens: Steel.Effect.M.ens_t pre a post ->
f: Steel.Effect.M.repr a pre post req ens ->
frame: Steel.Memory.slprop ->
f_frame: Steel.Semantics.Hoare.MST.fp_prop frame
-> Steel.Effect.M.repr a
(Steel.Memory.star pre frame)
(fun x -> Steel.Memory.star (post x) frame)
(Steel.Semantics.Hoare.MST.frame_lpre req f_frame)
(Steel.Semantics.Hoare.MST.frame_lpost req ens f_frame) | {
"end_col": 27,
"end_line": 100,
"start_col": 2,
"start_line": 100
} |
Prims.Tot | val bind_explicit_univs
(a b: Type u#a)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g (Sem.bind_lpre req_f ens_f req_g) (Sem.bind_lpost req_f ens_f ens_g) | [
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Instantiate",
"short_module": "Ins"
},
{
"abbrev": false,
"full_module": "Steel.Semantics.Instantiate",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Hoare.MST",
"short_module": "Sem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_explicit_univs (a:Type u#a) (b:Type u#a)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g | val bind_explicit_univs
(a b: Type u#a)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g (Sem.bind_lpre req_f ens_f req_g) (Sem.bind_lpost req_f ens_f ens_g)
let bind_explicit_univs
(a b: Type u#a)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g (Sem.bind_lpre req_f ens_f req_g) (Sem.bind_lpost req_f ens_f ens_g) = | false | null | false | Sem.Bind f g | {
"checked_file": "Steel.Effect.M.fst.checked",
"dependencies": [
"Steel.Semantics.Instantiate.fsti.checked",
"Steel.Semantics.Hoare.MST.fst.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.Effect.M.fst"
} | [
"total"
] | [
"Steel.Effect.M.pre_t",
"Steel.Effect.M.post_t",
"Steel.Effect.M.req_t",
"Steel.Effect.M.ens_t",
"Steel.Effect.M.repr",
"Steel.Semantics.Hoare.MST.Bind",
"Steel.Semantics.Instantiate.state",
"Steel.Semantics.Hoare.MST.bind_lpre",
"Steel.Semantics.Hoare.MST.bind_lpost"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Effect.M
//Note: This file is standalone and not used anywhere else in the Steel codebase
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module Ins = Steel.Semantics.Instantiate
open Steel.Memory
(*
* This module defines a layered effect over the CSL semantics
* from Steel.Semantics.Hoare.MST
*
* The effect is defined with action trees as the underlying representation
* for computations in the effect
*
* The effect combinators export the same specs as proved in the semantics
*
* The state typeclass in the semantics is instantiated with
* Steel.Semantics.Instantiate
*
* This module is for illustration, our examples rely on Steel.Effect.fst
* See the discussion towards the end of this file
*)
type pre_t = slprop u#1
type post_t (a:Type) = a -> slprop u#1
type req_t (pre:pre_t) = Sem.l_pre #state pre
type ens_t (pre:pre_t) (a:Type) (post:post_t a) = Sem.l_post #state #a pre post
/// Sem.m is the type of action trees in the semantics
type repr (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post) =
Sem.m state a pre post req ens
/// Effect return
let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
= Sem.Ret p x post
/// Effect bind
let bind (a:Type) (b:Type)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
/// A combinator for parallel computations
let par
(aL:Type) (preL:pre_t) (postL:post_t aL) (reqL:req_t preL) (ensL:ens_t preL aL postL)
(f:repr aL preL postL reqL ensL)
(aR:Type) (preR:pre_t) (postR:post_t aR) (reqR:req_t preR) (ensR:ens_t preR aR postR)
(g:repr aR preR postR reqR ensR)
: repr (aL & aR)
(preL `star` preR)
(fun (xL, xR) -> postL xL `star` postR xR)
(Sem.par_lpre reqL reqR)
(Sem.par_lpost reqL ensL reqR ensR)
= Sem.Par f g
/// Framing combinator
let frame (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post)
(f:repr a pre post req ens)
(frame:slprop) (f_frame:Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> post x `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame)
= Sem.Frame f frame f_frame
(*
* However, the effect defined this way is not immediately usable from F*
*
* To see the issue, consider again the `bind` combinator we defined above with
* explicit universe annotations:
*)
let bind_explicit_univs (a:Type u#a) (b:Type u#a)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g) | false | false | Steel.Effect.M.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_explicit_univs
(a b: Type u#a)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g (Sem.bind_lpre req_f ens_f req_g) (Sem.bind_lpost req_f ens_f ens_g) | [] | Steel.Effect.M.bind_explicit_univs | {
"file_name": "lib/steel/Steel.Effect.M.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
a: Type ->
b: Type ->
pre_f: Steel.Effect.M.pre_t ->
post_f: Steel.Effect.M.post_t a ->
req_f: Steel.Effect.M.req_t pre_f ->
ens_f: Steel.Effect.M.ens_t pre_f a post_f ->
post_g: Steel.Effect.M.post_t b ->
req_g: (x: a -> Steel.Effect.M.req_t (post_f x)) ->
ens_g: (x: a -> Steel.Effect.M.ens_t (post_f x) b post_g) ->
f: Steel.Effect.M.repr a pre_f post_f req_f ens_f ->
g: (x: a -> Steel.Effect.M.repr b (post_f x) post_g (req_g x) (ens_g x))
-> Steel.Effect.M.repr b
pre_f
post_g
(Steel.Semantics.Hoare.MST.bind_lpre req_f ens_f req_g)
(Steel.Semantics.Hoare.MST.bind_lpost req_f ens_f ens_g) | {
"end_col": 14,
"end_line": 116,
"start_col": 2,
"start_line": 116
} |
Prims.Tot | val bind_lift
(a: Type u#a)
(b: Type u#b)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#(max a b)
(U.raise_t b)
pre_f
(lift_post post_g)
(Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))
(Sem.bind_lpost u#(max a b) u#(max a b) #state #(U.raise_t u#a u#b a) #pre_f
#(lift_post post_f) req_f (lift_ens ens_f) #(U.raise_t b) #(lift_post post_g)
(lift_ens_x ens_g)) | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Instantiate",
"short_module": "Ins"
},
{
"abbrev": false,
"full_module": "Steel.Semantics.Instantiate",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Hoare.MST",
"short_module": "Sem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_lift (a:Type u#a) (b:Type u#b)
(pre_f:pre_t) (post_f:post_t a)
(req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b)
(req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f)
(g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#(max a b) (U.raise_t b)
pre_f
(lift_post post_g)
(Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))
(Sem.bind_lpost u#(max a b) u#(max a b)
#state #(U.raise_t u#a u#b a) #pre_f #(lift_post post_f)
req_f (lift_ens ens_f)
#(U.raise_t b) #(lift_post post_g)
(lift_ens_x ens_g))
= let f = lift_m f in
let g = lift_m_x g in
Sem.Bind f g | val bind_lift
(a: Type u#a)
(b: Type u#b)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#(max a b)
(U.raise_t b)
pre_f
(lift_post post_g)
(Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))
(Sem.bind_lpost u#(max a b) u#(max a b) #state #(U.raise_t u#a u#b a) #pre_f
#(lift_post post_f) req_f (lift_ens ens_f) #(U.raise_t b) #(lift_post post_g)
(lift_ens_x ens_g))
let bind_lift
(a: Type u#a)
(b: Type u#b)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#(max a b)
(U.raise_t b)
pre_f
(lift_post post_g)
(Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))
(Sem.bind_lpost u#(max a b) u#(max a b) #state #(U.raise_t u#a u#b a) #pre_f
#(lift_post post_f) req_f (lift_ens ens_f) #(U.raise_t b) #(lift_post post_g)
(lift_ens_x ens_g)) = | false | null | false | let f = lift_m f in
let g = lift_m_x g in
Sem.Bind f g | {
"checked_file": "Steel.Effect.M.fst.checked",
"dependencies": [
"Steel.Semantics.Instantiate.fsti.checked",
"Steel.Semantics.Hoare.MST.fst.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.Effect.M.fst"
} | [
"total"
] | [
"Steel.Effect.M.pre_t",
"Steel.Effect.M.post_t",
"Steel.Effect.M.req_t",
"Steel.Effect.M.ens_t",
"Steel.Effect.M.repr",
"Steel.Semantics.Hoare.MST.Bind",
"Steel.Semantics.Instantiate.state",
"FStar.Universe.raise_t",
"Steel.Effect.M.lift_post",
"Steel.Effect.M.lift_ens",
"Steel.Effect.M.lift_req_x",
"Steel.Effect.M.lift_ens_x",
"Steel.Effect.M.lift_m_x",
"Steel.Effect.M.lift_m",
"Steel.Semantics.Hoare.MST.bind_lpre",
"Steel.Semantics.Hoare.MST.bind_lpost"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Effect.M
//Note: This file is standalone and not used anywhere else in the Steel codebase
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module Ins = Steel.Semantics.Instantiate
open Steel.Memory
(*
* This module defines a layered effect over the CSL semantics
* from Steel.Semantics.Hoare.MST
*
* The effect is defined with action trees as the underlying representation
* for computations in the effect
*
* The effect combinators export the same specs as proved in the semantics
*
* The state typeclass in the semantics is instantiated with
* Steel.Semantics.Instantiate
*
* This module is for illustration, our examples rely on Steel.Effect.fst
* See the discussion towards the end of this file
*)
type pre_t = slprop u#1
type post_t (a:Type) = a -> slprop u#1
type req_t (pre:pre_t) = Sem.l_pre #state pre
type ens_t (pre:pre_t) (a:Type) (post:post_t a) = Sem.l_post #state #a pre post
/// Sem.m is the type of action trees in the semantics
type repr (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post) =
Sem.m state a pre post req ens
/// Effect return
let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
= Sem.Ret p x post
/// Effect bind
let bind (a:Type) (b:Type)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
/// A combinator for parallel computations
let par
(aL:Type) (preL:pre_t) (postL:post_t aL) (reqL:req_t preL) (ensL:ens_t preL aL postL)
(f:repr aL preL postL reqL ensL)
(aR:Type) (preR:pre_t) (postR:post_t aR) (reqR:req_t preR) (ensR:ens_t preR aR postR)
(g:repr aR preR postR reqR ensR)
: repr (aL & aR)
(preL `star` preR)
(fun (xL, xR) -> postL xL `star` postR xR)
(Sem.par_lpre reqL reqR)
(Sem.par_lpost reqL ensL reqR ensR)
= Sem.Par f g
/// Framing combinator
let frame (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post)
(f:repr a pre post req ens)
(frame:slprop) (f_frame:Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> post x `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame)
= Sem.Frame f frame f_frame
(*
* However, the effect defined this way is not immediately usable from F*
*
* To see the issue, consider again the `bind` combinator we defined above with
* explicit universe annotations:
*)
let bind_explicit_univs (a:Type u#a) (b:Type u#a)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
(*
* In the combinator, both the computation return types are in the same universe,
* and the combinator itself is polymorphic in that single universe
*
* However, composing computations whose result types are in different universes
* is useful. For example, composition of a computation returning an existential
* (p:Type0 & x:int{p}) that lives in u#1 with a continuation that projects and returns
* the int that lives in u#0.
*
* Hence, as with other F* effects, we would like to support a bind that is doubly
* polymorphic in the result type of both the computations, e.g. something like
*
* let bind_double_univs (a:Type u#a) (b:Type u#b)
* (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
* (post_g:post_t b)
* (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
* (f:repr a pre_f post_f req_f ens_f)
* (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
* : repr u#(max a b) b pre_f post_g
* (Sem.bind_lpre req_f ens_f req_g)
* (Sem.bind_lpost req_f ens_f ens_g) = ...
*
* But F*, like Lean and Agda, and unlike Coq, lacks cumulativity of universes.
* So the result type (repr u#(max a b) b ...) is not well-formed, since b has
* universe u#b and not u#(max a b)
*
* We could explicitly lift the universes to get the following type:
*
* let bind_double_univs_raise (a:Type u#a) (b:Type u#b)
* (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
* (post_g:post_t b)
* (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
* (f:repr a pre_f post_f req_f ens_f)
* (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
* : repr u#(max a b) (raise_t b) ...
*
* (In the file below, we sketch this in actual code.)
*
* But this results in other complications:
* 1. The user programs now have to explicitly eliminate raise_t (by downgrading)
* 2. F* effect system will reject this bind definition, since it is unaware of the
* universe lifting
*
* To get around this, we chose a different, more restrictive representation for the
* Steel effect in Steel.Effect.fst. That definition is suitably doubly universe
* polymorphic, at the expense of hiding the structure of the computation trees
* needed for a full fidelity interleaving semantics.
*
* Please see that file for further discussions on the limitations of that
* representation.
*
* In the meantime, we are working on adding universe cumulativity to F* that will
* allow bind_double_univs to be defined and then we can switch to the action trees
* based representation for the effect.
*)
/// Sketch for supporting different universes in the two computations
module U = FStar.Universe
module T = FStar.Tactics
/// Auxiliary functions for lifting post, ens, etc.
let lift_post #a (post:post_t u#a a)
: post_t u#(max a b) (U.raise_t a)
= fun x -> post (U.downgrade_val x)
let lift_ens #pre #a #post (ens:ens_t u#a pre a post)
: ens_t u#(max a b) pre (U.raise_t a) (lift_post post)
= fun m0 x m1 -> ens m0 (U.downgrade_val x) m1
let lift_req_x (#a:Type u#a) (#pre:a -> slprop) (req:(x:a -> req_t (pre x)))
: x:U.raise_t u#a u#b a -> req_t ((lift_post pre) x)
= fun x -> req (U.downgrade_val x)
let lift_ens_x (#a:Type u#a) (#pre:a -> slprop)
(#b:Type u#b) (#post:_)
(ens:(x:a -> ens_t u#b (pre x) b post))
: x:U.raise_t u#a u#b a ->
ens_t u#(max a b) ((lift_post pre) x) (U.raise_t b) (lift_post post)
= fun x -> (fun m0 y m1 -> (ens (U.downgrade_val x)) m0 (U.downgrade_val y) m1)
/// Lifting `m` terms, implementing only the Ret case
//NS, AR: This is failure since the patch to 2635
//It fails because:
// we got the problem ?u:t = e <: t, i.e. ascription on RHS,
// but when solving we removed the ascription, so we solved ?u = e
// and then retypechecking e did not succeed
//Some possibilities for restoring this:
// 1. Patch Rel to retain ascriptions?
// 2. Maybe using PR 2482 we can do the rewrite at a weaker type and then conclude
#push-options "--warn_error -296"
let lift_m (#a:Type u#a) (#pre:pre_t) (#post:post_t u#a a)
(#req:req_t pre) (#ens:ens_t pre a post)
(f:repr u#a a pre post req ens)
: repr u#(max a b) (FStar.Universe.raise_t a) pre (lift_post post) req (lift_ens ens)
= match f with
| Sem.Ret #_ #_ post x lpost ->
assert ((Sem.return_lpre #_ #_ #(lift_post post) (U.raise_val u#a u#b x) (lift_ens lpost)) ==
Sem.return_lpre #_ #_ #post x lpost) by
T.(tadmit()) ;
// T.(norm [delta_only [`%Sem.return_lpre; `%lift_post; `%lift_ens]];
// FStar.Tactics.Derived.l_to_r [`U.downgrade_val_raise_val ];
// trefl());
Sem.Ret (lift_post post) (U.raise_val x) (lift_ens lpost)
| _ -> admit ()
#pop-options
let lift_m_x (#a:Type u#a) (#pre:a -> slprop)
(#b:Type u#b) (#post:post_t b) (#req:(x:a -> req_t (pre x))) (#ens:(x:a -> ens_t (pre x) b post))
(f:(x:a -> repr u#b b (pre x) post (req x) (ens x)))
: x:U.raise_t u#a u#b a ->
repr u#(max a b) (U.raise_t b)
((lift_post pre) x)
(lift_post post)
((lift_req_x req) x)
((lift_ens_x ens) x)
= fun x -> lift_m (f (U.downgrade_val x))
/// Finally a lifted bind
let bind_lift (a:Type u#a) (b:Type u#b)
(pre_f:pre_t) (post_f:post_t a)
(req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b)
(req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f)
(g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#(max a b) (U.raise_t b)
pre_f
(lift_post post_g)
(Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))
(Sem.bind_lpost u#(max a b) u#(max a b)
#state #(U.raise_t u#a u#b a) #pre_f #(lift_post post_f)
req_f (lift_ens ens_f)
#(U.raise_t b) #(lift_post post_g) | false | false | Steel.Effect.M.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_lift
(a: Type u#a)
(b: Type u#b)
(pre_f: pre_t)
(post_f: post_t a)
(req_f: req_t pre_f)
(ens_f: ens_t pre_f a post_f)
(post_g: post_t b)
(req_g: (x: a -> req_t (post_f x)))
(ens_g: (x: a -> ens_t (post_f x) b post_g))
(f: repr a pre_f post_f req_f ens_f)
(g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#(max a b)
(U.raise_t b)
pre_f
(lift_post post_g)
(Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))
(Sem.bind_lpost u#(max a b) u#(max a b) #state #(U.raise_t u#a u#b a) #pre_f
#(lift_post post_f) req_f (lift_ens ens_f) #(U.raise_t b) #(lift_post post_g)
(lift_ens_x ens_g)) | [] | Steel.Effect.M.bind_lift | {
"file_name": "lib/steel/Steel.Effect.M.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
a: Type ->
b: Type ->
pre_f: Steel.Effect.M.pre_t ->
post_f: Steel.Effect.M.post_t a ->
req_f: Steel.Effect.M.req_t pre_f ->
ens_f: Steel.Effect.M.ens_t pre_f a post_f ->
post_g: Steel.Effect.M.post_t b ->
req_g: (x: a -> Steel.Effect.M.req_t (post_f x)) ->
ens_g: (x: a -> Steel.Effect.M.ens_t (post_f x) b post_g) ->
f: Steel.Effect.M.repr a pre_f post_f req_f ens_f ->
g: (x: a -> Steel.Effect.M.repr b (post_f x) post_g (req_g x) (ens_g x))
-> Steel.Effect.M.repr (FStar.Universe.raise_t b)
pre_f
(Steel.Effect.M.lift_post post_g)
(Steel.Semantics.Hoare.MST.bind_lpre req_f
(Steel.Effect.M.lift_ens ens_f)
(Steel.Effect.M.lift_req_x req_g))
(Steel.Semantics.Hoare.MST.bind_lpost req_f
(Steel.Effect.M.lift_ens ens_f)
(Steel.Effect.M.lift_ens_x ens_g)) | {
"end_col": 14,
"end_line": 265,
"start_col": 1,
"start_line": 263
} |
Prims.Tot | val lift_ens (#pre #a #post: _) (ens: ens_t u#a pre a post)
: ens_t u#(max a b) pre (U.raise_t a) (lift_post post) | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Instantiate",
"short_module": "Ins"
},
{
"abbrev": false,
"full_module": "Steel.Semantics.Instantiate",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": true,
"full_module": "Steel.Semantics.Hoare.MST",
"short_module": "Sem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lift_ens #pre #a #post (ens:ens_t u#a pre a post)
: ens_t u#(max a b) pre (U.raise_t a) (lift_post post)
= fun m0 x m1 -> ens m0 (U.downgrade_val x) m1 | val lift_ens (#pre #a #post: _) (ens: ens_t u#a pre a post)
: ens_t u#(max a b) pre (U.raise_t a) (lift_post post)
let lift_ens #pre #a #post (ens: ens_t u#a pre a post)
: ens_t u#(max a b) pre (U.raise_t a) (lift_post post) = | false | null | false | fun m0 x m1 -> ens m0 (U.downgrade_val x) m1 | {
"checked_file": "Steel.Effect.M.fst.checked",
"dependencies": [
"Steel.Semantics.Instantiate.fsti.checked",
"Steel.Semantics.Hoare.MST.fst.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.Effect.M.fst"
} | [
"total"
] | [
"Steel.Effect.M.pre_t",
"Steel.Effect.M.post_t",
"Steel.Effect.M.ens_t",
"Steel.Semantics.Hoare.MST.__proj__Mkst0__item__mem",
"Steel.Semantics.Instantiate.state",
"FStar.Universe.raise_t",
"FStar.Universe.downgrade_val",
"Prims.prop",
"Steel.Effect.M.lift_post"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.Effect.M
//Note: This file is standalone and not used anywhere else in the Steel codebase
module Sem = Steel.Semantics.Hoare.MST
module Mem = Steel.Memory
open Steel.Semantics.Instantiate
module Ins = Steel.Semantics.Instantiate
open Steel.Memory
(*
* This module defines a layered effect over the CSL semantics
* from Steel.Semantics.Hoare.MST
*
* The effect is defined with action trees as the underlying representation
* for computations in the effect
*
* The effect combinators export the same specs as proved in the semantics
*
* The state typeclass in the semantics is instantiated with
* Steel.Semantics.Instantiate
*
* This module is for illustration, our examples rely on Steel.Effect.fst
* See the discussion towards the end of this file
*)
type pre_t = slprop u#1
type post_t (a:Type) = a -> slprop u#1
type req_t (pre:pre_t) = Sem.l_pre #state pre
type ens_t (pre:pre_t) (a:Type) (post:post_t a) = Sem.l_post #state #a pre post
/// Sem.m is the type of action trees in the semantics
type repr (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post) =
Sem.m state a pre post req ens
/// Effect return
let return (a:Type) (x:a) (p:a -> slprop) (post:ens_t (p x) a p)
: repr a (p x) p (Sem.return_lpre #state #a #p x post) post
= Sem.Ret p x post
/// Effect bind
let bind (a:Type) (b:Type)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
/// A combinator for parallel computations
let par
(aL:Type) (preL:pre_t) (postL:post_t aL) (reqL:req_t preL) (ensL:ens_t preL aL postL)
(f:repr aL preL postL reqL ensL)
(aR:Type) (preR:pre_t) (postR:post_t aR) (reqR:req_t preR) (ensR:ens_t preR aR postR)
(g:repr aR preR postR reqR ensR)
: repr (aL & aR)
(preL `star` preR)
(fun (xL, xR) -> postL xL `star` postR xR)
(Sem.par_lpre reqL reqR)
(Sem.par_lpost reqL ensL reqR ensR)
= Sem.Par f g
/// Framing combinator
let frame (a:Type) (pre:pre_t) (post:post_t a) (req:req_t pre) (ens:ens_t pre a post)
(f:repr a pre post req ens)
(frame:slprop) (f_frame:Sem.fp_prop frame)
: repr a
(pre `star` frame)
(fun x -> post x `star` frame)
(Sem.frame_lpre req f_frame)
(Sem.frame_lpost req ens f_frame)
= Sem.Frame f frame f_frame
(*
* However, the effect defined this way is not immediately usable from F*
*
* To see the issue, consider again the `bind` combinator we defined above with
* explicit universe annotations:
*)
let bind_explicit_univs (a:Type u#a) (b:Type u#a)
(pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
(post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
(f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
: repr u#a b pre_f post_g
(Sem.bind_lpre req_f ens_f req_g)
(Sem.bind_lpost req_f ens_f ens_g)
= Sem.Bind f g
(*
* In the combinator, both the computation return types are in the same universe,
* and the combinator itself is polymorphic in that single universe
*
* However, composing computations whose result types are in different universes
* is useful. For example, composition of a computation returning an existential
* (p:Type0 & x:int{p}) that lives in u#1 with a continuation that projects and returns
* the int that lives in u#0.
*
* Hence, as with other F* effects, we would like to support a bind that is doubly
* polymorphic in the result type of both the computations, e.g. something like
*
* let bind_double_univs (a:Type u#a) (b:Type u#b)
* (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
* (post_g:post_t b)
* (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
* (f:repr a pre_f post_f req_f ens_f)
* (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
* : repr u#(max a b) b pre_f post_g
* (Sem.bind_lpre req_f ens_f req_g)
* (Sem.bind_lpost req_f ens_f ens_g) = ...
*
* But F*, like Lean and Agda, and unlike Coq, lacks cumulativity of universes.
* So the result type (repr u#(max a b) b ...) is not well-formed, since b has
* universe u#b and not u#(max a b)
*
* We could explicitly lift the universes to get the following type:
*
* let bind_double_univs_raise (a:Type u#a) (b:Type u#b)
* (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)
* (post_g:post_t b)
* (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))
* (f:repr a pre_f post_f req_f ens_f)
* (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))
* : repr u#(max a b) (raise_t b) ...
*
* (In the file below, we sketch this in actual code.)
*
* But this results in other complications:
* 1. The user programs now have to explicitly eliminate raise_t (by downgrading)
* 2. F* effect system will reject this bind definition, since it is unaware of the
* universe lifting
*
* To get around this, we chose a different, more restrictive representation for the
* Steel effect in Steel.Effect.fst. That definition is suitably doubly universe
* polymorphic, at the expense of hiding the structure of the computation trees
* needed for a full fidelity interleaving semantics.
*
* Please see that file for further discussions on the limitations of that
* representation.
*
* In the meantime, we are working on adding universe cumulativity to F* that will
* allow bind_double_univs to be defined and then we can switch to the action trees
* based representation for the effect.
*)
/// Sketch for supporting different universes in the two computations
module U = FStar.Universe
module T = FStar.Tactics
/// Auxiliary functions for lifting post, ens, etc.
let lift_post #a (post:post_t u#a a)
: post_t u#(max a b) (U.raise_t a)
= fun x -> post (U.downgrade_val x)
let lift_ens #pre #a #post (ens:ens_t u#a pre a post) | false | false | Steel.Effect.M.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lift_ens (#pre #a #post: _) (ens: ens_t u#a pre a post)
: ens_t u#(max a b) pre (U.raise_t a) (lift_post post) | [] | Steel.Effect.M.lift_ens | {
"file_name": "lib/steel/Steel.Effect.M.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | ens: Steel.Effect.M.ens_t pre a post
-> Steel.Effect.M.ens_t pre (FStar.Universe.raise_t a) (Steel.Effect.M.lift_post post) | {
"end_col": 46,
"end_line": 190,
"start_col": 2,
"start_line": 190
} |
Prims.Tot | val bn_field_get_len: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> BN.bn_len t | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_get_len #t k = k.len | val bn_field_get_len: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> BN.bn_len t
let bn_field_get_len #t k = | false | null | false | k.len | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"total"
] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.bn_len"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
/////////////////////////////////////////////// | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_get_len: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> BN.bn_len t | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_get_len | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t {Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k}
-> Hacl.Spec.Bignum.bn_len t | {
"end_col": 33,
"end_line": 82,
"start_col": 28,
"start_line": 82
} |
FStar.Pervasives.Lemma | val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_nonzero_lemma n x y =
mul_zero_lemma n x y | val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y = | false | null | true | mul_zero_lemma n x y | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"lemma"
] | [
"Prims.pos",
"FStar.Math.Euclid.is_prime",
"Prims.int",
"Hacl.Spec.Bignum.MontArithmetic.mul_zero_lemma",
"Prims.unit"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0) | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0) | [] | Hacl.Spec.Bignum.MontArithmetic.mul_nonzero_lemma | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.pos{FStar.Math.Euclid.is_prime n} -> x: Prims.int -> y: Prims.int
-> FStar.Pervasives.Lemma (requires x % n <> 0 /\ y % n <> 0) (ensures x * y % n <> 0) | {
"end_col": 22,
"end_line": 46,
"start_col": 2,
"start_line": 46
} |
Prims.Tot | val bn_field_check_modulus: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len ->
res:bool{res <==> bn_mont_ctx_pre n} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m | val bn_field_check_modulus: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len ->
res:bool{res <==> bn_mont_ctx_pre n}
let bn_field_check_modulus #t #len n = | false | null | false | let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"total"
] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.bn_len",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Base.unsafe_bool_of_limb",
"Hacl.Spec.Bignum.Definitions.limb",
"Prims.eq2",
"Prims.int",
"Lib.IntTypes.range",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.op_Modulus",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Prims.op_LessThan",
"Lib.IntTypes.ones",
"Prims.bool",
"Lib.IntTypes.zeros",
"Hacl.Spec.Bignum.Montgomery.bn_check_modulus",
"Prims.l_iff",
"Prims.b2t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_pre"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_check_modulus: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len ->
res:bool{res <==> bn_mont_ctx_pre n} | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_check_modulus | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Hacl.Spec.Bignum.Definitions.lbignum t len
-> res: Prims.bool{res <==> Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_pre n} | {
"end_col": 26,
"end_line": 87,
"start_col": 38,
"start_line": 85
} |
Prims.Pure | val bn_field_one: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun oneM ->
bn_v (bn_from_field k oneM) == 1) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_one #t k =
BM.bn_mont_one_lemma k.n k.mu k.r2;
M.from_mont_one_lemma (bits t) k.len (bn_v k.n) (v k.mu);
BM.bn_mont_one k.n k.mu r2 | val bn_field_one: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun oneM ->
bn_v (bn_from_field k oneM) == 1)
let bn_field_one #t k = | false | null | false | BM.bn_mont_one_lemma k.n k.mu k.r2;
M.from_mont_one_lemma (bits t) k.len (bn_v k.n) (v k.mu);
BM.bn_mont_one k.n k.mu r2 | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.Montgomery.bn_mont_one",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Hacl.Spec.Bignum.MontArithmetic.r2",
"Prims.unit",
"Hacl.Spec.Montgomery.Lemmas.from_mont_one_lemma",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.Montgomery.bn_mont_one_lemma",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__r2",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM
let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM
let bn_field_mul #t k aM bM =
BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM
let bn_field_sqr #t k aM =
BM.bn_mont_sqr_lemma k.n k.mu aM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v aM);
BM.bn_mont_sqr k.n k.mu aM | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_one: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun oneM ->
bn_v (bn_from_field k oneM) == 1) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_one | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t {Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k}
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 28,
"end_line": 149,
"start_col": 2,
"start_line": 147
} |
FStar.Pervasives.Lemma | val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0) | val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM = | false | null | true | let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = - d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((- d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0) | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"lemma"
] | [
"Prims.pos",
"Prims.nat",
"Prims.int",
"Prims._assert",
"Prims.b2t",
"Prims.op_disEquality",
"Prims.unit",
"Hacl.Spec.Bignum.MontArithmetic.mul_nonzero_lemma",
"Prims.op_Modulus",
"Prims.eq2",
"Prims.op_Minus",
"Prims.op_Subtraction",
"FStar.Math.Lemmas.lemma_mod_sub_1",
"Prims.l_and",
"Prims.op_LessThan",
"FStar.Math.Lemmas.small_mod",
"FStar.Mul.op_Star",
"Hacl.Spec.Montgomery.Lemmas.from_mont_lemma",
"Hacl.Spec.Montgomery.Lemmas.from_mont",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Montgomery.Lemmas.eea_pow2_odd",
"Prims.pow2"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n)) | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n)) | [] | Hacl.Spec.Bignum.MontArithmetic.from_mont_lemma_nonzero | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | pbits: Prims.pos -> rLen: Prims.pos -> n: Prims.pos -> mu: Prims.nat -> aM: Prims.nat
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.Montgomery.Lemmas.mont_pre pbits rLen n mu /\ 0 < aM /\ aM < n /\
FStar.Math.Euclid.is_prime n)
(ensures
(let a = Hacl.Spec.Montgomery.Lemmas.from_mont pbits rLen n mu aM in
0 < a /\ a < n)) | {
"end_col": 17,
"end_line": 77,
"start_col": 48,
"start_line": 58
} |
FStar.Pervasives.Lemma | val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else () | val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y = | false | null | true | assert (0 % n = 0);
if x % n = 0
then Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0
then Math.Lemmas.lemma_mod_mul_distr_r x y n
else if x * y % n = 0 then Math.Fermat.mod_mult_congr n x 0 y | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"lemma"
] | [
"Prims.pos",
"FStar.Math.Euclid.is_prime",
"Prims.int",
"Prims.op_Equality",
"Prims.op_Modulus",
"FStar.Math.Lemmas.lemma_mod_mul_distr_l",
"Prims.bool",
"FStar.Math.Lemmas.lemma_mod_mul_distr_r",
"FStar.Mul.op_Star",
"FStar.Math.Fermat.mod_mult_congr",
"Prims.unit",
"Prims._assert",
"Prims.b2t"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0)) | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0)) | [] | Hacl.Spec.Bignum.MontArithmetic.mul_zero_lemma | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.pos{FStar.Math.Euclid.is_prime n} -> x: Prims.int -> y: Prims.int
-> FStar.Pervasives.Lemma (ensures x * y % n == 0 <==> x % n == 0 \/ y % n == 0) | {
"end_col": 13,
"end_line": 39,
"start_col": 2,
"start_line": 30
} |
Prims.Pure | val bn_field_add: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == (bn_v (bn_from_field k aM) + bn_v (bn_from_field k bM)) % bn_v k.n) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM | val bn_field_add: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == (bn_v (bn_from_field k aM) + bn_v (bn_from_field k bM)) % bn_v k.n)
let bn_field_add #t k aM bM = | false | null | false | BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Hacl.Spec.Bignum.bn_add_mod_n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Prims.unit",
"Hacl.Spec.Montgomery.Lemmas.from_mont_add_lemma",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Hacl.Spec.Bignum.bn_add_mod_n_lemma"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a) | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_add: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == (bn_v (bn_from_field k aM) + bn_v (bn_from_field k bM)) % bn_v k.n) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_add | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
aM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k ->
bM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 27,
"end_line": 125,
"start_col": 2,
"start_line": 123
} |
Prims.Pure | val bn_field_sub: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == (bn_v (bn_from_field k aM) - bn_v (bn_from_field k bM)) % bn_v k.n) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM | val bn_field_sub: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == (bn_v (bn_from_field k aM) - bn_v (bn_from_field k bM)) % bn_v k.n)
let bn_field_sub #t k aM bM = | false | null | false | BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Hacl.Spec.Bignum.bn_sub_mod_n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Prims.unit",
"Hacl.Spec.Montgomery.Lemmas.from_mont_sub_lemma",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Hacl.Spec.Bignum.bn_sub_mod_n_lemma"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_sub: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == (bn_v (bn_from_field k aM) - bn_v (bn_from_field k bM)) % bn_v k.n) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_sub | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
aM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k ->
bM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 27,
"end_line": 131,
"start_col": 2,
"start_line": 129
} |
FStar.Pervasives.Lemma | val bn_from_to_field_lemma: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> a:lbignum t k.len ->
Lemma (bn_v (bn_from_field k (bn_to_field k a)) == bn_v a % bn_v k.n) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a) | val bn_from_to_field_lemma: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> a:lbignum t k.len ->
Lemma (bn_v (bn_from_field k (bn_to_field k a)) == bn_v a % bn_v k.n)
let bn_from_to_field_lemma #t k a = | false | null | true | bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a) | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"lemma"
] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Montgomery.Lemmas.from_to_mont_lemma",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.unit",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_from_to_field_lemma: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> a:lbignum t k.len ->
Lemma (bn_v (bn_from_field k (bn_to_field k a)) == bn_v a % bn_v k.n) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_from_to_field_lemma | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
a: Hacl.Spec.Bignum.Definitions.lbignum t (Mkbn_mont_ctx?.len k)
-> FStar.Pervasives.Lemma
(ensures
Hacl.Spec.Bignum.Definitions.bn_v (Hacl.Spec.Bignum.MontArithmetic.bn_from_field k
(Hacl.Spec.Bignum.MontArithmetic.bn_to_field k a)) ==
Hacl.Spec.Bignum.Definitions.bn_v a % Hacl.Spec.Bignum.Definitions.bn_v (Mkbn_mont_ctx?.n k)) | {
"end_col": 66,
"end_line": 119,
"start_col": 2,
"start_line": 118
} |
Prims.Pure | val bn_to_field: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> a:lbignum t k.len ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun aM ->
bn_v aM == M.to_mont (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a | val bn_to_field: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> a:lbignum t k.len ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun aM ->
bn_v aM == M.to_mont (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a))
let bn_to_field #t k a = | false | null | false | BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.Montgomery.bn_to_mont",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__r2",
"Prims.unit",
"Hacl.Spec.Bignum.Montgomery.bn_to_mont_lemma",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 } | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_to_field: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> a:lbignum t k.len ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun aM ->
bn_v aM == M.to_mont (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_to_field | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
a: Hacl.Spec.Bignum.Definitions.lbignum t (Mkbn_mont_ctx?.len k)
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 31,
"end_line": 109,
"start_col": 2,
"start_line": 108
} |
Prims.Pure | val bn_field_init: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len ->
Pure (bn_mont_ctx t)
(requires bn_mont_ctx_pre n)
(ensures fun k -> bn_mont_ctx_inv k /\ k.n == n /\ k.len == len) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 } | val bn_field_init: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len ->
Pure (bn_mont_ctx t)
(requires bn_mont_ctx_pre n)
(ensures fun k -> bn_mont_ctx_inv k /\ k.n == n /\ k.len == len)
let bn_field_init #t #len n = | false | null | false | let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 ((2 * bits t) * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[ 0 ] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 } | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.bn_len",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.MontArithmetic.Mkbn_mont_ctx",
"Prims.unit",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Prims.pow2",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.ModInvLimb.bn_mod_inv_limb_lemma",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.ModInvLimb.mod_inv_limb",
"Lib.Sequence.op_String_Access",
"Hacl.Spec.Bignum.Montgomery.bn_precomp_r2_mod_n",
"Hacl.Spec.Bignum.Montgomery.bn_precomp_r2_mod_n_lemma",
"Hacl.Spec.Bignum.Lib.bn_low_bound_bits_lemma",
"Hacl.Spec.Bignum.Lib.bn_get_top_index",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_init: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len ->
Pure (bn_mont_ctx t)
(requires bn_mont_ctx_pre n)
(ensures fun k -> bn_mont_ctx_inv k /\ k.n == n /\ k.len == len) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_init | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Hacl.Spec.Bignum.Definitions.lbignum t len
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t) | {
"end_col": 40,
"end_line": 104,
"start_col": 29,
"start_line": 90
} |
Prims.Pure | val bn_field_mul: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == bn_v (bn_from_field k aM) * bn_v (bn_from_field k bM) % bn_v k.n) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_mul #t k aM bM =
BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM | val bn_field_mul: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == bn_v (bn_from_field k aM) * bn_v (bn_from_field k bM) % bn_v k.n)
let bn_field_mul #t k aM bM = | false | null | false | BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Hacl.Spec.Bignum.Montgomery.bn_mont_mul",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.unit",
"Hacl.Spec.Montgomery.Lemmas.from_mont_mul_lemma",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.Montgomery.bn_mont_mul_lemma"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM
let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_mul: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k -> bM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == bn_v (bn_from_field k aM) * bn_v (bn_from_field k bM) % bn_v k.n) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_mul | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
aM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k ->
bM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 31,
"end_line": 137,
"start_col": 2,
"start_line": 135
} |
Prims.Pure | val bn_from_field: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (lbignum t k.len)
(requires True)
(ensures fun a -> bn_v a < bn_v k.n /\
bn_v a == M.from_mont (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM)) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM | val bn_from_field: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (lbignum t k.len)
(requires True)
(ensures fun a -> bn_v a < bn_v k.n /\
bn_v a == M.from_mont (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM))
let bn_from_field #t k aM = | false | null | false | BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Hacl.Spec.Bignum.Montgomery.bn_from_mont",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.unit",
"Hacl.Spec.Bignum.Montgomery.bn_from_mont_lemma",
"Hacl.Spec.Bignum.Definitions.lbignum"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_from_field: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (lbignum t k.len)
(requires True)
(ensures fun a -> bn_v a < bn_v k.n /\
bn_v a == M.from_mont (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM)) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_from_field | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
aM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k
-> Prims.Pure (Hacl.Spec.Bignum.Definitions.lbignum t (Mkbn_mont_ctx?.len k)) | {
"end_col": 29,
"end_line": 114,
"start_col": 2,
"start_line": 113
} |
Prims.Tot | val bn_field_exp_consttime: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> bn_field_exp_st t k | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_exp_consttime #t k aM bBits b =
E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_consttime k.n k.mu aM bBits b | val bn_field_exp_consttime: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> bn_field_exp_st t k
let bn_field_exp_consttime #t k aM bBits b = | false | null | false | E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_consttime k.n k.mu aM bBits b | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"total"
] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Lib.IntTypes.size_nat",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.blocks0",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_consttime",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.unit",
"Hacl.Spec.Exponentiation.Lemmas.from_mont_exp_lemma",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM
let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM
let bn_field_mul #t k aM bM =
BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM
let bn_field_sqr #t k aM =
BM.bn_mont_sqr_lemma k.n k.mu aM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v aM);
BM.bn_mont_sqr k.n k.mu aM
let bn_field_one #t k =
BM.bn_mont_one_lemma k.n k.mu k.r2;
M.from_mont_one_lemma (bits t) k.len (bn_v k.n) (v k.mu);
BM.bn_mont_one k.n k.mu r2 | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_exp_consttime: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> bn_field_exp_st t k | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_exp_consttime | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t {Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k}
-> Hacl.Spec.Bignum.MontArithmetic.bn_field_exp_st t k | {
"end_col": 46,
"end_line": 154,
"start_col": 2,
"start_line": 153
} |
Prims.Pure | val bn_field_sqr: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == bn_v (bn_from_field k aM) * bn_v (bn_from_field k aM) % bn_v k.n) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_sqr #t k aM =
BM.bn_mont_sqr_lemma k.n k.mu aM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v aM);
BM.bn_mont_sqr k.n k.mu aM | val bn_field_sqr: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == bn_v (bn_from_field k aM) * bn_v (bn_from_field k aM) % bn_v k.n)
let bn_field_sqr #t k aM = | false | null | false | BM.bn_mont_sqr_lemma k.n k.mu aM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v aM);
BM.bn_mont_sqr k.n k.mu aM | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Hacl.Spec.Bignum.Montgomery.bn_mont_sqr",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.unit",
"Hacl.Spec.Montgomery.Lemmas.from_mont_mul_lemma",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.Montgomery.bn_mont_sqr_lemma"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM
let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM
let bn_field_mul #t k aM bM =
BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_sqr: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires True)
(ensures fun cM ->
bn_v (bn_from_field k cM) == bn_v (bn_from_field k aM) * bn_v (bn_from_field k aM) % bn_v k.n) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_sqr | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
aM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 28,
"end_line": 143,
"start_col": 2,
"start_line": 141
} |
Prims.Tot | val bn_field_exp_vartime: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> bn_field_exp_st t k | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_exp_vartime #t k aM bBits b =
E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_vartime k.n k.mu aM bBits b | val bn_field_exp_vartime: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> bn_field_exp_st t k
let bn_field_exp_vartime #t k aM bBits b = | false | null | false | E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_vartime k.n k.mu aM bBits b | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [
"total"
] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Lib.IntTypes.size_nat",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.blocks0",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_vartime",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.unit",
"Hacl.Spec.Exponentiation.Lemmas.from_mont_exp_lemma",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM
let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM
let bn_field_mul #t k aM bM =
BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM
let bn_field_sqr #t k aM =
BM.bn_mont_sqr_lemma k.n k.mu aM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v aM);
BM.bn_mont_sqr k.n k.mu aM
let bn_field_one #t k =
BM.bn_mont_one_lemma k.n k.mu k.r2;
M.from_mont_one_lemma (bits t) k.len (bn_v k.n) (v k.mu);
BM.bn_mont_one k.n k.mu r2
let bn_field_exp_consttime #t k aM bBits b =
E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_consttime k.n k.mu aM bBits b | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_exp_vartime: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> bn_field_exp_st t k | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_exp_vartime | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t {Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k}
-> Hacl.Spec.Bignum.MontArithmetic.bn_field_exp_st t k | {
"end_col": 44,
"end_line": 159,
"start_col": 2,
"start_line": 158
} |
Prims.Pure | val bn_field_inv: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires 0 < bn_v aM /\ Euclid.is_prime (bn_v k.n))
(ensures fun aInvM ->
bn_v (bn_from_field k aInvM) * bn_v (bn_from_field k aM) % bn_v k.n == 1) | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.MontExponentiation",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Exponentiation.Lemmas",
"short_module": "E"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.ModInvLimb",
"short_module": "BIL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "BL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": "BB"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "FStar.Math.Euclid",
"short_module": "Euclid"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_field_inv #t k aM =
let n2 = BI.bn_mod_inv_prime_n2 k.n in
assert (bn_v n2 == bn_v k.n - 2);
let aInvM = bn_field_exp_vartime #t k aM (k.len * bits t) n2 in
assert (bn_v (bn_from_field k aInvM) == Lib.NatMod.pow_mod #(bn_v k.n) (bn_v (bn_from_field k aM)) (bn_v n2));
from_mont_lemma_nonzero (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM);
assert (0 < bn_v (bn_from_field k aM));
BI.mod_inv_prime_lemma (bn_v k.n) (bn_v (bn_from_field k aM));
aInvM | val bn_field_inv: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires 0 < bn_v aM /\ Euclid.is_prime (bn_v k.n))
(ensures fun aInvM ->
bn_v (bn_from_field k aInvM) * bn_v (bn_from_field k aM) % bn_v k.n == 1)
let bn_field_inv #t k aM = | false | null | false | let n2 = BI.bn_mod_inv_prime_n2 k.n in
assert (bn_v n2 == bn_v k.n - 2);
let aInvM = bn_field_exp_vartime #t k aM (k.len * bits t) n2 in
assert (bn_v (bn_from_field k aInvM) ==
Lib.NatMod.pow_mod #(bn_v k.n) (bn_v (bn_from_field k aM)) (bn_v n2));
from_mont_lemma_nonzero (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM);
assert (0 < bn_v (bn_from_field k aM));
BI.mod_inv_prime_lemma (bn_v k.n) (bn_v (bn_from_field k aM));
aInvM | {
"checked_file": "Hacl.Spec.Bignum.MontArithmetic.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Exponentiation.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.MontExponentiation.fst.checked",
"Hacl.Spec.Bignum.ModInvLimb.fsti.checked",
"Hacl.Spec.Bignum.ModInv.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Math.Fermat.fsti.checked",
"FStar.Math.Euclid.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.MontArithmetic.fst"
} | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv",
"Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat",
"Prims.unit",
"Hacl.Spec.Bignum.ModInv.mod_inv_prime_lemma",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__len",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__n",
"Hacl.Spec.Bignum.MontArithmetic.bn_from_field",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Spec.Bignum.MontArithmetic.from_mont_lemma_nonzero",
"Lib.IntTypes.bits",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Hacl.Spec.Bignum.MontArithmetic.__proj__Mkbn_mont_ctx__item__mu",
"Prims.eq2",
"Prims.nat",
"Lib.NatMod.pow_mod",
"Hacl.Spec.Bignum.MontArithmetic.bn_field_exp_vartime",
"FStar.Mul.op_Star",
"Prims.int",
"Prims.op_Subtraction",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.ModInv.bn_mod_inv_prime_n2"
] | [] | module Hacl.Spec.Bignum.MontArithmetic
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BM = Hacl.Spec.Bignum.Montgomery
module BN = Hacl.Spec.Bignum
module BB = Hacl.Spec.Bignum.Base
module BL = Hacl.Spec.Bignum.Lib
module BIL = Hacl.Spec.Bignum.ModInvLimb
module E = Hacl.Spec.Exponentiation.Lemmas
module ME = Hacl.Spec.Bignum.MontExponentiation
module Euclid = FStar.Math.Euclid
module BI = Hacl.Spec.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
//////////////////////////////////////////
val mul_zero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int ->
Lemma (x * y % n == 0 <==> (x % n == 0 \/ y % n == 0))
let mul_zero_lemma n x y =
assert (0 % n = 0);
if x % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_l x y n
else
if y % n = 0 then
Math.Lemmas.lemma_mod_mul_distr_r x y n
else
if x * y % n = 0 then
Math.Fermat.mod_mult_congr n x 0 y
else ()
val mul_nonzero_lemma: n:pos{Euclid.is_prime n} -> x:int -> y:int -> Lemma
(requires x % n <> 0 /\ y % n <> 0)
(ensures x * y % n <> 0)
let mul_nonzero_lemma n x y =
mul_zero_lemma n x y
val from_mont_lemma_nonzero: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> aM:nat -> Lemma
(requires
M.mont_pre pbits rLen n mu /\
0 < aM /\ aM < n /\
Euclid.is_prime n)
(ensures
(let a = M.from_mont pbits rLen n mu aM in
0 < a /\ a < n))
let from_mont_lemma_nonzero pbits rLen n mu aM =
let r = pow2 (pbits * rLen) in
let d, _ = M.eea_pow2_odd (pbits * rLen) n in
let a = M.from_mont pbits rLen n mu aM in
M.from_mont_lemma pbits rLen n mu aM;
assert (a == aM * d % n);
assert (d <> 0);
Math.Lemmas.small_mod aM n;
assert (aM % n <> 0);
let d1 = -d in
assert (0 < d1 /\ d1 < n);
Math.Lemmas.lemma_mod_sub_1 d1 n;
assert ((-d1) % n == n - (d1 % n));
assert (d % n <> 0);
mul_nonzero_lemma n aM d;
assert (a <> 0)
///////////////////////////////////////////////
let bn_field_get_len #t k = k.len
let bn_field_check_modulus #t #len n =
let m = BM.bn_check_modulus n in
BB.unsafe_bool_of_limb m
let bn_field_init #t #len n =
let nBits = bits t * BL.bn_get_top_index n in
BL.bn_low_bound_bits_lemma n;
BM.bn_precomp_r2_mod_n_lemma nBits n;
let r2 = BM.bn_precomp_r2_mod_n nBits n in
assert (bn_v r2 == pow2 (2 * bits t * len) % bn_v n);
let mu = BIL.mod_inv_limb n.[0] in
BIL.bn_mod_inv_limb_lemma n;
assert ((1 + bn_v n * v mu) % pow2 (bits t) == 0);
bn_eval_bound n len;
{ len = len; n = n; mu = mu; r2 = r2 }
let bn_to_field #t k a =
BM.bn_to_mont_lemma k.n k.mu k.r2 a;
BM.bn_to_mont k.n k.mu k.r2 a
let bn_from_field #t k aM =
BM.bn_from_mont_lemma k.n k.mu aM;
BM.bn_from_mont k.n k.mu aM
let bn_from_to_field_lemma #t k a =
bn_eval_bound a k.len;
M.from_to_mont_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v a)
let bn_field_add #t k aM bM =
BN.bn_add_mod_n_lemma k.n aM bM;
M.from_mont_add_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_add_mod_n k.n aM bM
let bn_field_sub #t k aM bM =
BN.bn_sub_mod_n_lemma k.n aM bM;
M.from_mont_sub_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BN.bn_sub_mod_n k.n aM bM
let bn_field_mul #t k aM bM =
BM.bn_mont_mul_lemma k.n k.mu aM bM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v bM);
BM.bn_mont_mul k.n k.mu aM bM
let bn_field_sqr #t k aM =
BM.bn_mont_sqr_lemma k.n k.mu aM;
M.from_mont_mul_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v aM);
BM.bn_mont_sqr k.n k.mu aM
let bn_field_one #t k =
BM.bn_mont_one_lemma k.n k.mu k.r2;
M.from_mont_one_lemma (bits t) k.len (bn_v k.n) (v k.mu);
BM.bn_mont_one k.n k.mu r2
let bn_field_exp_consttime #t k aM bBits b =
E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_consttime k.n k.mu aM bBits b
let bn_field_exp_vartime #t k aM bBits b =
E.from_mont_exp_lemma (bits t) k.len (bn_v k.n) (v k.mu) (bn_v aM) (bn_v b);
ME.bn_exp_mont_vartime k.n k.mu aM bBits b | false | false | Hacl.Spec.Bignum.MontArithmetic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_field_inv: #t:limb_t -> k:bn_mont_ctx t{bn_mont_ctx_inv k} -> aM:bn_mont_nat k ->
Pure (bn_mont_nat k)
(requires 0 < bn_v aM /\ Euclid.is_prime (bn_v k.n))
(ensures fun aInvM ->
bn_v (bn_from_field k aInvM) * bn_v (bn_from_field k aM) % bn_v k.n == 1) | [] | Hacl.Spec.Bignum.MontArithmetic.bn_field_inv | {
"file_name": "code/bignum/Hacl.Spec.Bignum.MontArithmetic.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k:
Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx t
{Hacl.Spec.Bignum.MontArithmetic.bn_mont_ctx_inv k} ->
aM: Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k
-> Prims.Pure (Hacl.Spec.Bignum.MontArithmetic.bn_mont_nat k) | {
"end_col": 7,
"end_line": 170,
"start_col": 26,
"start_line": 162
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Tactics.Unseal",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.VConfig",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Result",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Data",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.Const",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ret_t (a:Type) = option a & issues | let ret_t (a: Type) = | false | null | false | option a & issues | {
"checked_file": "FStar.Tactics.V2.Builtins.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.VConfig.fsti.checked",
"FStar.Tactics.Unseal.fsti.checked",
"FStar.Tactics.Types.fsti.checked",
"FStar.Tactics.Result.fsti.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.Data.fsti.checked",
"FStar.Reflection.V2.Builtins.fsti.checked",
"FStar.Reflection.Types.fsti.checked",
"FStar.Reflection.Const.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V2.Builtins.fsti"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.option",
"FStar.Tactics.Types.issues"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
(**
Every tactic primitive, i.e., those built into the compiler
@summary Tactic primitives
*)
module FStar.Tactics.V2.Builtins
open FStar.Reflection.Types
open FStar.Reflection.Const
open FStar.Reflection.V2.Data
open FStar.Reflection.V2.Builtins
open FStar.Tactics.Effect
open FStar.Tactics.Types
open FStar.Tactics.Result
open FStar.VConfig
include FStar.Tactics.Unseal
(** Resolve unification variable indirections at the top of the term. *)
val compress : term -> Tac term
(** [top_env] returns the environment where the tactic started running.
* This works even if no goals are present. *)
val top_env : unit -> Tac env
(** [fresh ()] returns a fresh number generated by incrementing an
internal counter. The counter does not get reset when catching a
failure. *)
val fresh : unit -> Tac nat
(** [refine_intro] will turn a goal of shape [w : x:t{phi}]
into [w : t] and [phi{w/x}] *)
val refine_intro : unit -> Tac unit
(** [tc] returns the type of a term in [env],
or fails if it is untypeable. *)
val tc : env -> term -> Tac term
(** [tcc] like [tc], but returns the full computation type
with the effect label and its arguments (WPs, etc) as well *)
val tcc : env -> term -> Tac comp
(** [unshelve] creates a goal from a term for its given type.
It can be used when the system decided not to present a goal, but
you want one anyway. For example, if you request a uvar through
[uvar_env] or [fresh_uvar], you might want to instantiate it
explicitly. *)
val unshelve : term -> Tac unit
(** [unquote t] with turn a quoted term [t] into an actual value, of
any type. This will fail at tactic runtime if the quoted term does not
typecheck to type [a]. *)
val unquote : #a:Type -> term -> Tac a
(** [catch t] will attempt to run [t] and allow to recover from a
failure. If [t] succeeds with return value [a], [catch t] returns [Inr
a]. On failure, it returns [Inl msg], where [msg] is the error [t]
raised, and all unionfind effects are reverted. See also [recover] and
[or_else]. *)
val catch : #a:Type -> (unit -> Tac a) -> TacS (either exn a)
(** Like [catch t], but will not discard unionfind effects on failure. *)
val recover : #a:Type -> (unit -> Tac a) -> TacS (either exn a)
(** [norm steps] will call the normalizer on the current goal's
type and witness, with its reduction behaviour parameterized
by the flags in [steps].
Currently, the flags (provided in FStar.Pervasives) are
[simpl] (do logical simplifications)
[whnf] (only reduce until weak head-normal-form)
[primops] (performing primitive reductions, such as arithmetic and
string operations)
[delta] (unfold names)
[zeta] (unroll let rec bindings, but with heuristics to avoid loops)
[zeta_full] (unroll let rec bindings fully)
[iota] (reduce match statements over constructors)
[delta_only] (restrict delta to only unfold this list of fully-qualified identifiers)
*)
val norm : list norm_step -> Tac unit
(** [norm_term_env e steps t] will call the normalizer on the term [t]
using the list of steps [steps], over environment [e]. The list has the same meaning as for [norm]. *)
val norm_term_env : env -> list norm_step -> term -> Tac term
(** [norm_binding_type steps b] will call the normalizer on the type of the [b]
binding for the current goal. Notably, this cannot be done via var_retype and norm,
because of uvars being resolved to lambda-abstractions. *)
val norm_binding_type : list norm_step -> binding -> Tac unit
(** [intro] pushes the first argument of an arrow goal into the
environment, turning [Gamma |- ?u : x:a -> b] into [Gamma, x:a |- ?u' : b].
Note that this does not work for logical implications/forall. See
FStar.Tactics.Logic for that.
*)
val intro : unit -> Tac binding
(** Similar to intros, but allows to build a recursive function.
Currently broken (c.f. issue #1103)
*)
val intro_rec : unit -> Tac (binding * binding)
(** [rename_to b nm] will rename the binder [b] to [nm] in
the environment, goal, and witness in a safe manner. The only use of this
is to make goals and terms more user readable. The primitive returns
the new binder, since the old one disappears from the context. *)
val rename_to : binding -> string -> Tac binding
(** [revert] pushes out a binder from the environment into the goal type,
so a behaviour opposite to [intros].
*)
val revert : unit -> Tac unit
(** [var_retype] changes the type of a variable in the context. After
calling it with a binding of type `t`, the user is presented with a goal
of the form `t == ?u` to be filled. The original goal (following that
one) has the type of `b` in the context replaced by `?u`. *)
val var_retype : binding -> Tac unit
(** [clear_top] will drop the outermost binder from the environment. Can
only be used if the goal does not at all depend on it. *)
val clear_top : unit -> Tac unit
(** [clear] will drop the given binder from the context, is nothing
depends on it. *)
val clear : binding -> Tac unit
(** If [b] is a binding of type [v == r], [rewrite b] will rewrite the
variable [v] for [r] everywhere in the current goal type and witness. *)
val rewrite : binding -> Tac unit
(** First boolean is whether to attempt to introduce a refinement
before solving. In that case, a goal for the refinement formula will be
added. Second boolean is whether to set the expected type internally.
Just use `exact` from FStar.Tactics.Derived if you don't know what's up
with all this. *)
val t_exact : maybe_refine:bool -> set_expected_typ:bool -> term -> Tac unit
(** Inner primitive for [apply], takes a boolean specifying whether
to not ask for implicits that appear free in posterior goals, a
boolean specifying whether it's forbidden to instantiate uvars in the
goal, and a boolean specifying whether uvars resolved during unification
of the goal to the term should be typechecked as part of t_apply
If the third boolean is false, those uvars will be typechecked at the
end by the tactics engine.
Example: when [uopt] is true, applying transitivity to [|- a = c]
will give two goals, [|- a = ?u] and [|- ?u = c] without asking to
instantiate [?u] since it will most likely be constrained later by
solving these goals. In any case, we track [?u] and will fail if it's
not solved later.
Example: when [noinst] is true, applying a function returning
[1 = 2] will fail on a goal of the shape [1 = ?u] since it must
instantiate [?u]. We use this in typeclass resolution.
You may want [apply] from FStar.Tactics.Derived, or one of
the other user facing variants.
*)
val t_apply : uopt:bool -> noinst:bool -> tc_resolved_uvars:bool -> term -> Tac unit
(** [t_apply_lemma ni nilhs l] will solve a goal of type [squash phi]
when [l] is a Lemma ensuring [phi]. The arguments to [l] and its
requires clause are introduced as new goals. As a small optimization,
[unit] arguments are discharged by the engine. For the meaning of
the [noinst] boolean arg see [t_apply], briefly, it does not allow to
instantiate uvars in the goal. The [noinst_lhs] flag is similar, it
forbids instantiating uvars *but only on the LHS of the goal*, provided
the goal is an equality. It is meant to be useful for rewrite-goals, of
the shape [X = ?u]. Setting [noinst] means [noinst_lhs] is ignored. *)
val t_apply_lemma : noinst:bool -> noinst_lhs:bool -> term -> Tac unit
// TODO: do the unit thing too for [apply].
(** [print str] has no effect on the proofstate, but will have the side effect
of printing [str] on the compiler's standard output. *)
val print : string -> Tac unit
(** [debugging ()] returns true if the current module has the debug flag
on, i.e. when [--debug MyModule --debug_level Tac] was passed in. *)
val debugging : unit -> Tac bool
(** Similar to [print], but will dump a text representation of the proofstate
along with the message. *)
val dump : string -> Tac unit
(** Similar to [dump], but will print *every* unsolved implicit
in the proofstate, not only the visible/focused goals. When the
[print_resolved] boolean is true, it will also print every solved goal.
Warning, these can be a *lot*. *)
val dump_all : print_resolved:bool -> string -> Tac unit
(** Will print a goal for every unresolved implicit in the provided goal. *)
val dump_uvars_of : goal -> string -> Tac unit
(** Solves a goal [Gamma |= squash (l == r)] by attempting to unify
[l] with [r]. This currently only exists because of some universe
problems when trying to [apply] a reflexivity lemma. When [allow_guards]
is [true], it is allowed that (some) guards are raised during the
unification process and added as a single goal to be discharged later.
Currently, the only guards allowed here are for equating refinement
types (e.g. [x:int{x>0}] and [x:int{0<x}]. *)
val t_trefl : allow_guards:bool -> Tac unit
(** Provides a proof for the equality
[(match e with ... | pi -> ei ...) a1 .. an
== (match e with ... | pi -> e1 a1 .. an)].
This is particularly useful to rewrite the expression on the left to the
one on the right when the RHS is actually a unification variable. *)
val t_commute_applied_match : unit -> Tac unit
(** In case there are goals that are already solved which have
non-trivial typing guards, make those guards as explicit proof
obligations in the tactic state, solving any trivial ones by simplification.
See tests/bug-reports/Bug2635.fst for some examples
Update 11/14/2022: with the introduction of the core typechecker,
this primitive should no longer be necessary. Try using the compat pre core
flags, or `with_compat_pre_core` primitive if your code breaks without
this.*)
[@@deprecated "This will soon be removed, please use compat pre core settings if needed"]
val gather_or_solve_explicit_guards_for_resolved_goals : unit -> Tac unit
(** [ctrl_rewrite] will traverse the current goal, and call [ctrl]
* repeatedly on subterms. When [ctrl t] returns [(true, _)], the
* tactic will call [rw] with a goal of type [t = ?u], which once
* solved will rewrite [t] to the solution of [?u]. No goal is
* made if [ctrl t] returns [(false, _)].
*
* The second component of the return value of [ctrl] specifies
* whether for continue descending in the goal or not. It can
* either be:
* - Continue: keep on with further subterms
* - Skip: stop descending in this tree
* - Abort: stop everything
*
* The first argument is the direction, [TopDown] or [BottomUp]. It
* specifies how the AST of the goal is traversed (preorder or postorder).
*
* Note: for [BottomUp] a [Skip] means to stop trying to rewrite everything
* from the current node up to the root, but still consider siblings. This
* means that [ctrl_rewrite BottomUp (fun _ -> (true, Skip)) t] will call [t]
* for every leaf node in the AST.
*
* See [pointwise] and [topdown_rewrite] for more friendly versions.
*)
val ctrl_rewrite :
direction ->
(ctrl : term -> Tac (bool & ctrl_flag)) ->
(rw:unit -> Tac unit) ->
Tac unit
(** Given the current goal [Gamma |- w : t],
[dup] will turn this goal into
[Gamma |- ?u : t] and
[Gamma |= ?u == w]. It can thus be used to change
a goal's witness in any way needed, by choosing
some [?u] (possibly with exact) and then solving the other goal.
*)
val dup : unit -> Tac unit
// Proof namespace management
(** [prune "A.B.C"] will mark all top-level definitions in module
[A.B.C] (and submodules of it) to not be encoded to the SMT, for the current goal.
The string is a namespace prefix. [prune ""] will prune everything, but note
that [prune "FStar.S"] will not prune ["FStar.Set"]. *)
val prune : string -> Tac unit
(** The opposite operation of [prune]. The latest one takes precedence. *)
val addns : string -> Tac unit
(** Destruct a value of an inductive type by matching on it. The generated
match has one branch for each constructor and is therefore trivially
exhaustive, no VC is generated for that purpose. It returns a list
with the fvars of each constructor and their arities, in the order
they appear as goals. *)
val t_destruct : term -> Tac (list (fv * nat))
(** Set command line options for the current goal. Mostly useful to
change SMT encoding options such as [set_options "--z3rlimit 20"]. *)
val set_options : string -> Tac unit
(** Creates a new, unconstrained unification variable in environment
[env]. The type of the uvar can optionally be provided in [o]. If not
provided, a second uvar is created for the type. *)
val uvar_env : env -> option typ -> Tac term
(** Creates a new, unconstrained unification variable in environment
[env]. The type of the uvar must be provided and the uvar can be solved
to a Ghost term of that type *)
val ghost_uvar_env : env -> typ -> Tac term
(** Creates a new, unconstrained universe unification variable.
The returned term is Type (U_Unif ?u). *)
val fresh_universe_uvar : unit -> Tac term
(** Call the unifier on two terms. The returned boolean specifies
whether unification was possible. When the tactic returns true, the
terms have been unified, instantiating uvars as needed. When false,
unification was not possible and no change to uvars occurs. *)
val unify_env : env -> t1:term -> t2:term -> Tac bool
(** Similar to [unify_env], but allows for some guards to be raised
during unification (see [t_trefl] for an explanation). Will add a new
goal with the guard. *)
val unify_guard_env : env -> t1:term -> t2:term -> Tac bool
(** Check if [t1] matches [t2], i.e., whether [t2] can have its uvars
instantiated into unifying with [t1]. When the tactic returns true, the
terms have been unified, instantiating uvars as needed. When false,
matching was not possible and no change to uvars occurs. *)
val match_env : env -> t1:term -> t2:term -> Tac bool
(** Launches an external process [prog] with arguments [args] and input
[input] and returns the output. For security reasons, this can only be
performed when the `--unsafe_tactic_exec` options was provided for the
current F* invocation. The tactic will fail if this is not so. *)
val launch_process : string -> list string -> string -> Tac string
(** Get a fresh bv of some name and type. The name is only useful
for pretty-printing, since there is a fresh inaccessible integer within
the bv too. *)
(* val fresh_bv_named : string -> Tac bv *)
(** Change the goal to another type, given that it is convertible
to the current type. *)
val change : typ -> Tac unit
(** Get the current guard policy. The guard policy specifies what should
be done when a VC arises internally from the tactic engine. Options
are SMT (mark it as an SMT goal), Goal (add it as an extra goal)
and Force (only allow trivial guards, that need no SMT. *)
val get_guard_policy : unit -> Tac guard_policy
(** Set the current guard policy. See [get_guard_policy} for an explanation *)
val set_guard_policy : guard_policy -> Tac unit
(** [lax_on] returns true iff the current environment has the
`--lax` option set, and thus drops all verification conditions. *)
val lax_on : unit -> Tac bool
(** Admit the current goal and set the witness to the given term.
Absolutely unsafe. Raises a warning. *)
val tadmit_t : term -> Tac unit
(** Join the first two goals, which must be irrelevant, in a single
one by finding a maximal prefix of their environment and reverting
appropriately. Useful to minimize SMT queries that share internal
obligations. *)
val join : unit -> Tac unit
(* Local metastate via a string-keyed map. [lget] fails if the
found element is not typeable at the requested type. *)
val lget : #a:Type -> string -> Tac a
val lset : #a:Type -> string -> a -> Tac unit
(** Set the current set of active goals at will. Obligations remain
in the implicits. *)
val set_goals : list goal -> Tac unit
(** Set the current set of SMT goals at will. Obligations remain in the
implicits. TODO: This is a really bad name, there's no special "SMT"
about these goals. *)
val set_smt_goals : list goal -> Tac unit
(** [curms ()] returns the current (wall) time in milliseconds *)
val curms : unit -> Tac int
(** [set_urgency u] sets the urgency of error messages. Usually set just
before raising an exception (see e.g. [fail_silently]). *)
val set_urgency : int -> TacS unit
(** [string_to_term e s] runs the F* parser on the string [s] in the
environment [e], and produces a term. *)
val string_to_term : env -> string -> Tac term
(** [push_bv_dsenv e id] pushes a identifier [id] into the parsing
environment of [e] an environment. It returns a new environment that
has the identifier [id] along with its corresponding binding. *)
val push_bv_dsenv : env -> string -> Tac (env * binding)
(** Print a term via the pretty printer. This is considered effectful
since 1) setting options can change the behavior of this function, and
hence is not really pure; and 2) this function could expose details of
the term representation that do not show up in the view, invalidating
the pack_inspect_inv/inspeck_pack_inv lemmas. *)
val term_to_string : term -> Tac string
(** Print a computation type via the pretty printer. See comment
on [term_to_string]. *)
val comp_to_string : comp -> Tac string
(** Print a source range as a string *)
val range_to_string : range -> Tac string
(** A variant of Reflection.term_eq that may inspect more underlying
details of terms. This function could distinguish two _otherwise equal
terms_, but that distinction cannot leave the Tac effect.
This is only exposed as a migration path. Please use
[Reflection.term_eq] instead. *)
[@@deprecated "Use Reflection.term_eq instead"]
val term_eq_old : term -> term -> Tac bool
(** Runs the input tactic `f` with compat pre core setting `n`.
It is an escape hatch for maintaining backward compatibility
for code that breaks with the core typechecker. *)
val with_compat_pre_core : #a:Type -> n:int -> f:(unit -> Tac a) -> Tac a
(** Get the [vconfig], including fuel, ifuel, rlimit, etc,
associated with the current goal. *)
val get_vconfig : unit -> Tac vconfig
(** Set the [vconfig], including fuel, ifuel, rlimit, etc, associated
with the current goal. This vconfig will be used if the goal is
attempted by SMT at the end of a tactic run. *)
val set_vconfig : vconfig -> Tac unit
(** Attempt to solve the current goal with SMT immediately, and fail
if it cannot be solved. The vconfig specifies fuels, limits, etc. The
current goal's vconfig is ignored in favor of this one. *)
val t_smt_sync : vconfig -> Tac unit
(** This returns the free uvars that appear in a term. This is not
a reflection primitive as it depends on the state of the UF graph. *)
val free_uvars : term -> Tac (list int)
(* Return all k/v pairs in the state. The order is unspecified,
do not rely on it. *)
val all_ext_options : unit -> Tac (list (string & string))
(* Lookup a k/v pair in the --ext option state. The empty string
is returned if the key was unset. *)
val ext_getv (k:string) : Tac string
(* Return all k/v pairs in the state which are within
the given namespace. *)
val ext_getns (ns:string) : Tac (list (string & string))
(***** APIs used in the meta DSL framework *****)
(** Meta DSL framework is an experimental feature
See examples/dsls/ for more details
Following APIs are part of the framework *)
(** TODO: maybe the equiv APIs should require typing of the arguments? *) | false | false | FStar.Tactics.V2.Builtins.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ret_t : a: Type -> Type | [] | FStar.Tactics.V2.Builtins.ret_t | {
"file_name": "ulib/FStar.Tactics.V2.Builtins.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: Type -> Type | {
"end_col": 38,
"end_line": 463,
"start_col": 21,
"start_line": 463
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Hash"
},
{
"abbrev": true,
"full_module": "Spec.Agile.AEAD",
"short_module": "AEAD"
},
{
"abbrev": true,
"full_module": "Spec.Agile.DH",
"short_module": "DH"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HPKE",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vale_p = Vale.X64.CPU_Features_s.(adx_enabled /\ bmi2_enabled) | let vale_p = | false | null | false | let open Vale.X64.CPU_Features_s in adx_enabled /\ bmi2_enabled | {
"checked_file": "Hacl.HPKE.Curve64_CP32_SHA512.fsti.checked",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Spec.Agile.HPKE.fsti.checked",
"Spec.Agile.Hash.fsti.checked",
"Spec.Agile.DH.fst.checked",
"Spec.Agile.AEAD.fsti.checked",
"prims.fst.checked",
"Hacl.Impl.HPKE.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.HPKE.Curve64_CP32_SHA512.fsti"
} | [
"total"
] | [
"Prims.l_and",
"Prims.b2t",
"Vale.X64.CPU_Features_s.adx_enabled",
"Vale.X64.CPU_Features_s.bmi2_enabled"
] | [] | module Hacl.HPKE.Curve64_CP32_SHA512
open Hacl.Impl.HPKE
module S = Spec.Agile.HPKE
module DH = Spec.Agile.DH
module AEAD = Spec.Agile.AEAD
module Hash = Spec.Agile.Hash
noextract unfold
let cs:S.ciphersuite = (DH.DH_Curve25519, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_512) | false | true | Hacl.HPKE.Curve64_CP32_SHA512.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val vale_p : Prims.logical | [] | Hacl.HPKE.Curve64_CP32_SHA512.vale_p | {
"file_name": "code/hpke/Hacl.HPKE.Curve64_CP32_SHA512.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.logical | {
"end_col": 65,
"end_line": 13,
"start_col": 38,
"start_line": 13
} |
|
Prims.Tot | val cs:S.ciphersuite | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Hash"
},
{
"abbrev": true,
"full_module": "Spec.Agile.AEAD",
"short_module": "AEAD"
},
{
"abbrev": true,
"full_module": "Spec.Agile.DH",
"short_module": "DH"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HPKE",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let cs:S.ciphersuite = (DH.DH_Curve25519, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_512) | val cs:S.ciphersuite
let cs:S.ciphersuite = | false | null | false | (DH.DH_Curve25519, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_512) | {
"checked_file": "Hacl.HPKE.Curve64_CP32_SHA512.fsti.checked",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Spec.Agile.HPKE.fsti.checked",
"Spec.Agile.Hash.fsti.checked",
"Spec.Agile.DH.fst.checked",
"Spec.Agile.AEAD.fsti.checked",
"prims.fst.checked",
"Hacl.Impl.HPKE.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.HPKE.Curve64_CP32_SHA512.fsti"
} | [
"total"
] | [
"FStar.Pervasives.Native.Mktuple4",
"Spec.Agile.DH.algorithm",
"Spec.Agile.HPKE.hash_algorithm",
"Spec.Agile.HPKE.aead",
"Spec.Hash.Definitions.hash_alg",
"Spec.Agile.DH.DH_Curve25519",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Agile.HPKE.Seal",
"Spec.Agile.AEAD.CHACHA20_POLY1305",
"Spec.Hash.Definitions.SHA2_512"
] | [] | module Hacl.HPKE.Curve64_CP32_SHA512
open Hacl.Impl.HPKE
module S = Spec.Agile.HPKE
module DH = Spec.Agile.DH
module AEAD = Spec.Agile.AEAD
module Hash = Spec.Agile.Hash | false | true | Hacl.HPKE.Curve64_CP32_SHA512.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val cs:S.ciphersuite | [] | Hacl.HPKE.Curve64_CP32_SHA512.cs | {
"file_name": "code/hpke/Hacl.HPKE.Curve64_CP32_SHA512.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Spec.Agile.HPKE.ciphersuite | {
"end_col": 102,
"end_line": 10,
"start_col": 23,
"start_line": 10
} |
Prims.Tot | val empty_seq_quad32:seq quad32 | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let empty_seq_quad32 : seq quad32 = empty | val empty_seq_quad32:seq quad32
let empty_seq_quad32:seq quad32 = | false | null | false | empty | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.empty",
"Vale.Def.Types_s.quad32"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s
let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty
let inc32lite (cb:quad32) (i:int) : quad32 =
if 0 <= i && i < pow2_32 then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else
Mkfour 42 42 42 42 | false | true | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val empty_seq_quad32:seq quad32 | [] | Vale.AES.GCTR_BE.empty_seq_quad32 | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Seq.Base.seq Vale.Def.Types_s.quad32 | {
"end_col": 41,
"end_line": 26,
"start_col": 36,
"start_line": 26
} |
Prims.Tot | val make_gctr_plain_BE (p: seq nat8) : seq nat8 | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty | val make_gctr_plain_BE (p: seq nat8) : seq nat8
let make_gctr_plain_BE (p: seq nat8) : seq nat8 = | false | null | false | if length p < pow2_32 then p else empty | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.nat8",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Vale.Def.Words_s.pow2_32",
"Prims.bool",
"FStar.Seq.Base.empty"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s | false | true | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val make_gctr_plain_BE (p: seq nat8) : seq nat8 | [] | Vale.AES.GCTR_BE.make_gctr_plain_BE | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> FStar.Seq.Base.seq Vale.Def.Types_s.nat8 | {
"end_col": 41,
"end_line": 16,
"start_col": 2,
"start_line": 16
} |
FStar.Pervasives.Lemma | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gctr_partial_reveal = opaque_revealer (`%gctr_partial) gctr_partial gctr_partial_def | let gctr_partial_reveal = | false | null | true | opaque_revealer (`%gctr_partial) gctr_partial gctr_partial_def | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"lemma"
] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.AES.AES_common_s.algorithm",
"Prims.nat",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat32",
"Vale.Def.Prop_s.prop0",
"Vale.AES.GCTR_BE.gctr_partial",
"Vale.AES.GCTR_BE.gctr_partial_def"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s
let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty
let inc32lite (cb:quad32) (i:int) : quad32 =
if 0 <= i && i < pow2_32 then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else
Mkfour 42 42 42 42
let empty_seq_quad32 : seq quad32 = empty
let partial_seq_agreement (x y:seq quad32) (lo hi:nat) =
lo <= hi /\ hi <= length x /\ hi <= length y /\
(forall i . {:pattern (index x i) \/ (index y i)} lo <= i /\ i < hi ==> index x i == index y i)
let lemma_eq_reverse_bytes_quad32_seq (s1 s2 s3:seq quad32) (bound:nat) (icb:quad32) (alg:algorithm) (key:seq nat32) :
Lemma
(requires (is_aes_key_word alg key /\ bound <= length s1 /\ bound <= length s2 /\ bound <= length s3 /\
(forall j . {:pattern (index s2 j)} 0 <= j /\ j < bound ==>
index s2 j == quad32_xor (index s3 j) (aes_encrypt_word alg key (inc32 icb j))) /\
(forall j . {:pattern (index s1 j)} 0 <= j /\ j < bound ==>
index s1 j == index s2 j)))
(ensures
(forall j . {:pattern (index s1 j)} 0 <= j /\ j < bound ==>
index s1 j == quad32_xor (index s3 j) (aes_encrypt_word alg key (inc32 icb j)))
)
=
()
val gctr_encrypt_block_offset (icb:quad32) (plain:quad32) (alg:algorithm) (key:seq nat32) (i:int) : Lemma
(requires is_aes_key_word alg key)
(ensures
gctr_encrypt_block icb plain alg key i ==
gctr_encrypt_block (inc32 icb i) plain alg key 0
)
let gctr_partial_def (alg:algorithm) (bound:nat) (plain cipher:seq quad32) (key:seq nat32) (icb:quad32) : prop0 =
is_aes_key_word alg key /\
( let bound = min bound (min (length plain) (length cipher)) in
forall j . {:pattern (index cipher j)} 0 <= j /\ j < bound ==>
index cipher j == quad32_xor (index plain j) (aes_encrypt_word alg key (inc32 icb j))) | false | false | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gctr_partial_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.AES.GCTR_BE.gctr_partial == Vale.AES.GCTR_BE.gctr_partial_def) | [] | Vale.AES.GCTR_BE.gctr_partial_reveal | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures Vale.AES.GCTR_BE.gctr_partial == Vale.AES.GCTR_BE.gctr_partial_def) | {
"end_col": 100,
"end_line": 59,
"start_col": 38,
"start_line": 59
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gctr_partial = opaque_make gctr_partial_def | let gctr_partial = | false | null | false | opaque_make gctr_partial_def | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"total"
] | [
"Vale.Def.Opaque_s.opaque_make",
"Vale.AES.AES_common_s.algorithm",
"Prims.nat",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat32",
"Vale.Def.Prop_s.prop0",
"Vale.AES.GCTR_BE.gctr_partial_def"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s
let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty
let inc32lite (cb:quad32) (i:int) : quad32 =
if 0 <= i && i < pow2_32 then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else
Mkfour 42 42 42 42
let empty_seq_quad32 : seq quad32 = empty
let partial_seq_agreement (x y:seq quad32) (lo hi:nat) =
lo <= hi /\ hi <= length x /\ hi <= length y /\
(forall i . {:pattern (index x i) \/ (index y i)} lo <= i /\ i < hi ==> index x i == index y i)
let lemma_eq_reverse_bytes_quad32_seq (s1 s2 s3:seq quad32) (bound:nat) (icb:quad32) (alg:algorithm) (key:seq nat32) :
Lemma
(requires (is_aes_key_word alg key /\ bound <= length s1 /\ bound <= length s2 /\ bound <= length s3 /\
(forall j . {:pattern (index s2 j)} 0 <= j /\ j < bound ==>
index s2 j == quad32_xor (index s3 j) (aes_encrypt_word alg key (inc32 icb j))) /\
(forall j . {:pattern (index s1 j)} 0 <= j /\ j < bound ==>
index s1 j == index s2 j)))
(ensures
(forall j . {:pattern (index s1 j)} 0 <= j /\ j < bound ==>
index s1 j == quad32_xor (index s3 j) (aes_encrypt_word alg key (inc32 icb j)))
)
=
()
val gctr_encrypt_block_offset (icb:quad32) (plain:quad32) (alg:algorithm) (key:seq nat32) (i:int) : Lemma
(requires is_aes_key_word alg key)
(ensures
gctr_encrypt_block icb plain alg key i ==
gctr_encrypt_block (inc32 icb i) plain alg key 0
)
let gctr_partial_def (alg:algorithm) (bound:nat) (plain cipher:seq quad32) (key:seq nat32) (icb:quad32) : prop0 =
is_aes_key_word alg key /\
( let bound = min bound (min (length plain) (length cipher)) in
forall j . {:pattern (index cipher j)} 0 <= j /\ j < bound ==> | false | true | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gctr_partial : _: Vale.AES.AES_common_s.algorithm ->
_: Prims.nat ->
_: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
_: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
_: FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ->
_: Vale.Def.Types_s.quad32
-> Vale.Def.Prop_s.prop0 | [] | Vale.AES.GCTR_BE.gctr_partial | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
_: Vale.AES.AES_common_s.algorithm ->
_: Prims.nat ->
_: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
_: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
_: FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ->
_: Vale.Def.Types_s.quad32
-> Vale.Def.Prop_s.prop0 | {
"end_col": 66,
"end_line": 58,
"start_col": 38,
"start_line": 58
} |
|
Prims.Tot | val inc32lite (cb: quad32) (i: int) : quad32 | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let inc32lite (cb:quad32) (i:int) : quad32 =
if 0 <= i && i < pow2_32 then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else
Mkfour 42 42 42 42 | val inc32lite (cb: quad32) (i: int) : quad32
let inc32lite (cb: quad32) (i: int) : quad32 = | false | null | false | if 0 <= i && i < pow2_32
then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else Mkfour 42 42 42 42 | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32",
"Prims.int",
"Prims.op_AmpAmp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Vale.Def.Words_s.pow2_32",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Words_s.nat32",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Subtraction",
"Prims.bool",
"Prims.op_Addition",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s
let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty | false | true | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val inc32lite (cb: quad32) (i: int) : quad32 | [] | Vale.AES.GCTR_BE.inc32lite | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | cb: Vale.Def.Types_s.quad32 -> i: Prims.int -> Vale.Def.Types_s.quad32 | {
"end_col": 22,
"end_line": 24,
"start_col": 2,
"start_line": 19
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let partial_seq_agreement (x y:seq quad32) (lo hi:nat) =
lo <= hi /\ hi <= length x /\ hi <= length y /\
(forall i . {:pattern (index x i) \/ (index y i)} lo <= i /\ i < hi ==> index x i == index y i) | let partial_seq_agreement (x y: seq quad32) (lo hi: nat) = | false | null | false | lo <= hi /\ hi <= length x /\ hi <= length y /\
(forall i. {:pattern (index x i)\/(index y i)} lo <= i /\ i < hi ==> index x i == index y i) | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.l_Forall",
"Prims.int",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"Prims.l_imp",
"Prims.eq2",
"FStar.Seq.Base.index",
"Prims.logical"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s
let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty
let inc32lite (cb:quad32) (i:int) : quad32 =
if 0 <= i && i < pow2_32 then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else
Mkfour 42 42 42 42
let empty_seq_quad32 : seq quad32 = empty | false | true | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val partial_seq_agreement : x: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
y: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
lo: Prims.nat ->
hi: Prims.nat
-> Prims.logical | [] | Vale.AES.GCTR_BE.partial_seq_agreement | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
x: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
y: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
lo: Prims.nat ->
hi: Prims.nat
-> Prims.logical | {
"end_col": 97,
"end_line": 30,
"start_col": 2,
"start_line": 29
} |
|
Prims.Tot | val gctr_partial_def
(alg: algorithm)
(bound: nat)
(plain cipher: seq quad32)
(key: seq nat32)
(icb: quad32)
: prop0 | [
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Math.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gctr_partial_def (alg:algorithm) (bound:nat) (plain cipher:seq quad32) (key:seq nat32) (icb:quad32) : prop0 =
is_aes_key_word alg key /\
( let bound = min bound (min (length plain) (length cipher)) in
forall j . {:pattern (index cipher j)} 0 <= j /\ j < bound ==>
index cipher j == quad32_xor (index plain j) (aes_encrypt_word alg key (inc32 icb j))) | val gctr_partial_def
(alg: algorithm)
(bound: nat)
(plain cipher: seq quad32)
(key: seq nat32)
(icb: quad32)
: prop0
let gctr_partial_def
(alg: algorithm)
(bound: nat)
(plain cipher: seq quad32)
(key: seq nat32)
(icb: quad32)
: prop0 = | false | null | false | is_aes_key_word alg key /\
(let bound = min bound (min (length plain) (length cipher)) in
forall j. {:pattern (index cipher j)}
0 <= j /\ j < bound ==>
index cipher j == quad32_xor (index plain j) (aes_encrypt_word alg key (inc32 icb j))) | {
"checked_file": "Vale.AES.GCTR_BE.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GCTR_BE.fsti"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"Prims.nat",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.nat32",
"Prims.l_and",
"Vale.AES.AES_BE_s.is_aes_key_word",
"Prims.l_Forall",
"Prims.int",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.eq2",
"FStar.Seq.Base.index",
"Vale.Def.Types_s.quad32_xor",
"Vale.AES.AES_BE_s.aes_encrypt_word",
"Vale.AES.GCTR_BE_s.inc32",
"Prims.min",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.AES.GCTR_BE
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.Arch.Types
open FStar.Mul
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.AES.GCTR_BE_s
open FStar.Math.Lemmas
open Vale.Def.Words.Seq_s
let make_gctr_plain_BE (p:seq nat8) : seq nat8 =
if length p < pow2_32 then p else empty
let inc32lite (cb:quad32) (i:int) : quad32 =
if 0 <= i && i < pow2_32 then
let sum = cb.lo0 + i in
let lo0 = if sum >= pow2_32 then sum - pow2_32 else sum in
Mkfour lo0 cb.lo1 cb.hi2 cb.hi3
else
Mkfour 42 42 42 42
let empty_seq_quad32 : seq quad32 = empty
let partial_seq_agreement (x y:seq quad32) (lo hi:nat) =
lo <= hi /\ hi <= length x /\ hi <= length y /\
(forall i . {:pattern (index x i) \/ (index y i)} lo <= i /\ i < hi ==> index x i == index y i)
let lemma_eq_reverse_bytes_quad32_seq (s1 s2 s3:seq quad32) (bound:nat) (icb:quad32) (alg:algorithm) (key:seq nat32) :
Lemma
(requires (is_aes_key_word alg key /\ bound <= length s1 /\ bound <= length s2 /\ bound <= length s3 /\
(forall j . {:pattern (index s2 j)} 0 <= j /\ j < bound ==>
index s2 j == quad32_xor (index s3 j) (aes_encrypt_word alg key (inc32 icb j))) /\
(forall j . {:pattern (index s1 j)} 0 <= j /\ j < bound ==>
index s1 j == index s2 j)))
(ensures
(forall j . {:pattern (index s1 j)} 0 <= j /\ j < bound ==>
index s1 j == quad32_xor (index s3 j) (aes_encrypt_word alg key (inc32 icb j)))
)
=
()
val gctr_encrypt_block_offset (icb:quad32) (plain:quad32) (alg:algorithm) (key:seq nat32) (i:int) : Lemma
(requires is_aes_key_word alg key)
(ensures
gctr_encrypt_block icb plain alg key i ==
gctr_encrypt_block (inc32 icb i) plain alg key 0
) | false | true | Vale.AES.GCTR_BE.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gctr_partial_def
(alg: algorithm)
(bound: nat)
(plain cipher: seq quad32)
(key: seq nat32)
(icb: quad32)
: prop0 | [] | Vale.AES.GCTR_BE.gctr_partial_def | {
"file_name": "vale/code/crypto/aes/Vale.AES.GCTR_BE.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
bound: Prims.nat ->
plain: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
cipher: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ->
key: FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ->
icb: Vale.Def.Types_s.quad32
-> Vale.Def.Prop_s.prop0 | {
"end_col": 92,
"end_line": 57,
"start_col": 2,
"start_line": 54
} |
Prims.Tot | val t_limbs:Hacl.Bignum.Definitions.limb_t | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U64 | val t_limbs:Hacl.Bignum.Definitions.limb_t
let t_limbs:Hacl.Bignum.Definitions.limb_t = | false | null | false | Lib.IntTypes.U64 | {
"checked_file": "Hacl.GenericField64.fsti.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.GenericField64.fsti"
} | [
"total"
] | [
"Lib.IntTypes.U64"
] | [] | module Hacl.GenericField64
open FStar.Mul
module BN = Hacl.Bignum
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | false | true | Hacl.GenericField64.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t_limbs:Hacl.Bignum.Definitions.limb_t | [] | Hacl.GenericField64.t_limbs | {
"file_name": "code/bignum/Hacl.GenericField64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Definitions.limb_t | {
"end_col": 62,
"end_line": 11,
"start_col": 46,
"start_line": 11
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pbn_mont_ctx_u64 = MA.pbn_mont_ctx_u64 | let pbn_mont_ctx_u64 = | false | null | false | MA.pbn_mont_ctx_u64 | {
"checked_file": "Hacl.GenericField64.fsti.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.GenericField64.fsti"
} | [
"total"
] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx_u64"
] | [] | module Hacl.GenericField64
open FStar.Mul
module BN = Hacl.Bignum
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U64 | false | true | Hacl.GenericField64.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pbn_mont_ctx_u64 : Type0 | [] | Hacl.GenericField64.pbn_mont_ctx_u64 | {
"file_name": "code/bignum/Hacl.GenericField64.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 42,
"end_line": 13,
"start_col": 23,
"start_line": 13
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let a_spec (a:fixed_len_alg) (i:nat) = Lib.Sequence.lseq uint8 (hash_length a) | let a_spec (a: fixed_len_alg) (i: nat) = | false | null | false | Lib.Sequence.lseq uint8 (hash_length a) | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.fixed_len_alg",
"Prims.nat",
"Lib.Sequence.lseq",
"Lib.IntTypes.uint8",
"Spec.Hash.Definitions.hash_length"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v
let instantiate #a entropy_input nonce personalization_string =
let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1
let reseed #a st entropy_input additional_input =
let seed_material = entropy_input @| additional_input in
let k, v = update #a seed_material st.k st.v in
State k v 1 | false | true | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val a_spec : a: Spec.Hash.Definitions.fixed_len_alg -> i: Prims.nat -> Type0 | [] | Spec.HMAC_DRBG.a_spec | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.fixed_len_alg -> i: Prims.nat -> Type0 | {
"end_col": 78,
"end_line": 66,
"start_col": 39,
"start_line": 66
} |
|
FStar.Pervasives.Lemma | val hmac_input_bound: a:supported_alg -> Lemma
((hash_length a + pow2 32 + pow2 32
+ 1 + block_length a + block_length a) `less_than_max_input_length` a) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a) | val hmac_input_bound: a:supported_alg -> Lemma
((hash_length a + pow2 32 + pow2 32
+ 1 + block_length a + block_length a) `less_than_max_input_length` a)
let hmac_input_bound = | false | null | true | function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a)
`less_than_max_input_length`
a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a)
`less_than_max_input_length`
a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a)
`less_than_max_input_length`
a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a)
`less_than_max_input_length`
a) | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [
"lemma"
] | [
"Spec.HMAC_DRBG.supported_alg",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Spec.Hash.Definitions.less_than_max_input_length",
"Prims.op_Addition",
"Spec.Hash.Definitions.hash_length",
"Prims.pow2",
"Spec.Hash.Definitions.block_length",
"Spec.Hash.Definitions.hash_alg",
"Spec.Hash.Definitions.SHA1",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Hash.Definitions.SHA2_384",
"Spec.Hash.Definitions.SHA2_512",
"Prims.unit"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hmac_input_bound: a:supported_alg -> Lemma
((hash_length a + pow2 32 + pow2 32
+ 1 + block_length a + block_length a) `less_than_max_input_length` a) | [] | Spec.HMAC_DRBG.hmac_input_bound | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.HMAC_DRBG.supported_alg
-> FStar.Pervasives.Lemma
(ensures
Spec.Hash.Definitions.less_than_max_input_length (Spec.Hash.Definitions.hash_length a +
Prims.pow2 32 +
Prims.pow2 32 +
1 +
Spec.Hash.Definitions.block_length a +
Spec.Hash.Definitions.block_length a)
a) | {
"end_col": 122,
"end_line": 32,
"start_col": 23,
"start_line": 20
} |
Prims.Pure | val reseed: #a:supported_alg
-> state a
-> entropy_input:bytes
-> additional_input:bytes
-> Pure (state a)
(requires
(hash_length a +
Seq.length entropy_input +
Seq.length additional_input +
1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reseed #a st entropy_input additional_input =
let seed_material = entropy_input @| additional_input in
let k, v = update #a seed_material st.k st.v in
State k v 1 | val reseed: #a:supported_alg
-> state a
-> entropy_input:bytes
-> additional_input:bytes
-> Pure (state a)
(requires
(hash_length a +
Seq.length entropy_input +
Seq.length additional_input +
1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let reseed #a st entropy_input additional_input = | false | null | false | let seed_material = entropy_input @| additional_input in
let k, v = update #a seed_material st.k st.v in
State k v 1 | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [] | [
"Spec.HMAC_DRBG.supported_alg",
"Spec.HMAC_DRBG.state",
"Spec.Hash.Definitions.bytes",
"Spec.Agile.HMAC.lbytes",
"Spec.Hash.Definitions.hash_length",
"Spec.HMAC_DRBG.State",
"FStar.Pervasives.Native.tuple2",
"Spec.HMAC_DRBG.update",
"Spec.HMAC_DRBG.__proj__State__item__k",
"Spec.HMAC_DRBG.__proj__State__item__v",
"FStar.Seq.Base.seq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.op_At_Bar",
"Lib.IntTypes.uint8"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v
let instantiate #a entropy_input nonce personalization_string =
let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1 | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val reseed: #a:supported_alg
-> state a
-> entropy_input:bytes
-> additional_input:bytes
-> Pure (state a)
(requires
(hash_length a +
Seq.length entropy_input +
Seq.length additional_input +
1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [] | Spec.HMAC_DRBG.reseed | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
st: Spec.HMAC_DRBG.state a ->
entropy_input: Spec.Hash.Definitions.bytes ->
additional_input: Spec.Hash.Definitions.bytes
-> Prims.Pure (Spec.HMAC_DRBG.state a) | {
"end_col": 13,
"end_line": 64,
"start_col": 49,
"start_line": 61
} |
Prims.Pure | val instantiate: #a:supported_alg
-> entropy_input:bytes
-> nonce:bytes
-> personalization_string:bytes
-> Pure (state a)
(requires
(hash_length a
+ Seq.length entropy_input
+ Seq.length nonce
+ Seq.length personalization_string
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let instantiate #a entropy_input nonce personalization_string =
let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1 | val instantiate: #a:supported_alg
-> entropy_input:bytes
-> nonce:bytes
-> personalization_string:bytes
-> Pure (state a)
(requires
(hash_length a
+ Seq.length entropy_input
+ Seq.length nonce
+ Seq.length personalization_string
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let instantiate #a entropy_input nonce personalization_string = | false | null | false | let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1 | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [] | [
"Spec.HMAC_DRBG.supported_alg",
"Spec.Hash.Definitions.bytes",
"Spec.Agile.HMAC.lbytes",
"Spec.Hash.Definitions.hash_length",
"Spec.HMAC_DRBG.State",
"Spec.HMAC_DRBG.state",
"FStar.Pervasives.Native.tuple2",
"Spec.HMAC_DRBG.update",
"FStar.Seq.Base.seq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.create",
"Lib.IntTypes.uint8",
"Lib.IntTypes.u8",
"FStar.Seq.Base.op_At_Bar"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val instantiate: #a:supported_alg
-> entropy_input:bytes
-> nonce:bytes
-> personalization_string:bytes
-> Pure (state a)
(requires
(hash_length a
+ Seq.length entropy_input
+ Seq.length nonce
+ Seq.length personalization_string
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [] | Spec.HMAC_DRBG.instantiate | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
entropy_input: Spec.Hash.Definitions.bytes ->
nonce: Spec.Hash.Definitions.bytes ->
personalization_string: Spec.Hash.Definitions.bytes
-> Prims.Pure (Spec.HMAC_DRBG.state a) | {
"end_col": 13,
"end_line": 59,
"start_col": 63,
"start_line": 54
} |
Prims.Pure | val generate_loop:
a:supported_alg
-> k:lbytes (hash_length a)
-> max:nat
-> i:nat{i < max}
-> a_spec a i
-> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))
(requires True)
(ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let generate_loop a k max i vi =
hmac_input_bound a;
let v = hmac a k vi in v, v | val generate_loop:
a:supported_alg
-> k:lbytes (hash_length a)
-> max:nat
-> i:nat{i < max}
-> a_spec a i
-> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))
(requires True)
(ensures fun _ -> True)
let generate_loop a k max i vi = | false | null | false | hmac_input_bound a;
let v = hmac a k vi in
v, v | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [] | [
"Spec.HMAC_DRBG.supported_alg",
"Spec.Agile.HMAC.lbytes",
"Spec.Hash.Definitions.hash_length",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.HMAC_DRBG.a_spec",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_Addition",
"Lib.Sequence.lseq",
"Lib.IntTypes.uint8",
"Spec.Agile.HMAC.hmac",
"Prims.unit",
"Spec.HMAC_DRBG.hmac_input_bound",
"FStar.Pervasives.Native.tuple2"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v
let instantiate #a entropy_input nonce personalization_string =
let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1
let reseed #a st entropy_input additional_input =
let seed_material = entropy_input @| additional_input in
let k, v = update #a seed_material st.k st.v in
State k v 1
let a_spec (a:fixed_len_alg) (i:nat) = Lib.Sequence.lseq uint8 (hash_length a)
val generate_loop:
a:supported_alg
-> k:lbytes (hash_length a)
-> max:nat
-> i:nat{i < max}
-> a_spec a i
-> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))
(requires True)
(ensures fun _ -> True) | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val generate_loop:
a:supported_alg
-> k:lbytes (hash_length a)
-> max:nat
-> i:nat{i < max}
-> a_spec a i
-> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))
(requires True)
(ensures fun _ -> True) | [] | Spec.HMAC_DRBG.generate_loop | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.HMAC_DRBG.supported_alg ->
k: Spec.Agile.HMAC.lbytes (Spec.Hash.Definitions.hash_length a) ->
max: Prims.nat ->
i: Prims.nat{i < max} ->
vi: Spec.HMAC_DRBG.a_spec a i
-> Prims.Pure
(Spec.HMAC_DRBG.a_spec a (i + 1) *
Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a)) | {
"end_col": 29,
"end_line": 79,
"start_col": 2,
"start_line": 78
} |
Prims.Pure | val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v | val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v = | false | null | false | let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0
then k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [] | [
"Spec.HMAC_DRBG.supported_alg",
"Spec.Hash.Definitions.bytes",
"Spec.Agile.HMAC.lbytes",
"Spec.Hash.Definitions.hash_length",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8",
"FStar.Pervasives.Native.Mktuple2",
"Prims.bool",
"Spec.Agile.HMAC.hmac",
"FStar.Seq.Base.op_At_Bar",
"FStar.Seq.Base.seq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Properties.cons",
"Lib.IntTypes.u8",
"FStar.Pervasives.Native.tuple2"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [] | Spec.HMAC_DRBG.update | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
data: Spec.Hash.Definitions.bytes ->
k: Spec.Agile.HMAC.lbytes (Spec.Hash.Definitions.hash_length a) ->
v: Spec.Agile.HMAC.lbytes (Spec.Hash.Definitions.hash_length a)
-> Prims.Pure
(Spec.Agile.HMAC.lbytes (Spec.Hash.Definitions.hash_length a) *
Spec.Agile.HMAC.lbytes (Spec.Hash.Definitions.hash_length a)) | {
"end_col": 8,
"end_line": 52,
"start_col": 24,
"start_line": 42
} |
Prims.Pure | val generate': #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let generate' #a st n additional_input =
hmac_input_bound a;
if st.reseed_counter > reseed_interval then
None
else
let k, v =
if Seq.length additional_input > 0 then
update additional_input st.k st.v
else st.k, st.v
in
// let max = ceil (n / hash_length a) in
let max = (n + hash_length a - 1) / hash_length a in
let v, output =
Lib.Sequence.generate_blocks (hash_length a) max max (a_spec a)
(generate_loop a k max)
v
in
let k, v = update additional_input k v in
Some (Seq.slice output 0 n, State k v (st.reseed_counter + 1)) | val generate': #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let generate' #a st n additional_input = | false | null | false | hmac_input_bound a;
if st.reseed_counter > reseed_interval
then None
else
let k, v =
if Seq.length additional_input > 0 then update additional_input st.k st.v else st.k, st.v
in
let max = (n + hash_length a - 1) / hash_length a in
let v, output =
Lib.Sequence.generate_blocks (hash_length a) max max (a_spec a) (generate_loop a k max) v
in
let k, v = update additional_input k v in
Some (Seq.slice output 0 n, State k v (st.reseed_counter + 1)) | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [] | [
"Spec.HMAC_DRBG.supported_alg",
"Spec.HMAC_DRBG.state",
"Prims.nat",
"Spec.Hash.Definitions.bytes",
"Prims.op_GreaterThan",
"Spec.HMAC_DRBG.__proj__State__item__reseed_counter",
"Spec.HMAC_DRBG.reseed_interval",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"Spec.Agile.HMAC.lbytes",
"Prims.bool",
"Spec.Hash.Definitions.hash_length",
"Spec.HMAC_DRBG.a_spec",
"Lib.Sequence.seq",
"Lib.IntTypes.uint8",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Seq.Base.slice",
"Spec.HMAC_DRBG.State",
"Prims.op_Addition",
"FStar.Pervasives.Native.option",
"Spec.HMAC_DRBG.update",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Lib.Sequence.generate_blocks",
"Spec.HMAC_DRBG.generate_loop",
"Prims.op_Division",
"Prims.op_Subtraction",
"FStar.Seq.Base.length",
"Spec.HMAC_DRBG.__proj__State__item__k",
"Spec.HMAC_DRBG.__proj__State__item__v",
"Prims.unit",
"Spec.HMAC_DRBG.hmac_input_bound"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v
let instantiate #a entropy_input nonce personalization_string =
let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1
let reseed #a st entropy_input additional_input =
let seed_material = entropy_input @| additional_input in
let k, v = update #a seed_material st.k st.v in
State k v 1
let a_spec (a:fixed_len_alg) (i:nat) = Lib.Sequence.lseq uint8 (hash_length a)
val generate_loop:
a:supported_alg
-> k:lbytes (hash_length a)
-> max:nat
-> i:nat{i < max}
-> a_spec a i
-> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))
(requires True)
(ensures fun _ -> True)
let generate_loop a k max i vi =
hmac_input_bound a;
let v = hmac a k vi in v, v
let generate #a st n additional_input =
if st.reseed_counter > reseed_interval then
None
else
let k, v =
if Seq.length additional_input > 0 then
update additional_input st.k st.v
else st.k, st.v
in
let max = n / hash_length a in
let v, output =
Lib.Sequence.generate_blocks (hash_length a) max max (a_spec a)
(generate_loop a k max)
v
in
let v, output =
if max * hash_length a < n then
let v = hmac a k v in
v, output @| Lib.Sequence.sub #_ #(hash_length a) v 0 (n - max * hash_length a)
else
v, output
in
let k, v = update additional_input k v in
Some (output, State k v (st.reseed_counter + 1))
(** Equivalently, but proving it requires proving extensionality of generate_blocks *)
val generate': #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val generate': #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [] | Spec.HMAC_DRBG.generate' | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | st: Spec.HMAC_DRBG.state a -> n: Prims.nat -> additional_input: Spec.Hash.Definitions.bytes
-> Prims.Pure (FStar.Pervasives.Native.option (Spec.Agile.HMAC.lbytes n * Spec.HMAC_DRBG.state a)) | {
"end_col": 66,
"end_line": 135,
"start_col": 2,
"start_line": 118
} |
Prims.Pure | val generate: #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.HMAC",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let generate #a st n additional_input =
if st.reseed_counter > reseed_interval then
None
else
let k, v =
if Seq.length additional_input > 0 then
update additional_input st.k st.v
else st.k, st.v
in
let max = n / hash_length a in
let v, output =
Lib.Sequence.generate_blocks (hash_length a) max max (a_spec a)
(generate_loop a k max)
v
in
let v, output =
if max * hash_length a < n then
let v = hmac a k v in
v, output @| Lib.Sequence.sub #_ #(hash_length a) v 0 (n - max * hash_length a)
else
v, output
in
let k, v = update additional_input k v in
Some (output, State k v (st.reseed_counter + 1)) | val generate: #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let generate #a st n additional_input = | false | null | false | if st.reseed_counter > reseed_interval
then None
else
let k, v =
if Seq.length additional_input > 0 then update additional_input st.k st.v else st.k, st.v
in
let max = n / hash_length a in
let v, output =
Lib.Sequence.generate_blocks (hash_length a) max max (a_spec a) (generate_loop a k max) v
in
let v, output =
if max * hash_length a < n
then
let v = hmac a k v in
v, output @| Lib.Sequence.sub #_ #(hash_length a) v 0 (n - max * hash_length a)
else v, output
in
let k, v = update additional_input k v in
Some (output, State k v (st.reseed_counter + 1)) | {
"checked_file": "Spec.HMAC_DRBG.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Spec.HMAC_DRBG.fst"
} | [] | [
"Spec.HMAC_DRBG.supported_alg",
"Spec.HMAC_DRBG.state",
"Prims.nat",
"Spec.Hash.Definitions.bytes",
"Prims.op_GreaterThan",
"Spec.HMAC_DRBG.__proj__State__item__reseed_counter",
"Spec.HMAC_DRBG.reseed_interval",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"Spec.Agile.HMAC.lbytes",
"Prims.bool",
"Spec.Hash.Definitions.hash_length",
"Spec.HMAC_DRBG.a_spec",
"Lib.Sequence.seq",
"Lib.IntTypes.uint8",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"Spec.HMAC_DRBG.State",
"Prims.op_Addition",
"FStar.Pervasives.Native.option",
"Spec.HMAC_DRBG.update",
"Prims.op_LessThan",
"FStar.Seq.Base.op_At_Bar",
"Lib.Sequence.sub",
"Prims.op_Subtraction",
"Spec.Agile.HMAC.hmac",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.op_Multiply",
"Lib.Sequence.generate_blocks",
"Spec.HMAC_DRBG.generate_loop",
"Prims.op_Division",
"FStar.Seq.Base.length",
"Spec.HMAC_DRBG.__proj__State__item__k",
"Spec.HMAC_DRBG.__proj__State__item__v"
] | [] | module Spec.HMAC_DRBG
open Lib.IntTypes
open FStar.Seq
open FStar.Mul
open Spec.Hash.Definitions
open Spec.Agile.HMAC
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
noeq
type state (a:supported_alg) =
| State:
k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> reseed_counter:nat
-> state a
let hmac_input_bound = function
| SHA1 ->
let a = SHA1 in
assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_256 ->
let a = SHA2_256 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_384 ->
let a = SHA2_384 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
| SHA2_512 ->
let a = SHA2_512 in
assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)
val update: #a:supported_alg
-> data:bytes
-> k:lbytes (hash_length a)
-> v:lbytes (hash_length a)
-> Pure (lbytes (hash_length a) & lbytes (hash_length a))
(requires (hash_length a + Seq.length data + 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True)
let update #a data k v =
let zero_data = Seq.cons (u8 0) data in
let k = hmac a k (v @| zero_data) in
let v = hmac a k v in
if Seq.length data = 0 then
k, v
else
let one_data = Seq.cons (u8 1) data in
let k = hmac a k (v @| one_data) in
let v = hmac a k v in
k, v
let instantiate #a entropy_input nonce personalization_string =
let seed_material = entropy_input @| nonce @| personalization_string in
let k = Seq.create (hash_length a) (u8 0) in
let v = Seq.create (hash_length a) (u8 1) in
let k, v = update #a seed_material k v in
State k v 1
let reseed #a st entropy_input additional_input =
let seed_material = entropy_input @| additional_input in
let k, v = update #a seed_material st.k st.v in
State k v 1
let a_spec (a:fixed_len_alg) (i:nat) = Lib.Sequence.lseq uint8 (hash_length a)
val generate_loop:
a:supported_alg
-> k:lbytes (hash_length a)
-> max:nat
-> i:nat{i < max}
-> a_spec a i
-> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))
(requires True)
(ensures fun _ -> True)
let generate_loop a k max i vi =
hmac_input_bound a;
let v = hmac a k vi in v, v | false | false | Spec.HMAC_DRBG.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val generate: #a:supported_alg
-> state a
-> n:nat
-> additional_input:bytes
-> Pure (option (lbytes n & state a))
(requires
n <= max_output_length /\
(hash_length a + Seq.length additional_input
+ 1 + block_length a) `less_than_max_input_length` a)
(ensures fun _ -> True) | [] | Spec.HMAC_DRBG.generate | {
"file_name": "specs/drbg/Spec.HMAC_DRBG.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | st: Spec.HMAC_DRBG.state a -> n: Prims.nat -> additional_input: Spec.Hash.Definitions.bytes
-> Prims.Pure (FStar.Pervasives.Native.option (Spec.Agile.HMAC.lbytes n * Spec.HMAC_DRBG.state a)) | {
"end_col": 52,
"end_line": 104,
"start_col": 2,
"start_line": 82
} |
FStar.HyperStack.ST.Stack | val secret_to_public:
public_key:lbuffer uint8 32ul
-> private_key:lbuffer uint8 32ul ->
Stack unit
(requires fun h ->
live h public_key /\ live h private_key /\ disjoint public_key private_key)
(ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\
as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key)) | [
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let secret_to_public public_key private_key =
Hacl.Ed25519.secret_to_public public_key private_key | val secret_to_public:
public_key:lbuffer uint8 32ul
-> private_key:lbuffer uint8 32ul ->
Stack unit
(requires fun h ->
live h public_key /\ live h private_key /\ disjoint public_key private_key)
(ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\
as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key))
let secret_to_public public_key private_key = | true | null | false | Hacl.Ed25519.secret_to_public public_key private_key | {
"checked_file": "EverCrypt.Ed25519.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Ed25519.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Ed25519.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Hacl.Ed25519.secret_to_public",
"Prims.unit"
] | [] | module EverCrypt.Ed25519
/// For now, only one implementation... to be improved in the future. | false | false | EverCrypt.Ed25519.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val secret_to_public:
public_key:lbuffer uint8 32ul
-> private_key:lbuffer uint8 32ul ->
Stack unit
(requires fun h ->
live h public_key /\ live h private_key /\ disjoint public_key private_key)
(ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\
as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key)) | [] | EverCrypt.Ed25519.secret_to_public | {
"file_name": "providers/evercrypt/fst/EverCrypt.Ed25519.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
public_key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
private_key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 54,
"end_line": 6,
"start_col": 2,
"start_line": 6
} |
FStar.HyperStack.ST.Stack | val sign:
signature:lbuffer uint8 64ul
-> private_key:lbuffer uint8 32ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h private_key /\
disjoint signature msg /\ disjoint signature private_key)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign (as_seq h0 private_key) (as_seq h0 msg)) | [
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sign signature private_key msg_len msg =
Hacl.Ed25519.sign signature private_key msg_len msg | val sign:
signature:lbuffer uint8 64ul
-> private_key:lbuffer uint8 32ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h private_key /\
disjoint signature msg /\ disjoint signature private_key)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign (as_seq h0 private_key) (as_seq h0 msg))
let sign signature private_key msg_len msg = | true | null | false | Hacl.Ed25519.sign signature private_key msg_len msg | {
"checked_file": "EverCrypt.Ed25519.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Ed25519.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Ed25519.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Hacl.Ed25519.sign",
"Prims.unit"
] | [] | module EverCrypt.Ed25519
/// For now, only one implementation... to be improved in the future.
let secret_to_public public_key private_key =
Hacl.Ed25519.secret_to_public public_key private_key
let expand_keys expanded_keys private_key =
Hacl.Ed25519.expand_keys expanded_keys private_key
let sign_expanded signature expanded_keys msg_len msg =
Hacl.Ed25519.sign_expanded signature expanded_keys msg_len msg | false | false | EverCrypt.Ed25519.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sign:
signature:lbuffer uint8 64ul
-> private_key:lbuffer uint8 32ul
-> msg_len:size_t
-> msg:lbuffer uint8 msg_len ->
Stack unit
(requires fun h ->
live h signature /\ live h msg /\ live h private_key /\
disjoint signature msg /\ disjoint signature private_key)
(ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\
as_seq h1 signature == Spec.Ed25519.sign (as_seq h0 private_key) (as_seq h0 msg)) | [] | EverCrypt.Ed25519.sign | {
"file_name": "providers/evercrypt/fst/EverCrypt.Ed25519.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
signature: Lib.Buffer.lbuffer Lib.IntTypes.uint8 64ul ->
private_key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
msg_len: Lib.IntTypes.size_t ->
msg: Lib.Buffer.lbuffer Lib.IntTypes.uint8 msg_len
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 53,
"end_line": 15,
"start_col": 2,
"start_line": 15
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.