Datasets:
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 aes128_key_expansion : normal lowstar_key128_t | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"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.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"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": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"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 aes128_key_expansion //: normal lowstar_key128_t
= as_normal_t #lowstar_key128_t lowstar_key128 | val aes128_key_expansion : normal lowstar_key128_t
let aes128_key_expansion = | false | null | false | as_normal_t #lowstar_key128_t lowstar_key128 | {
"checked_file": "Vale.Stdcalls.X64.Aes.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.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Stdcalls.X64.Aes.fst"
} | [
"total"
] | [
"Vale.Stdcalls.X64.Aes.as_normal_t",
"Vale.Stdcalls.X64.Aes.lowstar_key128_t",
"Vale.Stdcalls.X64.Aes.lowstar_key128"
] | [] | module Vale.Stdcalls.X64.Aes
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
let lowstar_key128 : lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.wrap_weak_stdcall
code_key128
dom
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win)) | false | true | Vale.Stdcalls.X64.Aes.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 aes128_key_expansion : normal lowstar_key128_t | [] | Vale.Stdcalls.X64.Aes.aes128_key_expansion | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.normal Vale.Stdcalls.X64.Aes.lowstar_key128_t | {
"end_col": 48,
"end_line": 31,
"start_col": 4,
"start_line": 31
} |
Prims.Tot | val aes256_key_expansion : normal lowstar_key256_t | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"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.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"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": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"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 aes256_key_expansion //: normal lowstar_key256_t
= as_normal_t #lowstar_key256_t lowstar_key256 | val aes256_key_expansion : normal lowstar_key256_t
let aes256_key_expansion = | false | null | false | as_normal_t #lowstar_key256_t lowstar_key256 | {
"checked_file": "Vale.Stdcalls.X64.Aes.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.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Stdcalls.X64.Aes.fst"
} | [
"total"
] | [
"Vale.Stdcalls.X64.Aes.as_normal_t",
"Vale.Stdcalls.X64.Aes.lowstar_key256_t",
"Vale.Stdcalls.X64.Aes.lowstar_key256"
] | [] | module Vale.Stdcalls.X64.Aes
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
let lowstar_key128 : lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.wrap_weak_stdcall
code_key128
dom
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
let aes128_key_expansion //: normal lowstar_key128_t
= as_normal_t #lowstar_key128_t lowstar_key128
let lowstar_key256 : lowstar_key256_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.wrap_weak_stdcall
code_key256
dom
(W.mk_prediction code_key256 dom [] (key256_lemma code_key256 IA.win)) | false | true | Vale.Stdcalls.X64.Aes.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 aes256_key_expansion : normal lowstar_key256_t | [] | Vale.Stdcalls.X64.Aes.aes256_key_expansion | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Interop.Base.normal Vale.Stdcalls.X64.Aes.lowstar_key256_t | {
"end_col": 48,
"end_line": 41,
"start_col": 4,
"start_line": 41
} |
Prims.Tot | val lowstar_key128:lowstar_key128_t | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"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.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"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": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"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.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"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": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"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_key128 : lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.wrap_weak_stdcall
code_key128
dom
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win)) | val lowstar_key128:lowstar_key128_t
let lowstar_key128:lowstar_key128_t = | false | null | false | assert_norm (List.length dom + List.length ([] <: list arg) <= 4);
IX64.wrap_weak_stdcall code_key128
dom
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win)) | {
"checked_file": "Vale.Stdcalls.X64.Aes.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.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Stdcalls.X64.Aes.fst"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.Stdcalls.X64.Aes.code_key128",
"Vale.Stdcalls.X64.Aes.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.Stdcalls.X64.Aes.key128_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.Aes.key128_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.Aes.key128_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list"
] | [] | module Vale.Stdcalls.X64.Aes
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s | false | true | Vale.Stdcalls.X64.Aes.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 lowstar_key128:lowstar_key128_t | [] | Vale.Stdcalls.X64.Aes.lowstar_key128 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Stdcalls.X64.Aes.lowstar_key128_t | {
"end_col": 74,
"end_line": 28,
"start_col": 2,
"start_line": 24
} |
Prims.Tot | val lowstar_key256:lowstar_key256_t | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"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.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"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": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"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.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"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": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"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_key256 : lowstar_key256_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.wrap_weak_stdcall
code_key256
dom
(W.mk_prediction code_key256 dom [] (key256_lemma code_key256 IA.win)) | val lowstar_key256:lowstar_key256_t
let lowstar_key256:lowstar_key256_t = | false | null | false | assert_norm (List.length dom + List.length ([] <: list arg) <= 4);
IX64.wrap_weak_stdcall code_key256
dom
(W.mk_prediction code_key256 dom [] (key256_lemma code_key256 IA.win)) | {
"checked_file": "Vale.Stdcalls.X64.Aes.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.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Stdcalls.X64.Aes.fst"
} | [
"total"
] | [
"Vale.Interop.X64.wrap_weak_stdcall",
"Vale.Stdcalls.X64.Aes.code_key256",
"Vale.Stdcalls.X64.Aes.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.Stdcalls.X64.Aes.key256_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.Aes.key256_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.Aes.key256_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list"
] | [] | module Vale.Stdcalls.X64.Aes
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
let lowstar_key128 : lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.wrap_weak_stdcall
code_key128
dom
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
let aes128_key_expansion //: normal lowstar_key128_t
= as_normal_t #lowstar_key128_t lowstar_key128 | false | true | Vale.Stdcalls.X64.Aes.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 lowstar_key256:lowstar_key256_t | [] | Vale.Stdcalls.X64.Aes.lowstar_key256 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Stdcalls.X64.Aes.lowstar_key256_t | {
"end_col": 74,
"end_line": 38,
"start_col": 2,
"start_line": 34
} |
FStar.Tactics.Effect.Tac | val check_prop_validity (g: env) (p: term) (typing: tot_typing g p tm_prop)
: T.Tac (prop_validity g p) | [
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"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 check_prop_validity (g:env) (p:term) (typing:tot_typing g p tm_prop): T.Tac (prop_validity g p) =
Pulse.Checker.Pure.check_prop_validity g p typing | val check_prop_validity (g: env) (p: term) (typing: tot_typing g p tm_prop)
: T.Tac (prop_validity g p)
let check_prop_validity (g: env) (p: term) (typing: tot_typing g p tm_prop)
: T.Tac (prop_validity g p) = | true | null | false | Pulse.Checker.Pure.check_prop_validity g p typing | {
"checked_file": "Pulse.Checker.IntroPure.fst.checked",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.IntroPure.fst"
} | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"Pulse.Typing.tm_prop",
"Pulse.Checker.Pure.check_prop_validity",
"Pulse.Typing.prop_validity"
] | [] | module Pulse.Checker.IntroPure
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Base
open Pulse.Checker.Prover
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer
let check_prop (g:env) (p:term)
: T.Tac (p:term & tot_typing g p tm_prop) =
let p0 = p in
let (| p, p_typing |) = Pulse.Checker.Pure.check_vprop g (tm_pure p) in
match p.t with
| Tm_Pure pp ->
let prop_typing = Pulse.Typing.Metatheory.pure_typing_inversion #_ #pp p_typing in
(| pp, prop_typing |)
| _ ->
fail g None
(Printf.sprintf "Impossible: check_intro_pure: checking a pure vprop %s returned a non-pure vprop %s,\
please file a bug-report"
(P.term_to_string (tm_pure p0))
(P.term_to_string p)) | false | false | Pulse.Checker.IntroPure.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 check_prop_validity (g: env) (p: term) (typing: tot_typing g p tm_prop)
: T.Tac (prop_validity g p) | [] | Pulse.Checker.IntroPure.check_prop_validity | {
"file_name": "lib/steel/pulse/Pulse.Checker.IntroPure.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
p: Pulse.Syntax.Base.term ->
typing: Pulse.Typing.tot_typing g p Pulse.Typing.tm_prop
-> FStar.Tactics.Effect.Tac (Pulse.Typing.prop_validity g p) | {
"end_col": 53,
"end_line": 28,
"start_col": 4,
"start_line": 28
} |
FStar.Tactics.Effect.Tac | val check
(g:env)
(pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(post_hint:post_hint_opt g)
(res_ppname:ppname)
(t:st_term { Tm_IntroPure? t.term })
: T.Tac (checker_result_t g pre post_hint) | [
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"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 check
(g:env)
(pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(post_hint:post_hint_opt g)
(res_ppname:ppname)
(t:st_term { Tm_IntroPure? t.term })
: T.Tac (checker_result_t g pre post_hint) =
let g = Pulse.Typing.Env.push_context g "check_intro_pure" t.range in
let Tm_IntroPure { p } = t.term in
let (| p, p_typing |) = check_prop g p in
let pv = check_prop_validity g p p_typing in
let st_typing = T_IntroPure _ _ p_typing pv in
prove_post_hint (try_frame_pre pre_typing (match_comp_res_with_post_hint st_typing post_hint) res_ppname) post_hint t.range | val check
(g:env)
(pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(post_hint:post_hint_opt g)
(res_ppname:ppname)
(t:st_term { Tm_IntroPure? t.term })
: T.Tac (checker_result_t g pre post_hint)
let check
(g: env)
(pre: term)
(pre_typing: tot_typing g pre tm_vprop)
(post_hint: post_hint_opt g)
(res_ppname: ppname)
(t: st_term{Tm_IntroPure? t.term})
: T.Tac (checker_result_t g pre post_hint) = | true | null | false | let g = Pulse.Typing.Env.push_context g "check_intro_pure" t.range in
let Tm_IntroPure { p = p } = t.term in
let (| p , p_typing |) = check_prop g p in
let pv = check_prop_validity g p p_typing in
let st_typing = T_IntroPure _ _ p_typing pv in
prove_post_hint (try_frame_pre pre_typing
(match_comp_res_with_post_hint st_typing post_hint)
res_ppname)
post_hint
t.range | {
"checked_file": "Pulse.Checker.IntroPure.fst.checked",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.IntroPure.fst"
} | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.post_hint_opt",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.st_term",
"Prims.b2t",
"Pulse.Syntax.Base.uu___is_Tm_IntroPure",
"Pulse.Syntax.Base.__proj__Mkst_term__item__term",
"Pulse.Typing.tm_prop",
"Pulse.Checker.Prover.prove_post_hint",
"Pulse.Syntax.Base.__proj__Mkst_term__item__range",
"Pulse.Checker.Base.checker_result_t",
"FStar.Pervasives.Native.None",
"Pulse.Typing.post_hint_t",
"Pulse.Checker.Prover.try_frame_pre",
"FStar.Pervasives.dtuple3",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.st_typing",
"Pulse.Checker.Base.match_comp_res_with_post_hint",
"Pulse.Typing.wtag",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.ctag",
"Pulse.Syntax.Base.STT_Ghost",
"Pulse.Syntax.Base.Tm_IntroPure",
"Pulse.Syntax.Base.Mkst_term'__Tm_IntroPure__payload",
"Pulse.Typing.comp_intro_pure",
"Pulse.Typing.T_IntroPure",
"Pulse.Typing.prop_validity",
"Pulse.Checker.IntroPure.check_prop_validity",
"Prims.dtuple2",
"Pulse.Checker.IntroPure.check_prop",
"Pulse.Syntax.Base.st_term'",
"Prims.eq2",
"Pulse.Typing.Env.push_context"
] | [] | module Pulse.Checker.IntroPure
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Base
open Pulse.Checker.Prover
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer
let check_prop (g:env) (p:term)
: T.Tac (p:term & tot_typing g p tm_prop) =
let p0 = p in
let (| p, p_typing |) = Pulse.Checker.Pure.check_vprop g (tm_pure p) in
match p.t with
| Tm_Pure pp ->
let prop_typing = Pulse.Typing.Metatheory.pure_typing_inversion #_ #pp p_typing in
(| pp, prop_typing |)
| _ ->
fail g None
(Printf.sprintf "Impossible: check_intro_pure: checking a pure vprop %s returned a non-pure vprop %s,\
please file a bug-report"
(P.term_to_string (tm_pure p0))
(P.term_to_string p))
let check_prop_validity (g:env) (p:term) (typing:tot_typing g p tm_prop): T.Tac (prop_validity g p) =
Pulse.Checker.Pure.check_prop_validity g p typing
let check
(g:env)
(pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(post_hint:post_hint_opt g)
(res_ppname:ppname)
(t:st_term { Tm_IntroPure? t.term }) | false | false | Pulse.Checker.IntroPure.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 check
(g:env)
(pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(post_hint:post_hint_opt g)
(res_ppname:ppname)
(t:st_term { Tm_IntroPure? t.term })
: T.Tac (checker_result_t g pre post_hint) | [] | Pulse.Checker.IntroPure.check | {
"file_name": "lib/steel/pulse/Pulse.Checker.IntroPure.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Typing.Env.env ->
pre: Pulse.Syntax.Base.term ->
pre_typing: Pulse.Typing.tot_typing g pre Pulse.Syntax.Base.tm_vprop ->
post_hint: Pulse.Typing.post_hint_opt g ->
res_ppname: Pulse.Syntax.Base.ppname ->
t: Pulse.Syntax.Base.st_term{Tm_IntroPure? (Mkst_term?.term t)}
-> FStar.Tactics.Effect.Tac (Pulse.Checker.Base.checker_result_t g pre post_hint) | {
"end_col": 125,
"end_line": 46,
"start_col": 46,
"start_line": 38
} |
FStar.Tactics.Effect.Tac | val check_prop (g: env) (p: term) : T.Tac (p: term & tot_typing g p tm_prop) | [
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"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 check_prop (g:env) (p:term)
: T.Tac (p:term & tot_typing g p tm_prop) =
let p0 = p in
let (| p, p_typing |) = Pulse.Checker.Pure.check_vprop g (tm_pure p) in
match p.t with
| Tm_Pure pp ->
let prop_typing = Pulse.Typing.Metatheory.pure_typing_inversion #_ #pp p_typing in
(| pp, prop_typing |)
| _ ->
fail g None
(Printf.sprintf "Impossible: check_intro_pure: checking a pure vprop %s returned a non-pure vprop %s,\
please file a bug-report"
(P.term_to_string (tm_pure p0))
(P.term_to_string p)) | val check_prop (g: env) (p: term) : T.Tac (p: term & tot_typing g p tm_prop)
let check_prop (g: env) (p: term) : T.Tac (p: term & tot_typing g p tm_prop) = | true | null | false | let p0 = p in
let (| p , p_typing |) = Pulse.Checker.Pure.check_vprop g (tm_pure p) in
match p.t with
| Tm_Pure pp ->
let prop_typing = Pulse.Typing.Metatheory.pure_typing_inversion #_ #pp p_typing in
(| pp, prop_typing |)
| _ ->
fail g
None
(Printf.sprintf "Impossible: check_intro_pure: checking a pure vprop %s returned a non-pure vprop %s,please file a bug-report"
(P.term_to_string (tm_pure p0))
(P.term_to_string p)) | {
"checked_file": "Pulse.Checker.IntroPure.fst.checked",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.IntroPure.fst"
} | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Syntax.Base.__proj__Mkterm__item__t",
"Prims.Mkdtuple2",
"Pulse.Typing.tm_prop",
"Pulse.Syntax.Base.tm_fstar",
"FStar.Reflection.Typing.tm_prop",
"FStar.Range.range_0",
"Pulse.Typing.Metatheory.Base.pure_typing_inversion",
"Prims.dtuple2",
"Pulse.Syntax.Base.term'",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.range",
"Prims.string",
"FStar.Printf.sprintf",
"Pulse.Syntax.Printer.term_to_string",
"Pulse.Syntax.Base.tm_pure",
"Pulse.Checker.Pure.check_vprop"
] | [] | module Pulse.Checker.IntroPure
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Base
open Pulse.Checker.Prover
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer | false | false | Pulse.Checker.IntroPure.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 check_prop (g: env) (p: term) : T.Tac (p: term & tot_typing g p tm_prop) | [] | Pulse.Checker.IntroPure.check_prop | {
"file_name": "lib/steel/pulse/Pulse.Checker.IntroPure.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | g: Pulse.Typing.Env.env -> p: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(Prims.dtuple2 Pulse.Syntax.Base.term
(fun p -> Pulse.Typing.tot_typing g p Pulse.Typing.tm_prop)) | {
"end_col": 30,
"end_line": 25,
"start_col": 45,
"start_line": 12
} |
FStar.Pervasives.Lemma | val transpose_state8_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state8 st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a)) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"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.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2",
"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 transpose_state8_lemma #a #m st j i =
let l = lanes a m in
let ind = 8 * j + i / word_length a in
let r0 = transpose8x8_lseq st in
transpose8x8_lemma st | val transpose_state8_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state8 st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a))
let transpose_state8_lemma #a #m st j i = | false | null | true | let l = lanes a m in
let ind = 8 * j + i / word_length a in
let r0 = transpose8x8_lseq st in
transpose8x8_lemma st | {
"checked_file": "Hacl.Spec.SHA2.Lemmas.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.SHA2.Vec.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.SHA2.Lemmas.fst"
} | [
"lemma"
] | [
"Spec.Hash.Definitions.sha2_alg",
"Hacl.Spec.SHA2.Vec.m_spec",
"Prims.eq2",
"Prims.int",
"Hacl.Spec.SHA2.Vec.lanes",
"Hacl.Spec.SHA2.Vec.state_spec",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Spec.Hash.Definitions.word_length",
"Lib.IntVector.Transpose.transpose8x8_lemma",
"Spec.Hash.Definitions.word_t",
"Lib.Sequence.lseq",
"Lib.IntVector.vec_t",
"Lib.IntVector.Transpose.transpose8x8_lseq",
"Prims.op_Addition",
"Prims.op_Division",
"Hacl.Spec.SHA2.Vec.lanes_t",
"Prims.unit"
] | [] | module Hacl.Spec.SHA2.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Spec.Hash.Definitions
open Hacl.Spec.SHA2.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws4_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
//assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);
//assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub])
val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws8_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v (transpose8x8_lseq vs).[j_sub]).[j]);
transpose8x8_lemma vs;
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i_sub * lanes a m + j]).[j_sub])
val transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws_lemma_ij #a #m ws j i =
assert (((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v (transpose_ws ws).[i]).[j]);
match lanes a m with
| 1 -> ()
| 4 -> transpose_ws4_lemma_ij #a #m ws j i
| 8 -> transpose_ws8_lemma_ij #a #m ws j i
val transpose_state4_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a))
let transpose_state4_lemma #a #m st j i =
let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4)
val transpose_state8_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state8 st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a)) | false | false | Hacl.Spec.SHA2.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"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": 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 transpose_state8_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state8 st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a)) | [] | Hacl.Spec.SHA2.Lemmas.transpose_state8_lemma | {
"file_name": "code/sha2-mb/Hacl.Spec.SHA2.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
st: Hacl.Spec.SHA2.Vec.state_spec a m ->
j: Prims.nat{j < Hacl.Spec.SHA2.Vec.lanes a m} ->
i: Prims.nat{i < 8 * Spec.Hash.Definitions.word_length a}
-> FStar.Pervasives.Lemma
(ensures
(let l = Hacl.Spec.SHA2.Vec.lanes a m in
let ind = 8 * j + i / Spec.Hash.Definitions.word_length a in
FStar.Seq.Base.index (Lib.IntVector.vec_v (Hacl.Spec.SHA2.Vec.transpose_state8 st).[ ind / l
])
(ind % l) ==
FStar.Seq.Base.index (Hacl.Spec.SHA2.Vec.state_spec_v st).[ j ]
(i / Spec.Hash.Definitions.word_length a))) | {
"end_col": 23,
"end_line": 117,
"start_col": 41,
"start_line": 113
} |
FStar.Pervasives.Lemma | val transpose_state_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
(Seq.index (vec_v (transpose_state st).[ind / l])) (ind % l) ==
(Seq.index (state_spec_v st).[j] (i / word_length a))) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"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.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2",
"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 transpose_state_lemma_ij #a #m st j i =
match lanes a m with
| 1 -> ()
| 4 -> transpose_state4_lemma #a #m st j i
| 8 -> transpose_state8_lemma #a #m st j i | val transpose_state_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
(Seq.index (vec_v (transpose_state st).[ind / l])) (ind % l) ==
(Seq.index (state_spec_v st).[j] (i / word_length a)))
let transpose_state_lemma_ij #a #m st j i = | false | null | true | match lanes a m with
| 1 -> ()
| 4 -> transpose_state4_lemma #a #m st j i
| 8 -> transpose_state8_lemma #a #m st j i | {
"checked_file": "Hacl.Spec.SHA2.Lemmas.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.SHA2.Vec.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.SHA2.Lemmas.fst"
} | [
"lemma"
] | [
"Spec.Hash.Definitions.sha2_alg",
"Hacl.Spec.SHA2.Vec.m_spec",
"Hacl.Spec.SHA2.Vec.is_supported",
"Hacl.Spec.SHA2.Vec.state_spec",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Spec.SHA2.Vec.lanes",
"FStar.Mul.op_Star",
"Spec.Hash.Definitions.word_length",
"Hacl.Spec.SHA2.Lemmas.transpose_state4_lemma",
"Hacl.Spec.SHA2.Lemmas.transpose_state8_lemma",
"Prims.unit"
] | [] | module Hacl.Spec.SHA2.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Spec.Hash.Definitions
open Hacl.Spec.SHA2.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws4_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
//assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);
//assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub])
val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws8_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v (transpose8x8_lseq vs).[j_sub]).[j]);
transpose8x8_lemma vs;
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i_sub * lanes a m + j]).[j_sub])
val transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws_lemma_ij #a #m ws j i =
assert (((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v (transpose_ws ws).[i]).[j]);
match lanes a m with
| 1 -> ()
| 4 -> transpose_ws4_lemma_ij #a #m ws j i
| 8 -> transpose_ws8_lemma_ij #a #m ws j i
val transpose_state4_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a))
let transpose_state4_lemma #a #m st j i =
let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4)
val transpose_state8_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state8 st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a))
let transpose_state8_lemma #a #m st j i =
let l = lanes a m in
let ind = 8 * j + i / word_length a in
let r0 = transpose8x8_lseq st in
transpose8x8_lemma st
val transpose_state_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
(Seq.index (vec_v (transpose_state st).[ind / l])) (ind % l) ==
(Seq.index (state_spec_v st).[j] (i / word_length a))) | false | false | Hacl.Spec.SHA2.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"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": 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 transpose_state_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
(Seq.index (vec_v (transpose_state st).[ind / l])) (ind % l) ==
(Seq.index (state_spec_v st).[j] (i / word_length a))) | [] | Hacl.Spec.SHA2.Lemmas.transpose_state_lemma_ij | {
"file_name": "code/sha2-mb/Hacl.Spec.SHA2.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
st: Hacl.Spec.SHA2.Vec.state_spec a m ->
j: Prims.nat{j < Hacl.Spec.SHA2.Vec.lanes a m} ->
i: Prims.nat{i < 8 * Spec.Hash.Definitions.word_length a}
-> FStar.Pervasives.Lemma
(ensures
(let l = Hacl.Spec.SHA2.Vec.lanes a m in
let ind = 8 * j + i / Spec.Hash.Definitions.word_length a in
FStar.Seq.Base.index (Lib.IntVector.vec_v (Hacl.Spec.SHA2.Vec.transpose_state st).[ ind / l
])
(ind % l) ==
FStar.Seq.Base.index (Hacl.Spec.SHA2.Vec.state_spec_v st).[ j ]
(i / Spec.Hash.Definitions.word_length a))) | {
"end_col": 44,
"end_line": 136,
"start_col": 2,
"start_line": 133
} |
FStar.Pervasives.Lemma | val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l]) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"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.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2",
"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 transpose_ws4_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
//assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);
//assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub]) | val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws4_lemma_ij #a #m ws j i = | false | null | true | let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
assert ((vec_v (transpose_ws4 ws).[ i ]).[ j ] == (vec_v (transpose4x4_lseq vs).[ j_sub ]).[ j ]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[ i ]).[ j ] == (vec_v vs.[ j ]).[ j_sub ]);
assert ((vec_v (transpose_ws4 ws).[ i ]).[ j ] == (vec_v ws.[ i_sub * l + j ]).[ j_sub ]) | {
"checked_file": "Hacl.Spec.SHA2.Lemmas.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.SHA2.Vec.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.SHA2.Lemmas.fst"
} | [
"lemma"
] | [
"Spec.Hash.Definitions.sha2_alg",
"Hacl.Spec.SHA2.Vec.m_spec",
"Prims.eq2",
"Prims.int",
"Hacl.Spec.SHA2.Vec.lanes",
"Hacl.Spec.SHA2.Vec.ws_spec",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims._assert",
"Lib.IntTypes.uint_t",
"Spec.Hash.Definitions.word_t",
"Lib.IntTypes.SEC",
"Prims.l_or",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.IntVector.vec_v",
"Lib.Sequence.op_String_Access",
"Hacl.Spec.SHA2.Vec.element_t",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Hacl.Spec.SHA2.Vec.transpose_ws4",
"Prims.unit",
"Lib.IntVector.Transpose.transpose4x4_lemma",
"Lib.IntVector.vec_t",
"Lib.IntVector.Transpose.transpose4x4_lseq",
"Lib.Sequence.eq_intro",
"Lib.Sequence.sub",
"Lib.Sequence.lseq",
"Prims.l_and",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.slice",
"Prims.op_Multiply",
"Prims.l_Forall",
"Lib.Sequence.index",
"Prims.op_Modulus",
"Prims.op_Division",
"Hacl.Spec.SHA2.Vec.lanes_t"
] | [] | module Hacl.Spec.SHA2.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Spec.Hash.Definitions
open Hacl.Spec.SHA2.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l]) | false | false | Hacl.Spec.SHA2.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"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": 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 transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l]) | [] | Hacl.Spec.SHA2.Lemmas.transpose_ws4_lemma_ij | {
"file_name": "code/sha2-mb/Hacl.Spec.SHA2.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ws: Hacl.Spec.SHA2.Vec.ws_spec a m ->
j: Prims.nat{j < Hacl.Spec.SHA2.Vec.lanes a m} ->
i: Prims.nat{i < 16}
-> FStar.Pervasives.Lemma
(ensures
(let l = Hacl.Spec.SHA2.Vec.lanes a m in
(Lib.IntVector.vec_v (Hacl.Spec.SHA2.Vec.transpose_ws4 ws).[ i ]).[ j ] ==
(Lib.IntVector.vec_v ws.[ (i / l) * l + j ]).[ i % l ])) | {
"end_col": 83,
"end_line": 38,
"start_col": 41,
"start_line": 25
} |
FStar.Pervasives.Lemma | val transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l]) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"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.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2",
"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 transpose_ws_lemma_ij #a #m ws j i =
assert (((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v (transpose_ws ws).[i]).[j]);
match lanes a m with
| 1 -> ()
| 4 -> transpose_ws4_lemma_ij #a #m ws j i
| 8 -> transpose_ws8_lemma_ij #a #m ws j i | val transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws_lemma_ij #a #m ws j i = | false | null | true | assert (((ws_spec_v (transpose_ws ws)).[ j ]).[ i ] == (vec_v (transpose_ws ws).[ i ]).[ j ]);
match lanes a m with
| 1 -> ()
| 4 -> transpose_ws4_lemma_ij #a #m ws j i
| 8 -> transpose_ws8_lemma_ij #a #m ws j i | {
"checked_file": "Hacl.Spec.SHA2.Lemmas.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.SHA2.Vec.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.SHA2.Lemmas.fst"
} | [
"lemma"
] | [
"Spec.Hash.Definitions.sha2_alg",
"Hacl.Spec.SHA2.Vec.m_spec",
"Hacl.Spec.SHA2.Vec.is_supported",
"Hacl.Spec.SHA2.Vec.ws_spec",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Spec.SHA2.Vec.lanes",
"Hacl.Spec.SHA2.Lemmas.transpose_ws4_lemma_ij",
"Hacl.Spec.SHA2.Lemmas.transpose_ws8_lemma_ij",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Lib.IntTypes.uint_t",
"Spec.Hash.Definitions.word_t",
"Lib.IntTypes.SEC",
"Prims.l_or",
"Hacl.Spec.SHA2.Vec.word",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.op_String_Access",
"Lib.Sequence.lseq",
"Hacl.Spec.SHA2.Vec.ws_spec_v",
"Hacl.Spec.SHA2.Vec.transpose_ws",
"Lib.IntVector.vec_v",
"Hacl.Spec.SHA2.Vec.element_t"
] | [] | module Hacl.Spec.SHA2.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Spec.Hash.Definitions
open Hacl.Spec.SHA2.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws4_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
//assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);
//assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub])
val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws8_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v (transpose8x8_lseq vs).[j_sub]).[j]);
transpose8x8_lemma vs;
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i_sub * lanes a m + j]).[j_sub])
val transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l]) | false | false | Hacl.Spec.SHA2.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"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": 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 transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l]) | [] | Hacl.Spec.SHA2.Lemmas.transpose_ws_lemma_ij | {
"file_name": "code/sha2-mb/Hacl.Spec.SHA2.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ws: Hacl.Spec.SHA2.Vec.ws_spec a m ->
j: Prims.nat{j < Hacl.Spec.SHA2.Vec.lanes a m} ->
i: Prims.nat{i < 16}
-> FStar.Pervasives.Lemma
(ensures
(let l = Hacl.Spec.SHA2.Vec.lanes a m in
(Hacl.Spec.SHA2.Vec.ws_spec_v (Hacl.Spec.SHA2.Vec.transpose_ws ws)).[ j ].[ i ] ==
(Lib.IntVector.vec_v ws.[ (i / l) * l + j ]).[ i % l ])) | {
"end_col": 44,
"end_line": 79,
"start_col": 2,
"start_line": 75
} |
FStar.Pervasives.Lemma | val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l]) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"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.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2",
"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 transpose_ws8_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v (transpose8x8_lseq vs).[j_sub]).[j]);
transpose8x8_lemma vs;
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i_sub * lanes a m + j]).[j_sub]) | val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws8_lemma_ij #a #m ws j i = | false | null | true | let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);
assert ((vec_v (transpose_ws8 ws).[ i ]).[ j ] == (vec_v (transpose8x8_lseq vs).[ j_sub ]).[ j ]);
transpose8x8_lemma vs;
assert ((vec_v (transpose_ws8 ws).[ i ]).[ j ] == (vec_v ws.[ i_sub * lanes a m + j ]).[ j_sub ]) | {
"checked_file": "Hacl.Spec.SHA2.Lemmas.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.SHA2.Vec.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.SHA2.Lemmas.fst"
} | [
"lemma"
] | [
"Spec.Hash.Definitions.sha2_alg",
"Hacl.Spec.SHA2.Vec.m_spec",
"Prims.eq2",
"Prims.int",
"Hacl.Spec.SHA2.Vec.lanes",
"Hacl.Spec.SHA2.Vec.ws_spec",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims._assert",
"Lib.IntTypes.uint_t",
"Spec.Hash.Definitions.word_t",
"Lib.IntTypes.SEC",
"Prims.l_or",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.IntVector.vec_v",
"Lib.Sequence.op_String_Access",
"Hacl.Spec.SHA2.Vec.element_t",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Hacl.Spec.SHA2.Vec.transpose_ws8",
"Prims.unit",
"Lib.IntVector.Transpose.transpose8x8_lemma",
"Lib.IntVector.vec_t",
"Lib.IntVector.Transpose.transpose8x8_lseq",
"Lib.Sequence.eq_intro",
"Lib.Sequence.sub",
"Lib.Sequence.lseq",
"Prims.l_and",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.slice",
"Prims.op_Multiply",
"Prims.l_Forall",
"Lib.Sequence.index",
"Prims.op_Modulus",
"Prims.op_Division",
"Hacl.Spec.SHA2.Vec.lanes_t"
] | [] | module Hacl.Spec.SHA2.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Spec.Hash.Definitions
open Hacl.Spec.SHA2.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws4_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
//assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);
//assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub])
val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l]) | false | false | Hacl.Spec.SHA2.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"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": 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 transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l]) | [] | Hacl.Spec.SHA2.Lemmas.transpose_ws8_lemma_ij | {
"file_name": "code/sha2-mb/Hacl.Spec.SHA2.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ws: Hacl.Spec.SHA2.Vec.ws_spec a m ->
j: Prims.nat{j < Hacl.Spec.SHA2.Vec.lanes a m} ->
i: Prims.nat{i < 16}
-> FStar.Pervasives.Lemma
(ensures
(let l = Hacl.Spec.SHA2.Vec.lanes a m in
(Lib.IntVector.vec_v (Hacl.Spec.SHA2.Vec.transpose_ws8 ws).[ i ]).[ j ] ==
(Lib.IntVector.vec_v ws.[ (i / l) * l + j ]).[ i % l ])) | {
"end_col": 91,
"end_line": 61,
"start_col": 41,
"start_line": 51
} |
FStar.Pervasives.Lemma | val transpose_state4_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a)) | [
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector.Transpose",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"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.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.SHA2",
"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 transpose_state4_lemma #a #m st j i =
let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4) | val transpose_state4_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a))
let transpose_state4_lemma #a #m st j i = | false | null | true | let r0 = transpose4x4_lseq (sub st 0 4) in
transpose4x4_lemma (sub st 0 4);
let r1 = transpose4x4_lseq (sub st 4 4) in
transpose4x4_lemma (sub st 4 4) | {
"checked_file": "Hacl.Spec.SHA2.Lemmas.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntVector.Transpose.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.SHA2.Vec.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.SHA2.Lemmas.fst"
} | [
"lemma"
] | [
"Spec.Hash.Definitions.sha2_alg",
"Hacl.Spec.SHA2.Vec.m_spec",
"Prims.eq2",
"Prims.int",
"Hacl.Spec.SHA2.Vec.lanes",
"Hacl.Spec.SHA2.Vec.state_spec",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Spec.Hash.Definitions.word_length",
"Lib.IntVector.Transpose.transpose4x4_lemma",
"Spec.Hash.Definitions.word_t",
"Lib.Sequence.sub",
"Hacl.Spec.SHA2.Vec.element_t",
"Lib.Sequence.lseq",
"Lib.IntVector.vec_t",
"Lib.IntVector.Transpose.transpose4x4_lseq",
"Prims.unit"
] | [] | module Hacl.Spec.SHA2.Lemmas
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Lib.IntVector
open Lib.IntVector.Transpose
open Spec.Hash.Definitions
open Hacl.Spec.SHA2.Vec
#set-options "--z3rlimit 50 --fuel 0 --ifuel 1"
val transpose_ws4_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws4_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);
//assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);
//assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);
transpose4x4_lemma vs;
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);
assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub])
val transpose_ws8_lemma_ij:
#a:sha2_alg
-> #m:m_spec{lanes a m == 8}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
(vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws8_lemma_ij #a #m ws j i =
let l = lanes a m in
let i_sub = i / l in
let j_sub = i % l in
assert (i_sub * l + j_sub == i);
let vs = sub ws (i_sub * l) l in
eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v (transpose8x8_lseq vs).[j_sub]).[j]);
transpose8x8_lemma vs;
assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i_sub * lanes a m + j]).[j_sub])
val transpose_ws_lemma_ij:
#a:sha2_alg
-> #m:m_spec{is_supported a m}
-> ws:ws_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 16} ->
Lemma
(let l = lanes a m in
((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l])
let transpose_ws_lemma_ij #a #m ws j i =
assert (((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v (transpose_ws ws).[i]).[j]);
match lanes a m with
| 1 -> ()
| 4 -> transpose_ws4_lemma_ij #a #m ws j i
| 8 -> transpose_ws8_lemma_ij #a #m ws j i
val transpose_state4_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a)) | false | false | Hacl.Spec.SHA2.Lemmas.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"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": 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 transpose_state4_lemma:
#a:sha2_alg
-> #m:m_spec{lanes a m == 4}
-> st:state_spec a m
-> j:nat{j < lanes a m}
-> i:nat{i < 8 * word_length a} ->
Lemma
(let l = lanes a m in
let ind = 8 * j + i / word_length a in
Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==
Seq.index (state_spec_v st).[j] (i / word_length a)) | [] | Hacl.Spec.SHA2.Lemmas.transpose_state4_lemma | {
"file_name": "code/sha2-mb/Hacl.Spec.SHA2.Lemmas.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
st: Hacl.Spec.SHA2.Vec.state_spec a m ->
j: Prims.nat{j < Hacl.Spec.SHA2.Vec.lanes a m} ->
i: Prims.nat{i < 8 * Spec.Hash.Definitions.word_length a}
-> FStar.Pervasives.Lemma
(ensures
(let l = Hacl.Spec.SHA2.Vec.lanes a m in
let ind = 8 * j + i / Spec.Hash.Definitions.word_length a in
FStar.Seq.Base.index (Lib.IntVector.vec_v (Hacl.Spec.SHA2.Vec.transpose_state st).[ ind / l
])
(ind % l) ==
FStar.Seq.Base.index (Hacl.Spec.SHA2.Vec.state_spec_v st).[ j ]
(i / Spec.Hash.Definitions.word_length a))) | {
"end_col": 33,
"end_line": 98,
"start_col": 41,
"start_line": 94
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"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.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"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 elab_frame (c:comp_st) (frame:term) (e:R.term) =
let u = comp_u c in
let ty = elab_term (comp_res c) in
let pre = elab_term (comp_pre c) in
let post = elab_term (comp_post c) in
if C_ST? c
then mk_frame_stt u ty pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let opened = elab_term (comp_inames c) in
if C_STAtomic? c
then mk_frame_stt_atomic u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let _ = assert (C_STGhost? c) in
mk_frame_stt_ghost u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e | let elab_frame (c: comp_st) (frame: term) (e: R.term) = | false | null | false | let u = comp_u c in
let ty = elab_term (comp_res c) in
let pre = elab_term (comp_pre c) in
let post = elab_term (comp_post c) in
if C_ST? c
then mk_frame_stt u ty pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else
let opened = elab_term (comp_inames c) in
if C_STAtomic? c
then mk_frame_stt_atomic u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else
let _ = assert (C_STGhost? c) in
mk_frame_stt_ghost u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e | {
"checked_file": "Pulse.Elaborate.Core.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Elaborate.Core.fst"
} | [
"total"
] | [
"Pulse.Syntax.Base.comp_st",
"Pulse.Syntax.Base.term",
"FStar.Reflection.Types.term",
"Pulse.Syntax.Base.uu___is_C_ST",
"Pulse.Reflection.Util.mk_frame_stt",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Elaborate.Pure.elab_term",
"Prims.bool",
"Pulse.Syntax.Base.uu___is_C_STAtomic",
"Pulse.Reflection.Util.mk_frame_stt_atomic",
"Pulse.Reflection.Util.mk_frame_stt_ghost",
"Prims.unit",
"Prims._assert",
"Prims.b2t",
"Pulse.Syntax.Base.uu___is_C_STGhost",
"Pulse.Syntax.Base.comp_inames",
"Pulse.Syntax.Base.comp_post",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.comp_u"
] | [] | module Pulse.Elaborate.Core
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.Elaborate.Pure
open Pulse.Typing
open Pulse.Reflection.Util | false | true | Pulse.Elaborate.Core.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 elab_frame : c: Pulse.Syntax.Base.comp_st -> frame: Pulse.Syntax.Base.term -> e: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Elaborate.Core.elab_frame | {
"file_name": "lib/steel/pulse/Pulse.Elaborate.Core.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | c: Pulse.Syntax.Base.comp_st -> frame: Pulse.Syntax.Base.term -> e: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 96,
"end_line": 24,
"start_col": 52,
"start_line": 13
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"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.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"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 elab_sub (c1 c2:comp_st) (e:R.term) =
let ty = elab_term (comp_res c1) in
let u = comp_u c1 in
let pre1 = elab_term (comp_pre c1) in
let pre2 = elab_term (comp_pre c2) in
let post1 = mk_abs ty R.Q_Explicit (elab_term (comp_post c1)) in
let post2 = mk_abs ty R.Q_Explicit (elab_term (comp_post c2)) in
if C_ST? c1
then mk_sub_stt u ty pre1 pre2 post1 post2 e
else let opened = elab_term (comp_inames c1) in
if C_STAtomic? c1
then mk_sub_stt_atomic u ty opened pre1 pre2 post1 post2 e
else let _ = assert (C_STGhost? c1) in
mk_sub_stt_ghost u ty opened pre1 pre2 post1 post2 e | let elab_sub (c1 c2: comp_st) (e: R.term) = | false | null | false | let ty = elab_term (comp_res c1) in
let u = comp_u c1 in
let pre1 = elab_term (comp_pre c1) in
let pre2 = elab_term (comp_pre c2) in
let post1 = mk_abs ty R.Q_Explicit (elab_term (comp_post c1)) in
let post2 = mk_abs ty R.Q_Explicit (elab_term (comp_post c2)) in
if C_ST? c1
then mk_sub_stt u ty pre1 pre2 post1 post2 e
else
let opened = elab_term (comp_inames c1) in
if C_STAtomic? c1
then mk_sub_stt_atomic u ty opened pre1 pre2 post1 post2 e
else
let _ = assert (C_STGhost? c1) in
mk_sub_stt_ghost u ty opened pre1 pre2 post1 post2 e | {
"checked_file": "Pulse.Elaborate.Core.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Elaborate.Core.fst"
} | [
"total"
] | [
"Pulse.Syntax.Base.comp_st",
"FStar.Reflection.Types.term",
"Pulse.Syntax.Base.uu___is_C_ST",
"Pulse.Reflection.Util.mk_sub_stt",
"Prims.bool",
"Pulse.Syntax.Base.uu___is_C_STAtomic",
"Pulse.Reflection.Util.mk_sub_stt_atomic",
"Pulse.Reflection.Util.mk_sub_stt_ghost",
"Prims.unit",
"Prims._assert",
"Prims.b2t",
"Pulse.Syntax.Base.uu___is_C_STGhost",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Syntax.Base.comp_inames",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Syntax.Base.comp_post",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.comp_u",
"Pulse.Syntax.Base.comp_res"
] | [] | module Pulse.Elaborate.Core
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.Elaborate.Pure
open Pulse.Typing
open Pulse.Reflection.Util
let elab_frame (c:comp_st) (frame:term) (e:R.term) =
let u = comp_u c in
let ty = elab_term (comp_res c) in
let pre = elab_term (comp_pre c) in
let post = elab_term (comp_post c) in
if C_ST? c
then mk_frame_stt u ty pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let opened = elab_term (comp_inames c) in
if C_STAtomic? c
then mk_frame_stt_atomic u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let _ = assert (C_STGhost? c) in
mk_frame_stt_ghost u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e | false | true | Pulse.Elaborate.Core.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 elab_sub : c1: Pulse.Syntax.Base.comp_st -> c2: Pulse.Syntax.Base.comp_st -> e: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Elaborate.Core.elab_sub | {
"file_name": "lib/steel/pulse/Pulse.Elaborate.Core.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | c1: Pulse.Syntax.Base.comp_st -> c2: Pulse.Syntax.Base.comp_st -> e: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 64,
"end_line": 39,
"start_col": 41,
"start_line": 26
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"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.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"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 intro_pure_tm (p:term) =
let open Pulse.Reflection.Util in
wtag (Some STT_Ghost)
(Tm_STApp
{ head =
tm_pureapp (tm_fvar (as_fv (mk_pulse_lib_core_lid "intro_pure")))
None
p;
arg_qual = None;
arg = tm_fstar (`()) Range.range_0 }) | let intro_pure_tm (p: term) = | false | null | false | let open Pulse.Reflection.Util in
wtag (Some STT_Ghost)
(Tm_STApp
({
head = tm_pureapp (tm_fvar (as_fv (mk_pulse_lib_core_lid "intro_pure"))) None p;
arg_qual = None;
arg = tm_fstar (`()) Range.range_0
})) | {
"checked_file": "Pulse.Elaborate.Core.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Elaborate.Core.fst"
} | [
"total"
] | [
"Pulse.Syntax.Base.term",
"Pulse.Typing.wtag",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.ctag",
"Pulse.Syntax.Base.STT_Ghost",
"Pulse.Syntax.Base.Tm_STApp",
"Pulse.Syntax.Base.Mkst_term'__Tm_STApp__payload",
"Pulse.Syntax.Pure.tm_pureapp",
"Pulse.Syntax.Pure.tm_fvar",
"Pulse.Syntax.Base.as_fv",
"Pulse.Reflection.Util.mk_pulse_lib_core_lid",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.qualifier",
"Pulse.Syntax.Base.tm_fstar",
"FStar.Range.range_0",
"Pulse.Syntax.Base.st_term"
] | [] | module Pulse.Elaborate.Core
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.Elaborate.Pure
open Pulse.Typing
open Pulse.Reflection.Util
let elab_frame (c:comp_st) (frame:term) (e:R.term) =
let u = comp_u c in
let ty = elab_term (comp_res c) in
let pre = elab_term (comp_pre c) in
let post = elab_term (comp_post c) in
if C_ST? c
then mk_frame_stt u ty pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let opened = elab_term (comp_inames c) in
if C_STAtomic? c
then mk_frame_stt_atomic u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let _ = assert (C_STGhost? c) in
mk_frame_stt_ghost u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
let elab_sub (c1 c2:comp_st) (e:R.term) =
let ty = elab_term (comp_res c1) in
let u = comp_u c1 in
let pre1 = elab_term (comp_pre c1) in
let pre2 = elab_term (comp_pre c2) in
let post1 = mk_abs ty R.Q_Explicit (elab_term (comp_post c1)) in
let post2 = mk_abs ty R.Q_Explicit (elab_term (comp_post c2)) in
if C_ST? c1
then mk_sub_stt u ty pre1 pre2 post1 post2 e
else let opened = elab_term (comp_inames c1) in
if C_STAtomic? c1
then mk_sub_stt_atomic u ty opened pre1 pre2 post1 post2 e
else let _ = assert (C_STGhost? c1) in
mk_sub_stt_ghost u ty opened pre1 pre2 post1 post2 e
let elab_bind #g #x #c1 #c2 #c
(bc:bind_comp g x c1 c2 c)
(e1 e2:R.term)
: R.term
= let t1 = elab_term (comp_res c1) in
let t2 = elab_term (comp_res c2) in
match bc with
| Bind_comp _ _ _ _ _ _ _ ->
if C_ST? c1
then
mk_bind_stt
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
else
mk_bind_ghost
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
| Bind_comp_ghost_l _ _ _ _ (| reveal_a, reveal_a_typing |) _ _ _ ->
mk_bind_ghost_atomic
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
(elab_term reveal_a)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b, reveal_b_typing |) _ _ _ ->
mk_bind_atomic_ghost
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
(elab_term reveal_b)
let elab_lift #g #c1 #c2 (d:lift_comp g c1 c2) (e:R.term)
: Tot R.term
= match d with
| Lift_STAtomic_ST _ _ ->
let t = elab_term (comp_res c1) in
mk_lift_atomic_stt
(comp_u c1)
(elab_term (comp_res c1))
t
(mk_abs t R.Q_Explicit (elab_term (comp_post c1)))
e
| Lift_STGhost_STAtomic _ _ (| reveal_a, reveal_a_typing |) ->
let t = elab_term (comp_res c1) in
mk_lift_ghost_atomic
(comp_u c1)
t
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t R.Q_Explicit (elab_term (comp_post c1)))
e
(elab_term reveal_a) | false | true | Pulse.Elaborate.Core.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 intro_pure_tm : p: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.st_term | [] | Pulse.Elaborate.Core.intro_pure_tm | {
"file_name": "lib/steel/pulse/Pulse.Elaborate.Core.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | p: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.st_term | {
"end_col": 47,
"end_line": 127,
"start_col": 2,
"start_line": 119
} |
|
Prims.Tot | val elab_lift (#g #c1 #c2: _) (d: lift_comp g c1 c2) (e: R.term) : Tot R.term | [
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"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.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"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 elab_lift #g #c1 #c2 (d:lift_comp g c1 c2) (e:R.term)
: Tot R.term
= match d with
| Lift_STAtomic_ST _ _ ->
let t = elab_term (comp_res c1) in
mk_lift_atomic_stt
(comp_u c1)
(elab_term (comp_res c1))
t
(mk_abs t R.Q_Explicit (elab_term (comp_post c1)))
e
| Lift_STGhost_STAtomic _ _ (| reveal_a, reveal_a_typing |) ->
let t = elab_term (comp_res c1) in
mk_lift_ghost_atomic
(comp_u c1)
t
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t R.Q_Explicit (elab_term (comp_post c1)))
e
(elab_term reveal_a) | val elab_lift (#g #c1 #c2: _) (d: lift_comp g c1 c2) (e: R.term) : Tot R.term
let elab_lift #g #c1 #c2 (d: lift_comp g c1 c2) (e: R.term) : Tot R.term = | false | null | false | match d with
| Lift_STAtomic_ST _ _ ->
let t = elab_term (comp_res c1) in
mk_lift_atomic_stt (comp_u c1)
(elab_term (comp_res c1))
t
(mk_abs t R.Q_Explicit (elab_term (comp_post c1)))
e
| Lift_STGhost_STAtomic _ _ (| reveal_a , reveal_a_typing |) ->
let t = elab_term (comp_res c1) in
mk_lift_ghost_atomic (comp_u c1)
t
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t R.Q_Explicit (elab_term (comp_post c1)))
e
(elab_term reveal_a) | {
"checked_file": "Pulse.Elaborate.Core.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Elaborate.Core.fst"
} | [
"total"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.lift_comp",
"FStar.Reflection.Types.term",
"Pulse.Syntax.Base.comp_st",
"Prims.l_and",
"Prims.b2t",
"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.Reflection.Util.mk_lift_atomic_stt",
"Pulse.Syntax.Base.comp_u",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Syntax.Base.comp_res",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Syntax.Base.comp_post",
"Pulse.Syntax.Base.uu___is_C_STGhost",
"Pulse.Typing.tot_typing",
"Pulse.Typing.non_informative_witness_t",
"Pulse.Reflection.Util.mk_lift_ghost_atomic",
"Pulse.Syntax.Base.comp_pre"
] | [] | module Pulse.Elaborate.Core
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.Elaborate.Pure
open Pulse.Typing
open Pulse.Reflection.Util
let elab_frame (c:comp_st) (frame:term) (e:R.term) =
let u = comp_u c in
let ty = elab_term (comp_res c) in
let pre = elab_term (comp_pre c) in
let post = elab_term (comp_post c) in
if C_ST? c
then mk_frame_stt u ty pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let opened = elab_term (comp_inames c) in
if C_STAtomic? c
then mk_frame_stt_atomic u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let _ = assert (C_STGhost? c) in
mk_frame_stt_ghost u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
let elab_sub (c1 c2:comp_st) (e:R.term) =
let ty = elab_term (comp_res c1) in
let u = comp_u c1 in
let pre1 = elab_term (comp_pre c1) in
let pre2 = elab_term (comp_pre c2) in
let post1 = mk_abs ty R.Q_Explicit (elab_term (comp_post c1)) in
let post2 = mk_abs ty R.Q_Explicit (elab_term (comp_post c2)) in
if C_ST? c1
then mk_sub_stt u ty pre1 pre2 post1 post2 e
else let opened = elab_term (comp_inames c1) in
if C_STAtomic? c1
then mk_sub_stt_atomic u ty opened pre1 pre2 post1 post2 e
else let _ = assert (C_STGhost? c1) in
mk_sub_stt_ghost u ty opened pre1 pre2 post1 post2 e
let elab_bind #g #x #c1 #c2 #c
(bc:bind_comp g x c1 c2 c)
(e1 e2:R.term)
: R.term
= let t1 = elab_term (comp_res c1) in
let t2 = elab_term (comp_res c2) in
match bc with
| Bind_comp _ _ _ _ _ _ _ ->
if C_ST? c1
then
mk_bind_stt
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
else
mk_bind_ghost
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
| Bind_comp_ghost_l _ _ _ _ (| reveal_a, reveal_a_typing |) _ _ _ ->
mk_bind_ghost_atomic
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
(elab_term reveal_a)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b, reveal_b_typing |) _ _ _ ->
mk_bind_atomic_ghost
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
(elab_term reveal_b)
let elab_lift #g #c1 #c2 (d:lift_comp g c1 c2) (e:R.term) | false | false | Pulse.Elaborate.Core.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 elab_lift (#g #c1 #c2: _) (d: lift_comp g c1 c2) (e: R.term) : Tot R.term | [] | Pulse.Elaborate.Core.elab_lift | {
"file_name": "lib/steel/pulse/Pulse.Elaborate.Core.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | d: Pulse.Typing.lift_comp g c1 c2 -> e: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 28,
"end_line": 116,
"start_col": 4,
"start_line": 97
} |
Prims.Tot | val elab_bind (#g #x #c1 #c2 #c: _) (bc: bind_comp g x c1 c2 c) (e1 e2: R.term) : R.term | [
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"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.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"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 elab_bind #g #x #c1 #c2 #c
(bc:bind_comp g x c1 c2 c)
(e1 e2:R.term)
: R.term
= let t1 = elab_term (comp_res c1) in
let t2 = elab_term (comp_res c2) in
match bc with
| Bind_comp _ _ _ _ _ _ _ ->
if C_ST? c1
then
mk_bind_stt
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
else
mk_bind_ghost
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
| Bind_comp_ghost_l _ _ _ _ (| reveal_a, reveal_a_typing |) _ _ _ ->
mk_bind_ghost_atomic
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
(elab_term reveal_a)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b, reveal_b_typing |) _ _ _ ->
mk_bind_atomic_ghost
(comp_u c1)
(comp_u c2)
t1 t2
(elab_term (comp_inames c1))
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1 e2
(elab_term reveal_b) | val elab_bind (#g #x #c1 #c2 #c: _) (bc: bind_comp g x c1 c2 c) (e1 e2: R.term) : R.term
let elab_bind #g #x #c1 #c2 #c (bc: bind_comp g x c1 c2 c) (e1: R.term) (e2: R.term) : R.term = | false | null | false | let t1 = elab_term (comp_res c1) in
let t2 = elab_term (comp_res c2) in
match bc with
| Bind_comp _ _ _ _ _ _ _ ->
if C_ST? c1
then
mk_bind_stt (comp_u c1)
(comp_u c2)
t1
t2
(elab_term (comp_pre c1))
(mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))
e1
e2
else
mk_bind_ghost (comp_u c1) (comp_u c2) t1 t2 (elab_term (comp_inames c1))
(elab_term (comp_pre c1)) (mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2))) e1 e2
| Bind_comp_ghost_l _ _ _ _ (| reveal_a , reveal_a_typing |) _ _ _ ->
mk_bind_ghost_atomic (comp_u c1) (comp_u c2) t1 t2 (elab_term (comp_inames c1))
(elab_term (comp_pre c1)) (mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2))) e1 e2 (elab_term reveal_a)
| Bind_comp_ghost_r _ _ _ _ (| reveal_b , reveal_b_typing |) _ _ _ ->
mk_bind_atomic_ghost (comp_u c1) (comp_u c2) t1 t2 (elab_term (comp_inames c1))
(elab_term (comp_pre c1)) (mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))
(mk_abs t2 R.Q_Explicit (elab_term (comp_post c2))) e1 e2 (elab_term reveal_b) | {
"checked_file": "Pulse.Elaborate.Core.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Pure.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Elaborate.Core.fst"
} | [
"total"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.bind_comp",
"FStar.Reflection.Types.term",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.bind_comp_pre",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Base.comp_u",
"Prims.l_and",
"Prims.l_not",
"FStar.Set.mem",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.comp_post",
"Pulse.Typing.tot_typing",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Naming.open_term",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Syntax.Base.uu___is_C_ST",
"Pulse.Reflection.Util.mk_bind_stt",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"Prims.bool",
"Pulse.Reflection.Util.mk_bind_ghost",
"Pulse.Syntax.Base.comp_inames",
"Pulse.Typing.bind_comp_ghost_l_pre",
"Pulse.Syntax.Base.term",
"Pulse.Typing.non_informative_witness_t",
"Pulse.Reflection.Util.mk_bind_ghost_atomic",
"Pulse.Typing.bind_comp_ghost_r_pre",
"Pulse.Reflection.Util.mk_bind_atomic_ghost"
] | [] | module Pulse.Elaborate.Core
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.Elaborate.Pure
open Pulse.Typing
open Pulse.Reflection.Util
let elab_frame (c:comp_st) (frame:term) (e:R.term) =
let u = comp_u c in
let ty = elab_term (comp_res c) in
let pre = elab_term (comp_pre c) in
let post = elab_term (comp_post c) in
if C_ST? c
then mk_frame_stt u ty pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let opened = elab_term (comp_inames c) in
if C_STAtomic? c
then mk_frame_stt_atomic u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
else let _ = assert (C_STGhost? c) in
mk_frame_stt_ghost u ty opened pre (mk_abs ty R.Q_Explicit post) (elab_term frame) e
let elab_sub (c1 c2:comp_st) (e:R.term) =
let ty = elab_term (comp_res c1) in
let u = comp_u c1 in
let pre1 = elab_term (comp_pre c1) in
let pre2 = elab_term (comp_pre c2) in
let post1 = mk_abs ty R.Q_Explicit (elab_term (comp_post c1)) in
let post2 = mk_abs ty R.Q_Explicit (elab_term (comp_post c2)) in
if C_ST? c1
then mk_sub_stt u ty pre1 pre2 post1 post2 e
else let opened = elab_term (comp_inames c1) in
if C_STAtomic? c1
then mk_sub_stt_atomic u ty opened pre1 pre2 post1 post2 e
else let _ = assert (C_STGhost? c1) in
mk_sub_stt_ghost u ty opened pre1 pre2 post1 post2 e
let elab_bind #g #x #c1 #c2 #c
(bc:bind_comp g x c1 c2 c)
(e1 e2:R.term) | false | false | Pulse.Elaborate.Core.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 elab_bind (#g #x #c1 #c2 #c: _) (bc: bind_comp g x c1 c2 c) (e1 e2: R.term) : R.term | [] | Pulse.Elaborate.Core.elab_bind | {
"file_name": "lib/steel/pulse/Pulse.Elaborate.Core.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
bc: Pulse.Typing.bind_comp g x c1 c2 c ->
e1: FStar.Reflection.Types.term ->
e2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 28,
"end_line": 93,
"start_col": 3,
"start_line": 46
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"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 u1024 = b:B.buffer UInt64.t{B.length b == 16} | let u1024 = | false | null | false | b: B.buffer UInt64.t {B.length b == 16} | {
"checked_file": "Vale.Inline.X64.Fadd_inline.fsti.checked",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fadd_inline.fsti"
} | [
"total"
] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | module Vale.Inline.X64.Fadd_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4}
unfold
let u512 = b:B.buffer UInt64.t{B.length b == 8} | false | true | Vale.Inline.X64.Fadd_inline.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 u1024 : Type0 | [] | Vale.Inline.X64.Fadd_inline.u1024 | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 49,
"end_line": 15,
"start_col": 12,
"start_line": 15
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"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 u256 = b:B.buffer UInt64.t{B.length b == 4} | let u256 = | false | null | false | b: B.buffer UInt64.t {B.length b == 4} | {
"checked_file": "Vale.Inline.X64.Fadd_inline.fsti.checked",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fadd_inline.fsti"
} | [
"total"
] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | module Vale.Inline.X64.Fadd_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul | false | true | Vale.Inline.X64.Fadd_inline.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 u256 : Type0 | [] | Vale.Inline.X64.Fadd_inline.u256 | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 47,
"end_line": 11,
"start_col": 11,
"start_line": 11
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"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 u512 = b:B.buffer UInt64.t{B.length b == 8} | let u512 = | false | null | false | b: B.buffer UInt64.t {B.length b == 8} | {
"checked_file": "Vale.Inline.X64.Fadd_inline.fsti.checked",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fadd_inline.fsti"
} | [
"total"
] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | module Vale.Inline.X64.Fadd_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4} | false | true | Vale.Inline.X64.Fadd_inline.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 u512 : Type0 | [] | Vale.Inline.X64.Fadd_inline.u512 | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 47,
"end_line": 13,
"start_col": 11,
"start_line": 13
} |
|
Prims.GTot | val as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"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_nat (b:B.buffer UInt64.t{B.length b == 4}) (h:HS.mem) : GTot nat =
let s = B.as_seq h b in
let s0 = UInt64.v (Seq.index s 0) in
let s1 = UInt64.v (Seq.index s 1) in
let s2 = UInt64.v (Seq.index s 2) in
let s3 = UInt64.v (Seq.index s 3) in
pow2_four s0 s1 s2 s3 | val as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat
let as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat = | false | null | false | let s = B.as_seq h b in
let s0 = UInt64.v (Seq.index s 0) in
let s1 = UInt64.v (Seq.index s 1) in
let s2 = UInt64.v (Seq.index s 2) in
let s3 = UInt64.v (Seq.index s 3) in
pow2_four s0 s1 s2 s3 | {
"checked_file": "Vale.Inline.X64.Fadd_inline.fsti.checked",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fadd_inline.fsti"
} | [
"sometrivial"
] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"FStar.Monotonic.HyperStack.mem",
"Vale.Curve25519.Fast_defs.pow2_four",
"FStar.UInt.uint_t",
"FStar.UInt64.v",
"FStar.Seq.Base.index",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"Prims.nat"
] | [] | module Vale.Inline.X64.Fadd_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4}
unfold
let u512 = b:B.buffer UInt64.t{B.length b == 8}
unfold
let u1024 = b:B.buffer UInt64.t{B.length b == 16} | false | false | Vale.Inline.X64.Fadd_inline.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 as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat | [] | Vale.Inline.X64.Fadd_inline.as_nat | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b: LowStar.Buffer.buffer FStar.UInt64.t {LowStar.Monotonic.Buffer.length b == 4} ->
h: FStar.Monotonic.HyperStack.mem
-> Prims.GTot Prims.nat | {
"end_col": 23,
"end_line": 23,
"start_col": 73,
"start_line": 17
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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 absvar = binding | let absvar = | false | null | false | binding | {
"checked_file": "FStar.Tactics.PatternMatching.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.PatternMatching.fst"
} | [
"total"
] | [
"FStar.Tactics.NamedView.binding"
] | [] | (*
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.
*)
/// ==========================
/// Pattern-matching tactics
/// ==========================
///
/// :Author: Clément Pit-Claudel
/// :Contact: clement.pitclaudel@live.com
/// :Date: 2017-10-13
module FStar.Tactics.PatternMatching
open FStar.Tactics.V2
/// Contents
/// ========
///
/// 1 Contents
/// 2 Motivation
/// 3 Some utility functions
/// 4 Pattern types
/// 5 Pattern matching exceptions
/// 5.1 Types of exceptions
/// 5.2 The exception monad
/// 5.3 Liftings
/// 6 Pattern interpretation
/// 7 Pattern-matching problems
/// 7.1 Definitions
/// 7.2 Resolution
/// 8 A DSL for pattern-matching
/// 8.1 Pattern notations
/// 8.2 Problem notations
/// 8.3 Continuations
/// 9 Putting it all together
/// 10 Examples
/// 10.1 Simple examples
/// 10.2 A real-life example
/// 11 Possible extensions
/// 12 Notes
///
/// Motivation
/// ==========
///
/// Suppose you have a goal of the form ``squash (a == b)``. How do you capture
/// `a` and `b` for further inspection?
///
/// Here's a basic (but cumbersome!) implementation:
let fetch_eq_side () : Tac (term * term) =
let g = cur_goal () in
match inspect g with
| Tv_App squash (g, _) ->
(match inspect squash with
| Tv_UInst squash _
| Tv_FVar squash ->
if fv_to_string squash = flatten_name squash_qn then
(match inspect g with
| Tv_App eq_type_x (y, _) ->
(match inspect eq_type_x with
| Tv_App eq_type (x, _) ->
(match inspect eq_type with
| Tv_App eq (typ, _) ->
(match inspect eq with
| Tv_UInst eq _
| Tv_FVar eq ->
if fv_to_string eq = flatten_name eq2_qn then
(x, y)
else fail "not an equality"
| _ -> fail "not an app2 of fvar: ")
| _ -> fail "not an app3")
| _ -> fail "not an app2")
| _ -> fail "not an app under squash")
else fail "not a squash"
| _ -> fail "not an app of fvar at top level")
| _ -> fail "not an app at top level"
/// …and here's how you could use it:
(* let _ = *)
(* assert_by_tactic (1 + 1 == 2) *)
(* (fun () -> let l, r = fetch_eq_side () in *)
(* print (term_to_string l ^ " / " ^ term_to_string r)) *)
/// This file defines pattern-matching primitives that let you write the same
/// thing like this…
///
/// .. code:: fstar
///
/// let fetch_eq_side' #a () : Tac (term * term) =
/// gpm (fun (left right: a) (g: pm_goal (squash (left == right))) ->
/// (quote left, quote right) <: Tac (term * term))
///
/// let _ =
/// assert_by_tactic (1 + 1 == 2)
/// (fun () -> let l, r = fetch_eq_side' #int () in
/// print (term_to_string l ^ " / " ^ term_to_string r))
///
/// …or, more succinctly, like this:
///
/// .. code:: fstar
///
/// let _ =
/// assert_by_tactic (1 + 1 == 2)
/// (gpm (fun (left right: int) (g: pm_goal (squash (left == right))) ->
/// let l, r = quote left, quote right in
/// print (term_to_string l ^ " / " ^ term_to_string r) <: Tac unit))
/// Some utility functions
/// ======================
///
/// (Skip over this part on a quick read — these are just convenience functions)
(** Ensure that tactic `t` fails. **)
let mustfail #a (t: unit -> Tac a) (message: string) : Tac unit =
match trytac t with
| Some _ -> fail message
| None -> ()
/// The following two tactics are needed because of issues with the ``Tac``
/// effect.
let implies_intro' () : Tac unit =
let _ = implies_intro () in ()
let repeat' #a (f: unit -> Tac a) : Tac unit =
let _ = repeat f in ()
let and_elim' (h: binding) : Tac unit =
and_elim (pack (Tv_Var h));
clear h
(** Use a hypothesis at type a to satisfy a goal at type squash a *)
let exact_hyp (a: Type0) (h: namedv) : Tac unit =
let hd = quote (FStar.Squash.return_squash #a) in
exact (mk_app hd [((pack (Tv_Var h)), Q_Explicit)])
(** Use a hypothesis h (of type a) to satisfy a goal at type a *)
let exact_hyp' (h: namedv): Tac unit =
exact (pack (Tv_Var h))
/// Pattern types
/// =============
///
/// Patterns are defined using a simple inductive type, mirroring the structure
/// of ``term_view``.
type varname = string
type qn = string
type pattern =
| PVar: name: varname -> pattern
| PQn: qn: qn -> pattern
| PType: pattern
| PApp: hd: pattern -> arg: pattern -> pattern
let desc_of_pattern = function
| PVar _ -> "a variable"
| PQn qn -> "a constant (" ^ qn ^ ")"
| PType -> "Type"
| PApp _ _ -> "a function application"
let rec string_of_pattern = function
| PVar x -> "?" ^ x
| PQn qn -> qn
| PType -> "Type"
| PApp l r -> "(" ^ string_of_pattern l ^ " "
^ string_of_pattern r ^ ")"
/// Pattern matching exceptions
/// ===========================
///
/// Pattern-matching is defined as a pure, monadic function (because of issues
/// with combining DM4F effects, but also because it helps with debugging).
/// This section defines the exception monad.
///
/// Types of exceptions
/// -------------------
noeq type match_exception =
| NameMismatch of qn * qn
| SimpleMismatch of pattern * term
| NonLinearMismatch of varname * term * term
| UnsupportedTermInPattern of term
| IncorrectTypeInAbsPatBinder of typ
let term_head t : Tac string =
match inspect t with
| Tv_Var bv -> "Tv_Var"
| Tv_BVar fv -> "Tv_BVar"
| Tv_FVar fv -> "Tv_FVar"
| Tv_UInst _ _ -> "Tv_UInst"
| Tv_App f x -> "Tv_App"
| Tv_Abs x t -> "Tv_Abs"
| Tv_Arrow x t -> "Tv_Arrow"
| Tv_Type _ -> "Tv_Type"
| Tv_Refine x t -> "Tv_Refine"
| Tv_Const cst -> "Tv_Const"
| Tv_Uvar i t -> "Tv_Uvar"
| Tv_Let r attrs b t1 t2 -> "Tv_Let"
| Tv_Match t _ branches -> "Tv_Match"
| Tv_AscribedT _ _ _ _ -> "Tv_AscribedT"
| Tv_AscribedC _ _ _ _ -> "Tv_AscribedC"
| Tv_Unknown -> "Tv_Unknown"
| Tv_Unsupp -> "Tv_Unsupp"
let string_of_match_exception = function
| NameMismatch (qn1, qn2) ->
"Match failure (name mismatch): expecting " ^
qn1 ^ ", found " ^ qn2
| SimpleMismatch (pat, tm) ->
"Match failure (sort mismatch): expecting " ^
desc_of_pattern pat ^ ", got " ^ term_to_string tm
| NonLinearMismatch (nm, t1, t2) ->
"Match failure (nonlinear mismatch): variable " ^ nm ^
" needs to match both " ^ (term_to_string t1) ^
" and " ^ (term_to_string t2)
| UnsupportedTermInPattern tm ->
"Match failure (unsupported term in pattern): " ^
term_to_string tm ^ " (" ^ term_head tm ^ ")"
| IncorrectTypeInAbsPatBinder typ ->
"Incorrect type in pattern-matching binder: " ^
term_to_string typ ^ " (use one of ``var``, ``hyp …``, or ``goal …``)"
/// The exception monad
/// -------------------
noeq type match_res a =
| Success of a
| Failure of match_exception
let return #a (x: a) : match_res a =
Success x
let (let?) (#a #b: Type)
(f: match_res a)
(g: a -> Tac (match_res b))
: Tac (match_res b) =
match f with
| Success aa -> g aa
| Failure ex -> Failure ex
let raise #a (ex: match_exception) : match_res a =
Failure ex
/// Liftings
/// --------
///
/// There's a natural lifting from the exception monad into the tactic effect:
let lift_exn_tac #a #b (f: a -> match_res b) (aa: a) : Tac b =
match f aa with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
let lift_exn_tactic #a #b (f: a -> match_res b) (aa: a) : Tac b =
match f aa with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
/// Pattern interpretation
/// ======================
///
/// This section implement pattern-matching. This is strictly a one term, one
/// pattern implementation — handling cases in which mutliple hypotheses match
/// the same pattern is done later.
type bindings = list (varname * term)
let string_of_bindings (bindings: bindings) =
String.concat "\n"
(map (fun (nm, tm) -> (">> " ^ nm ^ ": " ^ term_to_string tm))
bindings)
(** Match a pattern against a term.
`cur_bindings` is a list of bindings collected while matching previous parts of
the pattern. Returns a result in the exception monad. **)
let rec interp_pattern_aux (pat: pattern) (cur_bindings: bindings) (tm:term)
: Tac (match_res bindings) =
let interp_var (v: varname) cur_bindings tm =
match List.Tot.Base.assoc v cur_bindings with
| Some tm' -> if term_eq tm tm' then return cur_bindings
else raise (NonLinearMismatch (v, tm, tm'))
| None -> return ((v, tm) :: cur_bindings) in
let interp_qn (qn: qn) cur_bindings tm =
match inspect tm with
| Tv_UInst fv _
| Tv_FVar fv ->
if fv_to_string fv = qn then return cur_bindings
else raise (NameMismatch (qn, (fv_to_string fv)))
| _ -> raise (SimpleMismatch (pat, tm)) in
let interp_type cur_bindings tm =
match inspect tm with
| Tv_Type _ -> return cur_bindings
| _ -> raise (SimpleMismatch (pat, tm)) in
let interp_app (p_hd p_arg: (p:pattern{p << pat})) cur_bindings tm =
match inspect tm with
| Tv_App hd (arg, _) ->
let? with_hd = interp_pattern_aux p_hd cur_bindings hd in
let? with_arg = interp_pattern_aux p_arg with_hd arg in
return with_arg
| _ -> raise (SimpleMismatch (pat, tm)) in
match pat with
| PVar var -> interp_var var cur_bindings tm
| PQn qn -> interp_qn qn cur_bindings tm
| PType -> interp_type cur_bindings tm
| PApp p_hd p_arg -> interp_app p_hd p_arg cur_bindings tm
(** Match a pattern `pat` against a term.
Returns a result in the exception monad. **)
let interp_pattern (pat: pattern) : term -> Tac (match_res bindings) =
fun (tm: term) ->
let? rev_bindings = interp_pattern_aux pat [] tm in
return (List.Tot.Base.rev rev_bindings)
(** Match a term `tm` against a pattern `pat`.
Raises an exception if the match fails. This is mostly useful for debugging:
use ``mgw`` to capture matches. **)
let match_term pat (tm : term) : Tac bindings =
match interp_pattern pat (norm_term [] tm) with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
/// Pattern-matching problems
/// =========================
///
/// Generalizing past single-term single-pattern problems, we obtain the
/// following notions of pattern-matching problems and solutions:
let debug msg : Tac unit = () // print msg
/// Definitions
/// ----------- | false | true | FStar.Tactics.PatternMatching.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 absvar : Type0 | [] | FStar.Tactics.PatternMatching.absvar | {
"file_name": "ulib/FStar.Tactics.PatternMatching.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Type0 | {
"end_col": 20,
"end_line": 349,
"start_col": 13,
"start_line": 349
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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 hyp_qn = `%hyp | let hyp_qn = | false | null | false | `%hyp | {
"checked_file": "FStar.Tactics.PatternMatching.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.PatternMatching.fst"
} | [
"total"
] | [] | [] | (*
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.
*)
/// ==========================
/// Pattern-matching tactics
/// ==========================
///
/// :Author: Clément Pit-Claudel
/// :Contact: clement.pitclaudel@live.com
/// :Date: 2017-10-13
module FStar.Tactics.PatternMatching
open FStar.Tactics.V2
/// Contents
/// ========
///
/// 1 Contents
/// 2 Motivation
/// 3 Some utility functions
/// 4 Pattern types
/// 5 Pattern matching exceptions
/// 5.1 Types of exceptions
/// 5.2 The exception monad
/// 5.3 Liftings
/// 6 Pattern interpretation
/// 7 Pattern-matching problems
/// 7.1 Definitions
/// 7.2 Resolution
/// 8 A DSL for pattern-matching
/// 8.1 Pattern notations
/// 8.2 Problem notations
/// 8.3 Continuations
/// 9 Putting it all together
/// 10 Examples
/// 10.1 Simple examples
/// 10.2 A real-life example
/// 11 Possible extensions
/// 12 Notes
///
/// Motivation
/// ==========
///
/// Suppose you have a goal of the form ``squash (a == b)``. How do you capture
/// `a` and `b` for further inspection?
///
/// Here's a basic (but cumbersome!) implementation:
let fetch_eq_side () : Tac (term * term) =
let g = cur_goal () in
match inspect g with
| Tv_App squash (g, _) ->
(match inspect squash with
| Tv_UInst squash _
| Tv_FVar squash ->
if fv_to_string squash = flatten_name squash_qn then
(match inspect g with
| Tv_App eq_type_x (y, _) ->
(match inspect eq_type_x with
| Tv_App eq_type (x, _) ->
(match inspect eq_type with
| Tv_App eq (typ, _) ->
(match inspect eq with
| Tv_UInst eq _
| Tv_FVar eq ->
if fv_to_string eq = flatten_name eq2_qn then
(x, y)
else fail "not an equality"
| _ -> fail "not an app2 of fvar: ")
| _ -> fail "not an app3")
| _ -> fail "not an app2")
| _ -> fail "not an app under squash")
else fail "not a squash"
| _ -> fail "not an app of fvar at top level")
| _ -> fail "not an app at top level"
/// …and here's how you could use it:
(* let _ = *)
(* assert_by_tactic (1 + 1 == 2) *)
(* (fun () -> let l, r = fetch_eq_side () in *)
(* print (term_to_string l ^ " / " ^ term_to_string r)) *)
/// This file defines pattern-matching primitives that let you write the same
/// thing like this…
///
/// .. code:: fstar
///
/// let fetch_eq_side' #a () : Tac (term * term) =
/// gpm (fun (left right: a) (g: pm_goal (squash (left == right))) ->
/// (quote left, quote right) <: Tac (term * term))
///
/// let _ =
/// assert_by_tactic (1 + 1 == 2)
/// (fun () -> let l, r = fetch_eq_side' #int () in
/// print (term_to_string l ^ " / " ^ term_to_string r))
///
/// …or, more succinctly, like this:
///
/// .. code:: fstar
///
/// let _ =
/// assert_by_tactic (1 + 1 == 2)
/// (gpm (fun (left right: int) (g: pm_goal (squash (left == right))) ->
/// let l, r = quote left, quote right in
/// print (term_to_string l ^ " / " ^ term_to_string r) <: Tac unit))
/// Some utility functions
/// ======================
///
/// (Skip over this part on a quick read — these are just convenience functions)
(** Ensure that tactic `t` fails. **)
let mustfail #a (t: unit -> Tac a) (message: string) : Tac unit =
match trytac t with
| Some _ -> fail message
| None -> ()
/// The following two tactics are needed because of issues with the ``Tac``
/// effect.
let implies_intro' () : Tac unit =
let _ = implies_intro () in ()
let repeat' #a (f: unit -> Tac a) : Tac unit =
let _ = repeat f in ()
let and_elim' (h: binding) : Tac unit =
and_elim (pack (Tv_Var h));
clear h
(** Use a hypothesis at type a to satisfy a goal at type squash a *)
let exact_hyp (a: Type0) (h: namedv) : Tac unit =
let hd = quote (FStar.Squash.return_squash #a) in
exact (mk_app hd [((pack (Tv_Var h)), Q_Explicit)])
(** Use a hypothesis h (of type a) to satisfy a goal at type a *)
let exact_hyp' (h: namedv): Tac unit =
exact (pack (Tv_Var h))
/// Pattern types
/// =============
///
/// Patterns are defined using a simple inductive type, mirroring the structure
/// of ``term_view``.
type varname = string
type qn = string
type pattern =
| PVar: name: varname -> pattern
| PQn: qn: qn -> pattern
| PType: pattern
| PApp: hd: pattern -> arg: pattern -> pattern
let desc_of_pattern = function
| PVar _ -> "a variable"
| PQn qn -> "a constant (" ^ qn ^ ")"
| PType -> "Type"
| PApp _ _ -> "a function application"
let rec string_of_pattern = function
| PVar x -> "?" ^ x
| PQn qn -> qn
| PType -> "Type"
| PApp l r -> "(" ^ string_of_pattern l ^ " "
^ string_of_pattern r ^ ")"
/// Pattern matching exceptions
/// ===========================
///
/// Pattern-matching is defined as a pure, monadic function (because of issues
/// with combining DM4F effects, but also because it helps with debugging).
/// This section defines the exception monad.
///
/// Types of exceptions
/// -------------------
noeq type match_exception =
| NameMismatch of qn * qn
| SimpleMismatch of pattern * term
| NonLinearMismatch of varname * term * term
| UnsupportedTermInPattern of term
| IncorrectTypeInAbsPatBinder of typ
let term_head t : Tac string =
match inspect t with
| Tv_Var bv -> "Tv_Var"
| Tv_BVar fv -> "Tv_BVar"
| Tv_FVar fv -> "Tv_FVar"
| Tv_UInst _ _ -> "Tv_UInst"
| Tv_App f x -> "Tv_App"
| Tv_Abs x t -> "Tv_Abs"
| Tv_Arrow x t -> "Tv_Arrow"
| Tv_Type _ -> "Tv_Type"
| Tv_Refine x t -> "Tv_Refine"
| Tv_Const cst -> "Tv_Const"
| Tv_Uvar i t -> "Tv_Uvar"
| Tv_Let r attrs b t1 t2 -> "Tv_Let"
| Tv_Match t _ branches -> "Tv_Match"
| Tv_AscribedT _ _ _ _ -> "Tv_AscribedT"
| Tv_AscribedC _ _ _ _ -> "Tv_AscribedC"
| Tv_Unknown -> "Tv_Unknown"
| Tv_Unsupp -> "Tv_Unsupp"
let string_of_match_exception = function
| NameMismatch (qn1, qn2) ->
"Match failure (name mismatch): expecting " ^
qn1 ^ ", found " ^ qn2
| SimpleMismatch (pat, tm) ->
"Match failure (sort mismatch): expecting " ^
desc_of_pattern pat ^ ", got " ^ term_to_string tm
| NonLinearMismatch (nm, t1, t2) ->
"Match failure (nonlinear mismatch): variable " ^ nm ^
" needs to match both " ^ (term_to_string t1) ^
" and " ^ (term_to_string t2)
| UnsupportedTermInPattern tm ->
"Match failure (unsupported term in pattern): " ^
term_to_string tm ^ " (" ^ term_head tm ^ ")"
| IncorrectTypeInAbsPatBinder typ ->
"Incorrect type in pattern-matching binder: " ^
term_to_string typ ^ " (use one of ``var``, ``hyp …``, or ``goal …``)"
/// The exception monad
/// -------------------
noeq type match_res a =
| Success of a
| Failure of match_exception
let return #a (x: a) : match_res a =
Success x
let (let?) (#a #b: Type)
(f: match_res a)
(g: a -> Tac (match_res b))
: Tac (match_res b) =
match f with
| Success aa -> g aa
| Failure ex -> Failure ex
let raise #a (ex: match_exception) : match_res a =
Failure ex
/// Liftings
/// --------
///
/// There's a natural lifting from the exception monad into the tactic effect:
let lift_exn_tac #a #b (f: a -> match_res b) (aa: a) : Tac b =
match f aa with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
let lift_exn_tactic #a #b (f: a -> match_res b) (aa: a) : Tac b =
match f aa with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
/// Pattern interpretation
/// ======================
///
/// This section implement pattern-matching. This is strictly a one term, one
/// pattern implementation — handling cases in which mutliple hypotheses match
/// the same pattern is done later.
type bindings = list (varname * term)
let string_of_bindings (bindings: bindings) =
String.concat "\n"
(map (fun (nm, tm) -> (">> " ^ nm ^ ": " ^ term_to_string tm))
bindings)
(** Match a pattern against a term.
`cur_bindings` is a list of bindings collected while matching previous parts of
the pattern. Returns a result in the exception monad. **)
let rec interp_pattern_aux (pat: pattern) (cur_bindings: bindings) (tm:term)
: Tac (match_res bindings) =
let interp_var (v: varname) cur_bindings tm =
match List.Tot.Base.assoc v cur_bindings with
| Some tm' -> if term_eq tm tm' then return cur_bindings
else raise (NonLinearMismatch (v, tm, tm'))
| None -> return ((v, tm) :: cur_bindings) in
let interp_qn (qn: qn) cur_bindings tm =
match inspect tm with
| Tv_UInst fv _
| Tv_FVar fv ->
if fv_to_string fv = qn then return cur_bindings
else raise (NameMismatch (qn, (fv_to_string fv)))
| _ -> raise (SimpleMismatch (pat, tm)) in
let interp_type cur_bindings tm =
match inspect tm with
| Tv_Type _ -> return cur_bindings
| _ -> raise (SimpleMismatch (pat, tm)) in
let interp_app (p_hd p_arg: (p:pattern{p << pat})) cur_bindings tm =
match inspect tm with
| Tv_App hd (arg, _) ->
let? with_hd = interp_pattern_aux p_hd cur_bindings hd in
let? with_arg = interp_pattern_aux p_arg with_hd arg in
return with_arg
| _ -> raise (SimpleMismatch (pat, tm)) in
match pat with
| PVar var -> interp_var var cur_bindings tm
| PQn qn -> interp_qn qn cur_bindings tm
| PType -> interp_type cur_bindings tm
| PApp p_hd p_arg -> interp_app p_hd p_arg cur_bindings tm
(** Match a pattern `pat` against a term.
Returns a result in the exception monad. **)
let interp_pattern (pat: pattern) : term -> Tac (match_res bindings) =
fun (tm: term) ->
let? rev_bindings = interp_pattern_aux pat [] tm in
return (List.Tot.Base.rev rev_bindings)
(** Match a term `tm` against a pattern `pat`.
Raises an exception if the match fails. This is mostly useful for debugging:
use ``mgw`` to capture matches. **)
let match_term pat (tm : term) : Tac bindings =
match interp_pattern pat (norm_term [] tm) with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
/// Pattern-matching problems
/// =========================
///
/// Generalizing past single-term single-pattern problems, we obtain the
/// following notions of pattern-matching problems and solutions:
let debug msg : Tac unit = () // print msg
/// Definitions
/// -----------
let absvar = binding
type hypothesis = binding
/// A matching problem is composed of holes (``mp_vars``), hypothesis patterns
/// (``mp_hyps``), and a goal pattern (``mp_goal``).
noeq type matching_problem =
{ mp_vars: list varname;
mp_hyps: list (varname * pattern);
mp_goal: option pattern }
let string_of_matching_problem mp =
let vars =
String.concat ", " mp.mp_vars in
let hyps =
String.concat "\n "
(List.Tot.Base.map (fun (nm, pat) ->
nm ^ ": " ^ (string_of_pattern pat)) mp.mp_hyps) in
let goal = match mp.mp_goal with
| None -> "_"
| Some pat -> string_of_pattern pat in
"\n{ vars: " ^ vars ^ "\n" ^
" hyps: " ^ hyps ^ "\n" ^
" goal: " ^ goal ^ " }"
/// A solution is composed of terms captured to mach the holes, and binders
/// captured to match hypothesis patterns.
noeq type matching_solution =
{ ms_vars: list (varname * term);
ms_hyps: list (varname * hypothesis) }
let string_of_matching_solution ms =
let vars =
String.concat "\n "
(map (fun (varname, tm) ->
varname ^ ": " ^ (term_to_string tm)) ms.ms_vars) in
let hyps =
String.concat "\n "
(map (fun (nm, binding) ->
nm ^ ": " ^ (binding_to_string binding)) ms.ms_hyps) in
"\n{ vars: " ^ vars ^ "\n" ^
" hyps: " ^ hyps ^ " }"
(** Find a varname in an association list; fail if it can't be found. **)
let assoc_varname_fail (#b: Type) (key: varname) (ls: list (varname * b))
: Tac b =
match List.Tot.Base.assoc key ls with
| None -> fail ("Not found: " ^ key)
| Some x -> x
let ms_locate_hyp (a: Type) (solution: matching_solution)
(name: varname) : Tac hypothesis =
assoc_varname_fail name solution.ms_hyps
let ms_locate_var (a: Type) (solution: matching_solution)
(name: varname) : Tac a =
unquote #a (assoc_varname_fail name solution.ms_vars)
let ms_locate_unit (a: Type) _solution _binder_name : Tac unit =
()
/// Resolution
/// ----------
///
/// Solving a matching problem is a two-steps process: find an initial
/// assignment for holes based on the goal pattern, then find a set of
/// hypotheses matching hypothesis patterns.
///
/// Note that the implementation takes a continuation of type
/// ``matching_solution -> Tac a``. This continuation is needed because we want
/// users to be able to provide extra criteria on matching solutions (most
/// commonly, this criterion is that a particular tactic should run
/// successfuly).
///
/// This makes it easy to implement a simple for of search through the context,
/// where one can find a hypothesis matching a particular predicate by
/// constructing a trivial matching problem and passing the predicate as the
/// continuation.
(** Scan ``hypotheses`` for a match for ``pat`` that lets ``body`` succeed.
``name`` is used to refer to the hypothesis matched in the final solution.
``part_sol`` includes bindings gathered while matching previous solutions. **)
let rec solve_mp_for_single_hyp #a
(name: varname)
(pat: pattern)
(hypotheses: list hypothesis)
(body: matching_solution -> Tac a)
(part_sol: matching_solution)
: Tac a =
match hypotheses with
| [] ->
fail #a "No matching hypothesis"
| h :: hs ->
or_else // Must be in ``Tac`` here to run `body`
(fun () ->
match interp_pattern_aux pat part_sol.ms_vars (type_of_binding h) with
| Failure ex ->
fail ("Failed to match hyp: " ^ (string_of_match_exception ex))
| Success bindings ->
let ms_hyps = (name, h) :: part_sol.ms_hyps in
body ({ part_sol with ms_vars = bindings; ms_hyps = ms_hyps }))
(fun () ->
solve_mp_for_single_hyp name pat hs body part_sol)
(** Scan ``hypotheses`` for matches for ``mp_hyps`` that lets ``body``
succeed. **)
let rec solve_mp_for_hyps #a
(mp_hyps: list (varname * pattern))
(hypotheses: list hypothesis)
(body: matching_solution -> Tac a)
(partial_solution: matching_solution)
: Tac a =
match mp_hyps with
| [] -> body partial_solution
| (name, pat) :: pats ->
solve_mp_for_single_hyp name pat hypotheses
(solve_mp_for_hyps pats hypotheses body)
partial_solution
(** Solve a matching problem.
The solution returned is constructed to ensure that the continuation ``body``
succeeds: this implements the usual backtracking-match semantics. **)
let solve_mp #a (problem: matching_problem)
(hypotheses: list hypothesis) (goal: term)
(body: matching_solution -> Tac a)
: Tac a =
let goal_ps =
match problem.mp_goal with
| None -> { ms_vars = []; ms_hyps = [] }
| Some pat ->
match interp_pattern pat goal with
| Failure ex -> fail ("Failed to match goal: " ^ (string_of_match_exception ex))
| Success bindings -> { ms_vars = bindings; ms_hyps = [] } in
solve_mp_for_hyps #a problem.mp_hyps hypotheses body goal_ps
/// A DSL for pattern-matching
/// ==========================
///
/// Using pattern-matching problems as defined above is relatively cumbersome,
/// so we now introduce a lightweight notation, in two steps: pattern notations,
/// and matching-problem notations.
///
/// Pattern notations
/// -----------------
///
/// The first part of our pattern-matching syntax is pattern notations: we
/// provide a reflective function which constructs a pattern from a term:
/// variables are holes, free variables are constants, and applications are
/// application patterns.
(* FIXME: MOVE *)
let name_of_namedv (x:namedv) : Tac string =
unseal (inspect_namedv x).ppname
(** Compile a term `tm` into a pattern. **)
let rec pattern_of_term_ex tm : Tac (match_res pattern) =
match inspect tm with
| Tv_Var bv ->
return (PVar (name_of_namedv bv))
| Tv_FVar fv
| Tv_UInst fv _ ->
let qn = fv_to_string fv in
return (PQn qn)
| Tv_Type _ ->
return PType
| Tv_App f (x, _) ->
let? fpat = pattern_of_term_ex f in
let? xpat = pattern_of_term_ex x in
return (PApp fpat xpat)
| _ -> raise (UnsupportedTermInPattern tm)
(** β-reduce a term `tm`.
This is useful to remove needles function applications introduced by F*, like
``(fun a b c -> a) 1 2 3``. **)
let beta_reduce (tm: term) : Tac term =
norm_term [] tm
(** Compile a term `tm` into a pattern. **)
let pattern_of_term tm : Tac pattern =
match pattern_of_term_ex tm with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
/// Problem notations
/// -----------------
///
/// We then introduce a DSL for matching problems, best explained on the
/// following example::
///
/// (fun (a b c: ①) (h1 h2 h3: hyp ②) (g: pm_goal ③) → ④)
///
/// This notation is intended to express a pattern-matching problems with three
/// holes ``a``, ``b``, and ``c`` of type ①, matching hypotheses ``h1``, ``h2``,
/// and ``h3`` against pattern ② and the goal against the pattern ③. The body
/// of the notation (④) is then run with appropriate terms bound to ``a``,
/// ``b``, and ``c``, appropriate binders bound to ``h1``, ``h2``, and ``h3``,
/// and ``()`` bound to ``g``.
///
/// We call these patterns ``abspat``s (abstraction patterns), and we provide
/// facilities to parse them into matching problems, and to run their bodies
/// against a particular matching solution.
// We used to annotate variables with an explicit 'var' marker, but then that
// var annotation leaked into the types of other hypotheses due to type
// inference, requiring non-trivial normalization.
// let var (a: Type) = a
let hyp (a: Type) = binding
let pm_goal (a: Type) = unit | false | true | FStar.Tactics.PatternMatching.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 hyp_qn : Prims.string | [] | FStar.Tactics.PatternMatching.hyp_qn | {
"file_name": "ulib/FStar.Tactics.PatternMatching.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.string | {
"end_col": 19,
"end_line": 562,
"start_col": 16,
"start_line": 562
} |
|
FStar.Tactics.Effect.Tac | val interp_pattern: pat: pattern -> term -> Tac (match_res bindings) | [
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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 interp_pattern (pat: pattern) : term -> Tac (match_res bindings) =
fun (tm: term) ->
let? rev_bindings = interp_pattern_aux pat [] tm in
return (List.Tot.Base.rev rev_bindings) | val interp_pattern: pat: pattern -> term -> Tac (match_res bindings)
let interp_pattern (pat: pattern) : term -> Tac (match_res bindings) = | true | null | false | fun (tm: term) ->
let? rev_bindings = interp_pattern_aux pat [] tm in
return (List.Tot.Base.rev rev_bindings) | {
"checked_file": "FStar.Tactics.PatternMatching.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.PatternMatching.fst"
} | [] | [
"FStar.Tactics.PatternMatching.pattern",
"FStar.Tactics.NamedView.term",
"FStar.Tactics.PatternMatching.op_let_Question",
"FStar.Tactics.PatternMatching.bindings",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.PatternMatching.varname",
"FStar.Tactics.PatternMatching.return",
"FStar.List.Tot.Base.rev",
"FStar.Tactics.PatternMatching.match_res",
"FStar.Tactics.PatternMatching.interp_pattern_aux",
"Prims.Nil"
] | [] | (*
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.
*)
/// ==========================
/// Pattern-matching tactics
/// ==========================
///
/// :Author: Clément Pit-Claudel
/// :Contact: clement.pitclaudel@live.com
/// :Date: 2017-10-13
module FStar.Tactics.PatternMatching
open FStar.Tactics.V2
/// Contents
/// ========
///
/// 1 Contents
/// 2 Motivation
/// 3 Some utility functions
/// 4 Pattern types
/// 5 Pattern matching exceptions
/// 5.1 Types of exceptions
/// 5.2 The exception monad
/// 5.3 Liftings
/// 6 Pattern interpretation
/// 7 Pattern-matching problems
/// 7.1 Definitions
/// 7.2 Resolution
/// 8 A DSL for pattern-matching
/// 8.1 Pattern notations
/// 8.2 Problem notations
/// 8.3 Continuations
/// 9 Putting it all together
/// 10 Examples
/// 10.1 Simple examples
/// 10.2 A real-life example
/// 11 Possible extensions
/// 12 Notes
///
/// Motivation
/// ==========
///
/// Suppose you have a goal of the form ``squash (a == b)``. How do you capture
/// `a` and `b` for further inspection?
///
/// Here's a basic (but cumbersome!) implementation:
let fetch_eq_side () : Tac (term * term) =
let g = cur_goal () in
match inspect g with
| Tv_App squash (g, _) ->
(match inspect squash with
| Tv_UInst squash _
| Tv_FVar squash ->
if fv_to_string squash = flatten_name squash_qn then
(match inspect g with
| Tv_App eq_type_x (y, _) ->
(match inspect eq_type_x with
| Tv_App eq_type (x, _) ->
(match inspect eq_type with
| Tv_App eq (typ, _) ->
(match inspect eq with
| Tv_UInst eq _
| Tv_FVar eq ->
if fv_to_string eq = flatten_name eq2_qn then
(x, y)
else fail "not an equality"
| _ -> fail "not an app2 of fvar: ")
| _ -> fail "not an app3")
| _ -> fail "not an app2")
| _ -> fail "not an app under squash")
else fail "not a squash"
| _ -> fail "not an app of fvar at top level")
| _ -> fail "not an app at top level"
/// …and here's how you could use it:
(* let _ = *)
(* assert_by_tactic (1 + 1 == 2) *)
(* (fun () -> let l, r = fetch_eq_side () in *)
(* print (term_to_string l ^ " / " ^ term_to_string r)) *)
/// This file defines pattern-matching primitives that let you write the same
/// thing like this…
///
/// .. code:: fstar
///
/// let fetch_eq_side' #a () : Tac (term * term) =
/// gpm (fun (left right: a) (g: pm_goal (squash (left == right))) ->
/// (quote left, quote right) <: Tac (term * term))
///
/// let _ =
/// assert_by_tactic (1 + 1 == 2)
/// (fun () -> let l, r = fetch_eq_side' #int () in
/// print (term_to_string l ^ " / " ^ term_to_string r))
///
/// …or, more succinctly, like this:
///
/// .. code:: fstar
///
/// let _ =
/// assert_by_tactic (1 + 1 == 2)
/// (gpm (fun (left right: int) (g: pm_goal (squash (left == right))) ->
/// let l, r = quote left, quote right in
/// print (term_to_string l ^ " / " ^ term_to_string r) <: Tac unit))
/// Some utility functions
/// ======================
///
/// (Skip over this part on a quick read — these are just convenience functions)
(** Ensure that tactic `t` fails. **)
let mustfail #a (t: unit -> Tac a) (message: string) : Tac unit =
match trytac t with
| Some _ -> fail message
| None -> ()
/// The following two tactics are needed because of issues with the ``Tac``
/// effect.
let implies_intro' () : Tac unit =
let _ = implies_intro () in ()
let repeat' #a (f: unit -> Tac a) : Tac unit =
let _ = repeat f in ()
let and_elim' (h: binding) : Tac unit =
and_elim (pack (Tv_Var h));
clear h
(** Use a hypothesis at type a to satisfy a goal at type squash a *)
let exact_hyp (a: Type0) (h: namedv) : Tac unit =
let hd = quote (FStar.Squash.return_squash #a) in
exact (mk_app hd [((pack (Tv_Var h)), Q_Explicit)])
(** Use a hypothesis h (of type a) to satisfy a goal at type a *)
let exact_hyp' (h: namedv): Tac unit =
exact (pack (Tv_Var h))
/// Pattern types
/// =============
///
/// Patterns are defined using a simple inductive type, mirroring the structure
/// of ``term_view``.
type varname = string
type qn = string
type pattern =
| PVar: name: varname -> pattern
| PQn: qn: qn -> pattern
| PType: pattern
| PApp: hd: pattern -> arg: pattern -> pattern
let desc_of_pattern = function
| PVar _ -> "a variable"
| PQn qn -> "a constant (" ^ qn ^ ")"
| PType -> "Type"
| PApp _ _ -> "a function application"
let rec string_of_pattern = function
| PVar x -> "?" ^ x
| PQn qn -> qn
| PType -> "Type"
| PApp l r -> "(" ^ string_of_pattern l ^ " "
^ string_of_pattern r ^ ")"
/// Pattern matching exceptions
/// ===========================
///
/// Pattern-matching is defined as a pure, monadic function (because of issues
/// with combining DM4F effects, but also because it helps with debugging).
/// This section defines the exception monad.
///
/// Types of exceptions
/// -------------------
noeq type match_exception =
| NameMismatch of qn * qn
| SimpleMismatch of pattern * term
| NonLinearMismatch of varname * term * term
| UnsupportedTermInPattern of term
| IncorrectTypeInAbsPatBinder of typ
let term_head t : Tac string =
match inspect t with
| Tv_Var bv -> "Tv_Var"
| Tv_BVar fv -> "Tv_BVar"
| Tv_FVar fv -> "Tv_FVar"
| Tv_UInst _ _ -> "Tv_UInst"
| Tv_App f x -> "Tv_App"
| Tv_Abs x t -> "Tv_Abs"
| Tv_Arrow x t -> "Tv_Arrow"
| Tv_Type _ -> "Tv_Type"
| Tv_Refine x t -> "Tv_Refine"
| Tv_Const cst -> "Tv_Const"
| Tv_Uvar i t -> "Tv_Uvar"
| Tv_Let r attrs b t1 t2 -> "Tv_Let"
| Tv_Match t _ branches -> "Tv_Match"
| Tv_AscribedT _ _ _ _ -> "Tv_AscribedT"
| Tv_AscribedC _ _ _ _ -> "Tv_AscribedC"
| Tv_Unknown -> "Tv_Unknown"
| Tv_Unsupp -> "Tv_Unsupp"
let string_of_match_exception = function
| NameMismatch (qn1, qn2) ->
"Match failure (name mismatch): expecting " ^
qn1 ^ ", found " ^ qn2
| SimpleMismatch (pat, tm) ->
"Match failure (sort mismatch): expecting " ^
desc_of_pattern pat ^ ", got " ^ term_to_string tm
| NonLinearMismatch (nm, t1, t2) ->
"Match failure (nonlinear mismatch): variable " ^ nm ^
" needs to match both " ^ (term_to_string t1) ^
" and " ^ (term_to_string t2)
| UnsupportedTermInPattern tm ->
"Match failure (unsupported term in pattern): " ^
term_to_string tm ^ " (" ^ term_head tm ^ ")"
| IncorrectTypeInAbsPatBinder typ ->
"Incorrect type in pattern-matching binder: " ^
term_to_string typ ^ " (use one of ``var``, ``hyp …``, or ``goal …``)"
/// The exception monad
/// -------------------
noeq type match_res a =
| Success of a
| Failure of match_exception
let return #a (x: a) : match_res a =
Success x
let (let?) (#a #b: Type)
(f: match_res a)
(g: a -> Tac (match_res b))
: Tac (match_res b) =
match f with
| Success aa -> g aa
| Failure ex -> Failure ex
let raise #a (ex: match_exception) : match_res a =
Failure ex
/// Liftings
/// --------
///
/// There's a natural lifting from the exception monad into the tactic effect:
let lift_exn_tac #a #b (f: a -> match_res b) (aa: a) : Tac b =
match f aa with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
let lift_exn_tactic #a #b (f: a -> match_res b) (aa: a) : Tac b =
match f aa with
| Success bb -> bb
| Failure ex -> Tactics.fail (string_of_match_exception ex)
/// Pattern interpretation
/// ======================
///
/// This section implement pattern-matching. This is strictly a one term, one
/// pattern implementation — handling cases in which mutliple hypotheses match
/// the same pattern is done later.
type bindings = list (varname * term)
let string_of_bindings (bindings: bindings) =
String.concat "\n"
(map (fun (nm, tm) -> (">> " ^ nm ^ ": " ^ term_to_string tm))
bindings)
(** Match a pattern against a term.
`cur_bindings` is a list of bindings collected while matching previous parts of
the pattern. Returns a result in the exception monad. **)
let rec interp_pattern_aux (pat: pattern) (cur_bindings: bindings) (tm:term)
: Tac (match_res bindings) =
let interp_var (v: varname) cur_bindings tm =
match List.Tot.Base.assoc v cur_bindings with
| Some tm' -> if term_eq tm tm' then return cur_bindings
else raise (NonLinearMismatch (v, tm, tm'))
| None -> return ((v, tm) :: cur_bindings) in
let interp_qn (qn: qn) cur_bindings tm =
match inspect tm with
| Tv_UInst fv _
| Tv_FVar fv ->
if fv_to_string fv = qn then return cur_bindings
else raise (NameMismatch (qn, (fv_to_string fv)))
| _ -> raise (SimpleMismatch (pat, tm)) in
let interp_type cur_bindings tm =
match inspect tm with
| Tv_Type _ -> return cur_bindings
| _ -> raise (SimpleMismatch (pat, tm)) in
let interp_app (p_hd p_arg: (p:pattern{p << pat})) cur_bindings tm =
match inspect tm with
| Tv_App hd (arg, _) ->
let? with_hd = interp_pattern_aux p_hd cur_bindings hd in
let? with_arg = interp_pattern_aux p_arg with_hd arg in
return with_arg
| _ -> raise (SimpleMismatch (pat, tm)) in
match pat with
| PVar var -> interp_var var cur_bindings tm
| PQn qn -> interp_qn qn cur_bindings tm
| PType -> interp_type cur_bindings tm
| PApp p_hd p_arg -> interp_app p_hd p_arg cur_bindings tm
(** Match a pattern `pat` against a term.
Returns a result in the exception monad. **) | false | false | FStar.Tactics.PatternMatching.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 interp_pattern: pat: pattern -> term -> Tac (match_res bindings) | [] | FStar.Tactics.PatternMatching.interp_pattern | {
"file_name": "ulib/FStar.Tactics.PatternMatching.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | pat: FStar.Tactics.PatternMatching.pattern -> _: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac
(FStar.Tactics.PatternMatching.match_res FStar.Tactics.PatternMatching.bindings) | {
"end_col": 43,
"end_line": 328,
"start_col": 2,
"start_line": 326
} |
Proof Oriented Programming with AI (PoPAI) - FStarDataSet
This dataset contains programs and proofs in F* proof-oriented programming language. The data, proposed in Towards Neural Synthesis for SMT-Assisted Proof-Oriented Programming, is an archive of source code, build artifacts, and metadata assembled from eight different F⋆-based open source projects on GitHub.
Primary-Objective
This dataset's primary objective is to train and evaluate Proof-oriented Programming with AI (PoPAI, in short). Given a specification of a program and proof in F*, the objective of a AI model is to synthesize the implemantation (see below for details about the usage of this dataset, including the input and output).
Data Format
Each of the examples in this dataset are organized as dictionaries with the following schema
{
"file_name": <str: Name of the file>,
"name": <str: name of the example, can be used to uniquely identify the example>,
"original_source_type": <str: actual source type, to be used for type checking>,
"source_type": <str: modified source type, to be used to formulate prompt>,
"source_definition": <str: target definition>,
"source": <dict: contains metadata about the source of this example, including project_name, git url, git sha, etc.>,
"source_range": <dict: metadata containing start and end lines and columns of this definition in the source file>,
"file_context": <str: extracted file context upto the point of current definition>,
"dependencies": <dict: build dependencies for this file>,
"opens_and_abbrevs": <list[dict]: List of opened modules and abbreviated modules in the file, necessary for evaluation.>,
"vconfig": <dict: SMT solver flags for this definition>,
"interleaved": <bool: whether this definition is interleaved from the interface file>,
"verbose_type": <str: the verbose type of this definition as resolved by the type checker>,
"effect": <str: effect>,
"effect_flags": <list[str]: any effect flags>,
"mutual_with": <list: if this definition is mutually recursive with another, list of those names>,
"ideal_premises": <list[str]: Other definitions that are used in the ground truth definition>,
"proof_features": <list[str]>,
"is_simple_lemma": <bool/null>,
"is_div": <bool: if this definition has the divergent effect>,
"is_proof": <bool>,
"is_simply_typed": <bool>,
"is_type": <bool/null>,
"partial_definition": <str>,
"completed_definiton": <str>,
"isa_cross_project_example": <bool: if this example belongs to the cross-project evaluation set>
}
Usage
To use this dataset with datasets
,
from datasets import load_dataset
data = load_dataset("microsoft/FStarDataSet")
train_data = data["train"]
eval_data = data["validation"]
test_data = data["test"]
intra_project_test = test_data.filter(lambda x: x["isa_cross_project_example"] == False)
cross_project_test = test_data.filter(lambda x: x["isa_cross_project_example"] == True)
Input
The primary input for generating F* definition is source_type
.
All other information in an example may be used directly or to derive an input except
source_definition
, ideal_premises
, and completed_definiton
.
Output
The primary output is source_definition
, which is the ground truth definition, that can be evaluated with the proof checker.
The completed_definiton
may be used as ground truth when a model is used as a text completion setting (though the evaluator does not support evaluation in this setting).
In addition, ideal_premises
may be used for evaluating premise selection models.
Evaluation on this dataset
Generated F* definitions should be evaluated the proof checker tool from https://github.com/FStarLang/fstar_dataset/releases/tag/eval-v1.0.
Download the source code and the helpers.zip
file from the release.
Troubleshooting
The attached binaries in the evaluator (i.e., fstar.exe
and z3
) are built on
Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-189-generic x86_64)
, gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2)
, OCaml 4.12.0
.
If any of the binaries do not work properly, build F* from commit: f3b4db2ebce90020acbbbe1b4ea0d05d3e69ad6c
from the F* repository, using the installation guide.
Data Source
The raw data in this project are collected from eight open-source F* repositories on GitHib
- FStar: The F⋆ compiler itself, including its standard library and examples.
- Karamel: A transpiler from a subset of F⋆ called Low* to C, including libraries to work with a model of C types and control structures, e.g., for- and while-loops.
- EverParse: A parser generator for binary formats, used in various large scale systems, e.g., the Windows kernel.
- HACL*: A library of verified cryptographic algorithms, including ValeCrypt, a library of verified assembly code, as well as EverCrypt, a cryptographic provider, including code deployed in Linux, Firefox, and Python.
- Merkle-tree: A verified, incremental Merkle tree, designed for use in Azure CCF, a confidential computing system.
- Steel: A concurrent separation logic library, with proofs of data structures and concurrency primitives.
- miTLS-F*: A partially verified reference implementation of the TLS protocol.
- EverQuic-Crypto: A verified implementation of header and packet protection for the QUIC protocol.
Limitations
TDB
Citation
@inproceedings{chakraborty2024towards,
title={Towards Neural Synthesis for SMT-Assisted Proof-Oriented Programming},
author={Chakraborty, Saikat and Ebner, Gabriel and Bhat, Siddharth and Fakhoury, Sarah and Fatima, Sakina and Lahiri, Shuvendu and Swamy, Nikhil},
booktitle={Proceedings of the IEEE/ACM 47th International Conference on Software Engineering (To Appear)},
pages={1--12},
year={2025}
}
- Downloads last month
- 92