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.Pure | val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags | val maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags)
let maintained_of new_flags flags = | false | null | false | Lemmas.overflow new_flags = Lemmas.overflow flags | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Flags.t",
"Prims.op_Equality",
"Vale.X64.Flags.flag_val_t",
"Vale.X64.Lemmas.overflow",
"Prims.bool"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 maintained_of (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> overflow new_flags == overflow flags /\ valid_of new_flags == valid_of flags) | [] | Vale.X64.Decls.maintained_of | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | new_flags: Vale.X64.Flags.t -> flags: Vale.X64.Flags.t -> Prims.Pure Prims.bool | {
"end_col": 85,
"end_line": 25,
"start_col": 36,
"start_line": 25
} |
FStar.Pervasives.Lemma | val va_lemma_ifElseTrue_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
eval_ocmp s0 ifb /\
eval_code ct ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total | val va_lemma_ifElseTrue_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
eval_ocmp s0 ifb /\
eval_code ct ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
)
let va_lemma_ifElseTrue_total = | false | null | true | Lemmas.lemma_ifElseTrue_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"lemma"
] | [
"Vale.X64.Lemmas.lemma_ifElseTrue_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_ifElseTrue_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
eval_ocmp s0 ifb /\
eval_code ct ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
) | [] | Vale.X64.Decls.va_lemma_ifElseTrue_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ifb: Vale.X64.Decls.ocmp ->
ct: Vale.X64.Decls.va_code ->
cf: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state
-> FStar.Pervasives.Lemma
(requires
Vale.X64.Decls.valid_ocmp ifb s0 /\ Vale.X64.Decls.eval_ocmp s0 ifb /\
Vale.X64.Decls.eval_code ct
(Vale.X64.State.Mkvale_state (Mkvale_state?.vs_ok s0)
(Mkvale_state?.vs_regs s0)
Vale.X64.Decls.havoc_flags
(Mkvale_state?.vs_heap s0)
(Mkvale_state?.vs_stack s0)
(Mkvale_state?.vs_stackTaint s0))
f0
sM) (ensures Vale.X64.Decls.eval_code (Vale.X64.Machine_s.IfElse ifb ct cf) s0 f0 sM) | {
"end_col": 61,
"end_line": 137,
"start_col": 32,
"start_line": 137
} |
Prims.Ghost | val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)
(requires True)
(ensures (fun (sM, fM) ->
s0 == sM /\
eval_code (va_Block []) s0 fM sM
)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_empty_total = Lemmas.lemma_empty_total | val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)
(requires True)
(ensures (fun (sM, fM) ->
s0 == sM /\
eval_code (va_Block []) s0 fM sM
))
let va_lemma_empty_total = | false | null | false | Lemmas.lemma_empty_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Lemmas.lemma_empty_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)
(requires True)
(ensures (fun (sM, fM) ->
s0 == sM /\
eval_code (va_Block []) s0 fM sM
)) | [] | Vale.X64.Decls.va_lemma_empty_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s0: Vale.X64.Decls.va_state -> bN: Vale.X64.Decls.va_codes
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 51,
"end_line": 135,
"start_col": 27,
"start_line": 135
} |
FStar.Pervasives.Lemma | val va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins | val va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s))
let va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)) = | false | null | true | reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"lemma"
] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"FStar.Pervasives.reveal_opaque",
"Vale.X64.Machine_Semantics_s.ins",
"Vale.X64.Machine_Semantics_s.machine_state",
"FStar.Pervasives.Native.option",
"Vale.X64.Machine_Semantics_s.machine_eval_code_ins",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Vale.X64.Decls.ins",
"Prims.eq2",
"Vale.X64.Machine_Semantics_s.machine_eval_code_ins_def",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
) | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_ins_lemma (c0: va_code) (s0: va_state)
: Lemma (requires True)
(ensures
(forall (i: ins) (s: BS.machine_state). {:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)) | [] | Vale.X64.Decls.va_ins_lemma | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | c0: Vale.X64.Decls.va_code -> s0: Vale.X64.Decls.va_state
-> FStar.Pervasives.Lemma
(ensures
forall (i: Vale.X64.Decls.ins) (s: Vale.X64.Machine_Semantics_s.machine_state).
{:pattern Vale.X64.Machine_Semantics_s.machine_eval_code_ins i s}
Vale.X64.Machine_Semantics_s.machine_eval_code_ins i s ==
Vale.X64.Machine_Semantics_s.machine_eval_code_ins_def i s) | {
"end_col": 69,
"end_line": 111,
"start_col": 2,
"start_line": 111
} |
Prims.Tot | val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_cmp_lt o1 o2 = BC.OLt o1 o2 | val va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp
let va_cmp_lt o1 o2 = | false | null | false | BC.OLt o1 o2 | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OLt",
"Vale.X64.Decls.ocmp"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2 | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_cmp_lt (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [] | Vale.X64.Decls.va_cmp_lt | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | {
"end_col": 34,
"end_line": 98,
"start_col": 22,
"start_line": 98
} |
Prims.Tot | val get_reason (p:va_pbool) : option string | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason | val get_reason (p:va_pbool) : option string
let get_reason p = | false | null | false | match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"total"
] | [
"Vale.X64.Decls.va_pbool",
"FStar.Pervasives.Native.None",
"Prims.string",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.option"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y | false | true | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 get_reason (p:va_pbool) : option string | [] | Vale.X64.Decls.get_reason | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.X64.Decls.va_pbool -> FStar.Pervasives.Native.option Prims.string | {
"end_col": 52,
"end_line": 37,
"start_col": 2,
"start_line": 35
} |
Prims.Ghost | val va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires
valid_ocmp b sW /\
not (eval_ocmp sW b) /\
eval_while_inv (While b c) s0 fW sW
)
(ensures fun (s1, f1) ->
s1 == {sW with vs_flags = havoc_flags} /\
eval_code (While b c) s0 f1 s1
) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_whileFalse_total = Lemmas.lemma_whileFalse_total | val va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires
valid_ocmp b sW /\
not (eval_ocmp sW b) /\
eval_while_inv (While b c) s0 fW sW
)
(ensures fun (s1, f1) ->
s1 == {sW with vs_flags = havoc_flags} /\
eval_code (While b c) s0 f1 s1
)
let va_lemma_whileFalse_total = | false | null | false | Lemmas.lemma_whileFalse_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Lemmas.lemma_whileFalse_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_whileFalse_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires
valid_ocmp b sW /\
not (eval_ocmp sW b) /\
eval_while_inv (While b c) s0 fW sW
)
(ensures fun (s1, f1) ->
s1 == {sW with vs_flags = havoc_flags} /\
eval_code (While b c) s0 f1 s1
) | [] | Vale.X64.Decls.va_lemma_whileFalse_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b: Vale.X64.Decls.ocmp ->
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
sW: Vale.X64.Decls.va_state ->
fW: Vale.X64.Decls.va_fuel
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 61,
"end_line": 141,
"start_col": 32,
"start_line": 141
} |
FStar.Pervasives.Lemma | val va_lemma_ifElseFalse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
not (eval_ocmp s0 ifb) /\
eval_code cf ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total | val va_lemma_ifElseFalse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
not (eval_ocmp s0 ifb) /\
eval_code cf ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
)
let va_lemma_ifElseFalse_total = | false | null | true | Lemmas.lemma_ifElseFalse_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"lemma"
] | [
"Vale.X64.Lemmas.lemma_ifElseFalse_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_ifElseFalse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) : Lemma
(requires
valid_ocmp ifb s0 /\
not (eval_ocmp s0 ifb) /\
eval_code cf ({s0 with vs_flags = havoc_flags}) f0 sM
)
(ensures
eval_code (IfElse ifb ct cf) s0 f0 sM
) | [] | Vale.X64.Decls.va_lemma_ifElseFalse_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ifb: Vale.X64.Decls.ocmp ->
ct: Vale.X64.Decls.va_code ->
cf: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state
-> FStar.Pervasives.Lemma
(requires
Vale.X64.Decls.valid_ocmp ifb s0 /\ Prims.op_Negation (Vale.X64.Decls.eval_ocmp s0 ifb) /\
Vale.X64.Decls.eval_code cf
(Vale.X64.State.Mkvale_state (Mkvale_state?.vs_ok s0)
(Mkvale_state?.vs_regs s0)
Vale.X64.Decls.havoc_flags
(Mkvale_state?.vs_heap s0)
(Mkvale_state?.vs_stack s0)
(Mkvale_state?.vs_stackTaint s0))
f0
sM) (ensures Vale.X64.Decls.eval_code (Vale.X64.Machine_s.IfElse ifb ct cf) s0 f0 sM) | {
"end_col": 63,
"end_line": 138,
"start_col": 33,
"start_line": 138
} |
Prims.Ghost | val va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires eval_ocmp sW b /\ valid_ocmp b sW)
(ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total | val va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires eval_ocmp sW b /\ valid_ocmp b sW)
(ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW)
let va_lemma_whileTrue_total = | false | null | false | Lemmas.lemma_whileTrue_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Lemmas.lemma_whileTrue_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_whileTrue_total (b:ocmp) (c:va_code) (s0:va_state) (sW:va_state) (fW:va_fuel) : Ghost (va_state & va_fuel)
(requires eval_ocmp sW b /\ valid_ocmp b sW)
(ensures fun (s1, f1) -> s1 == {sW with vs_flags = havoc_flags} /\ f1 == fW) | [] | Vale.X64.Decls.va_lemma_whileTrue_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b: Vale.X64.Decls.ocmp ->
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
sW: Vale.X64.Decls.va_state ->
fW: Vale.X64.Decls.va_fuel
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 59,
"end_line": 140,
"start_col": 31,
"start_line": 140
} |
Prims.Tot | val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_cmp_ge o1 o2 = BC.OGe o1 o2 | val va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp
let va_cmp_ge o1 o2 = | false | null | false | BC.OGe o1 o2 | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OGe",
"Vale.X64.Decls.ocmp"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2 | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_cmp_ge (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [] | Vale.X64.Decls.va_cmp_ge | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | {
"end_col": 34,
"end_line": 97,
"start_col": 22,
"start_line": 97
} |
Prims.Ghost | val va_lemma_ifElse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) : Ghost (bool & va_state & va_state & va_fuel)
(requires True)
(ensures (fun (cond, sM, sN, f0) ->
cond == eval_ocmp s0 ifb /\
sM == {s0 with vs_flags = havoc_flags}
)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_ifElse_total = Lemmas.lemma_ifElse_total | val va_lemma_ifElse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) : Ghost (bool & va_state & va_state & va_fuel)
(requires True)
(ensures (fun (cond, sM, sN, f0) ->
cond == eval_ocmp s0 ifb /\
sM == {s0 with vs_flags = havoc_flags}
))
let va_lemma_ifElse_total = | false | null | false | Lemmas.lemma_ifElse_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Lemmas.lemma_ifElse_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_ifElse_total (ifb:ocmp) (ct:va_code) (cf:va_code) (s0:va_state) : Ghost (bool & va_state & va_state & va_fuel)
(requires True)
(ensures (fun (cond, sM, sN, f0) ->
cond == eval_ocmp s0 ifb /\
sM == {s0 with vs_flags = havoc_flags}
)) | [] | Vale.X64.Decls.va_lemma_ifElse_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ifb: Vale.X64.Decls.ocmp ->
ct: Vale.X64.Decls.va_code ->
cf: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state
-> Prims.Ghost
(((Prims.bool * Vale.X64.Decls.va_state) * Vale.X64.Decls.va_state) * Vale.X64.Decls.va_fuel) | {
"end_col": 53,
"end_line": 136,
"start_col": 28,
"start_line": 136
} |
Prims.Tot | val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_cmp_eq o1 o2 = BC.OEq o1 o2 | val va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp
let va_cmp_eq o1 o2 = | false | null | false | BC.OEq o1 o2 | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OEq",
"Vale.X64.Decls.ocmp"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_cmp_eq (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [] | Vale.X64.Decls.va_cmp_eq | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | {
"end_col": 34,
"end_line": 94,
"start_col": 22,
"start_line": 94
} |
Prims.Ghost | val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires
Cons? b0 /\
eval_code (Cons?.hd b0) s0 f0 sM /\
eval_code (va_Block (Cons?.tl b0)) sM fM sN
)
(ensures (fun fN ->
fN == va_compute_merge_total f0 fM /\
eval_code (va_Block b0) s0 fN sN
)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM | val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires
Cons? b0 /\
eval_code (Cons?.hd b0) s0 f0 sM /\
eval_code (va_Block (Cons?.tl b0)) sM fM sN
)
(ensures (fun fN ->
fN == va_compute_merge_total f0 fM /\
eval_code (va_Block b0) s0 fN sN
))
let va_lemma_merge_total b0 s0 f0 sM fM sN = | false | null | false | Lemmas.lemma_merge_total b0 s0 f0 sM fM sN;
Lemmas.compute_merge_total f0 fM | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Decls.va_codes",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.X64.Lemmas.compute_merge_total",
"Prims.unit",
"Vale.X64.Lemmas.lemma_merge_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = () | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires
Cons? b0 /\
eval_code (Cons?.hd b0) s0 f0 sM /\
eval_code (va_Block (Cons?.tl b0)) sM fM sN
)
(ensures (fun fN ->
fN == va_compute_merge_total f0 fM /\
eval_code (va_Block b0) s0 fN sN
)) | [] | Vale.X64.Decls.va_lemma_merge_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b0: Vale.X64.Decls.va_codes ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state ->
fM: Vale.X64.Decls.va_fuel ->
sN: Vale.X64.Decls.va_state
-> Prims.Ghost Vale.X64.Decls.va_fuel | {
"end_col": 121,
"end_line": 134,
"start_col": 45,
"start_line": 134
} |
FStar.Pervasives.Lemma | val lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h | val lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h))
let lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h)) = | false | null | true | Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"lemma"
] | [
"Vale.X64.Decls.heaplet_id",
"Vale.X64.Decls.va_state",
"Vale.X64.Machine_s.operand64",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Memory.buffer128",
"Vale.X64.Machine_s.maddr",
"Vale.X64.Memory.lemma_load_mem128",
"Prims.unit",
"Prims._assert",
"Vale.X64.Decls.valid_buf_maddr128",
"Vale.X64.State.eval_maddr",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Vale.X64.Machine_s.operand128",
"Vale.X64.Memory.lemma_valid_mem128",
"Vale.X64.Decls.va_opr_code_Mem128",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.get_vale_heap",
"Vale.X64.Memory_Sems.low_lemma_load_mem128_full",
"Prims.l_and",
"Vale.X64.Memory.mem_inv",
"Prims.b2t",
"Vale.X64.Machine_s.uu___is_OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Decls.valid_src_addr",
"Vale.X64.Memory.vuint128",
"Vale.X64.Memory.valid_layout_buffer",
"Vale.X64.Memory.valid_taint_buf128",
"Vale.Arch.HeapImpl.full_heap_taint",
"Prims.eq2",
"Prims.op_Addition",
"Vale.X64.State.eval_operand",
"Vale.X64.Memory.buffer_addr",
"FStar.Mul.op_Star",
"Vale.Lib.Map16.sel",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets",
"Prims.squash",
"Vale.X64.Decls.valid_operand128",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Memory.load_mem128",
"Vale.X64.Memory.buffer_read",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
)) | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 lemma_opr_Mem128
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(t: taint)
(b: M.buffer128)
(index: int)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) ==
M.buffer_read b index h)) | [] | Vale.X64.Decls.lemma_opr_Mem128 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
id: Vale.X64.Decls.heaplet_id ->
s: Vale.X64.Decls.va_state ->
base: Vale.X64.Machine_s.operand64 ->
offset: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint ->
b: Vale.X64.Memory.buffer128 ->
index: Prims.int
-> FStar.Pervasives.Lemma
(requires
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Memory.mem_inv (Mkvale_state?.vs_heap s) /\ OReg? base /\
Vale.X64.Decls.valid_src_addr h b index /\
Vale.X64.Memory.valid_layout_buffer b
(Mkvale_full_heap?.vf_layout (Mkvale_state?.vs_heap s))
h
false /\
Vale.X64.Memory.valid_taint_buf128 b
h
(Vale.Arch.HeapImpl.full_heap_taint (Mkvale_state?.vs_heap s))
t /\
Vale.X64.State.eval_operand base s + offset ==
Vale.X64.Memory.buffer_addr b h + 16 * index))
(ensures
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Decls.valid_operand128 (Vale.X64.Decls.va_opr_code_Mem128 id base offset t) s /\
Vale.X64.Memory.load_mem128 (Vale.X64.Memory.buffer_addr b h + 16 * index)
(Vale.X64.Memory.get_vale_heap (Mkvale_state?.vs_heap s)) ==
Vale.X64.Memory.buffer_read b index h)) | {
"end_col": 31,
"end_line": 90,
"start_col": 2,
"start_line": 84
} |
Prims.Tot | val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_cmp_ne o1 o2 = BC.ONe o1 o2 | val va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp
let va_cmp_ne o1 o2 = | false | null | false | BC.ONe o1 o2 | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.ONe",
"Vale.X64.Decls.ocmp"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_cmp_ne (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [] | Vale.X64.Decls.va_cmp_ne | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | {
"end_col": 34,
"end_line": 95,
"start_col": 22,
"start_line": 95
} |
Prims.Pure | val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags | val maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags)
let maintained_cf new_flags flags = | false | null | false | Lemmas.cf new_flags = Lemmas.cf flags | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Flags.t",
"Prims.op_Equality",
"Vale.X64.Flags.flag_val_t",
"Vale.X64.Lemmas.cf",
"Prims.bool"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 maintained_cf (new_flags:Flags.t) (flags:Flags.t) : Pure bool
(requires True)
(ensures fun b -> b <==> cf new_flags == cf flags /\ valid_cf new_flags == valid_cf flags) | [] | Vale.X64.Decls.maintained_cf | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | new_flags: Vale.X64.Flags.t -> flags: Vale.X64.Flags.t -> Prims.Pure Prims.bool | {
"end_col": 73,
"end_line": 24,
"start_col": 36,
"start_line": 24
} |
Prims.Tot | val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_cmp_le o1 o2 = BC.OLe o1 o2 | val va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp
let va_cmp_le o1 o2 = | false | null | false | BC.OLe o1 o2 | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.operand64",
"Prims.b2t",
"Prims.op_Negation",
"Prims.op_BarBar",
"Vale.X64.Machine_s.uu___is_OMem",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Machine_s.uu___is_OStack",
"Vale.X64.Bytes_Code_s.OLe",
"Vale.X64.Decls.ocmp"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2 | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_cmp_le (o1:operand64{ not (OMem? o1 || OStack? o1) }) (o2:operand64{ not (OMem? o2 || OStack? o2) }) : ocmp | [] | Vale.X64.Decls.va_cmp_le | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
o1: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o1 || OStack? o1)} ->
o2: Vale.X64.Machine_s.operand64{Prims.op_Negation (OMem? o2 || OStack? o2)}
-> Vale.X64.Decls.ocmp | {
"end_col": 34,
"end_line": 96,
"start_col": 22,
"start_line": 96
} |
Prims.Ghost | val va_lemma_while_total (b:ocmp) (c:va_code) (s0:va_state) : Ghost (va_state & va_fuel)
(requires True)
(ensures fun (s1, f1) ->
s1 == s0 /\
eval_while_inv (While b c) s1 f1 s1
) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_while_total = Lemmas.lemma_while_total | val va_lemma_while_total (b:ocmp) (c:va_code) (s0:va_state) : Ghost (va_state & va_fuel)
(requires True)
(ensures fun (s1, f1) ->
s1 == s0 /\
eval_while_inv (While b c) s1 f1 s1
)
let va_lemma_while_total = | false | null | false | Lemmas.lemma_while_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Lemmas.lemma_while_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_while_total (b:ocmp) (c:va_code) (s0:va_state) : Ghost (va_state & va_fuel)
(requires True)
(ensures fun (s1, f1) ->
s1 == s0 /\
eval_while_inv (While b c) s1 f1 s1
) | [] | Vale.X64.Decls.va_lemma_while_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Vale.X64.Decls.ocmp -> c: Vale.X64.Decls.va_code -> s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 51,
"end_line": 139,
"start_col": 27,
"start_line": 139
} |
FStar.Pervasives.Lemma | val lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h | val lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h))
let lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h)) = | false | null | true | Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [
"lemma"
] | [
"Vale.X64.Decls.heaplet_id",
"Vale.X64.Decls.va_state",
"Vale.X64.Machine_s.operand64",
"Prims.int",
"Vale.X64.Memory.buffer64",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Machine_s.maddr",
"Vale.X64.Memory.lemma_load_mem64",
"Prims.unit",
"Prims._assert",
"Vale.X64.Decls.valid_buf_maddr64",
"Vale.X64.State.eval_maddr",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Vale.X64.Memory.lemma_valid_mem64",
"Vale.X64.Decls.va_opr_code_Mem64",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.get_vale_heap",
"Vale.X64.Memory_Sems.low_lemma_load_mem64_full",
"Prims.l_and",
"Vale.X64.Memory.mem_inv",
"Prims.b2t",
"Vale.X64.Machine_s.uu___is_OReg",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.X64.Decls.valid_src_addr",
"Vale.X64.Memory.vuint64",
"Vale.X64.Memory.valid_layout_buffer",
"Vale.X64.Memory.valid_taint_buf64",
"Vale.Arch.HeapImpl.full_heap_taint",
"Prims.eq2",
"Prims.op_Addition",
"Vale.X64.State.eval_operand",
"Vale.X64.Memory.buffer_addr",
"FStar.Mul.op_Star",
"Vale.Lib.Map16.sel",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets",
"Prims.squash",
"Vale.X64.Decls.valid_operand",
"Prims.nat",
"Prims.l_or",
"Prims.op_LessThan",
"Vale.Def.Words_s.pow2_64",
"Vale.X64.Memory.load_mem64",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap",
"Vale.X64.Memory.buffer_read",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
)) | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 lemma_opr_Mem64
(id: heaplet_id)
(s: va_state)
(base: operand64)
(offset: int)
(b: M.buffer64)
(index: int)
(t: taint)
: Lemma
(requires
(let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\ OReg? base /\ valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index))
(ensures
(let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) ==
M.buffer_read b index h)) | [] | Vale.X64.Decls.lemma_opr_Mem64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
id: Vale.X64.Decls.heaplet_id ->
s: Vale.X64.Decls.va_state ->
base: Vale.X64.Machine_s.operand64 ->
offset: Prims.int ->
b: Vale.X64.Memory.buffer64 ->
index: Prims.int ->
t: Vale.Arch.HeapTypes_s.taint
-> FStar.Pervasives.Lemma
(requires
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Memory.mem_inv (Mkvale_state?.vs_heap s) /\ OReg? base /\
Vale.X64.Decls.valid_src_addr h b index /\
Vale.X64.Memory.valid_layout_buffer b
(Mkvale_full_heap?.vf_layout (Mkvale_state?.vs_heap s))
h
false /\
Vale.X64.Memory.valid_taint_buf64 b
h
(Vale.Arch.HeapImpl.full_heap_taint (Mkvale_state?.vs_heap s))
t /\
Vale.X64.State.eval_operand base s + offset == Vale.X64.Memory.buffer_addr b h + 8 * index
))
(ensures
(let h = Vale.Lib.Map16.sel (Mkvale_full_heap?.vf_heaplets (Mkvale_state?.vs_heap s)) id in
Vale.X64.Decls.valid_operand (Vale.X64.Decls.va_opr_code_Mem64 id base offset t) s /\
Vale.X64.Memory.load_mem64 (Vale.X64.Memory.buffer_addr b h + 8 * index)
(Mkvale_full_heap?.vf_heap (Mkvale_state?.vs_heap s)) ==
Vale.X64.Memory.buffer_read b index h)) | {
"end_col": 30,
"end_line": 66,
"start_col": 2,
"start_line": 60
} |
Prims.Ghost | val va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires While? c /\ (
let cond = While?.whileCond c in
sN.vs_ok /\
valid_ocmp cond sM /\
eval_ocmp sM cond /\
eval_while_inv c s0 f0 sM /\
eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN
))
(ensures (fun fN ->
eval_while_inv c s0 fN sN
)) | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_s",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": true,
"full_module": "Vale.X64.Stack_i",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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 va_lemma_whileMerge_total = Lemmas.lemma_whileMerge_total | val va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires While? c /\ (
let cond = While?.whileCond c in
sN.vs_ok /\
valid_ocmp cond sM /\
eval_ocmp sM cond /\
eval_while_inv c s0 f0 sM /\
eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN
))
(ensures (fun fN ->
eval_while_inv c s0 fN sN
))
let va_lemma_whileMerge_total = | false | null | false | Lemmas.lemma_whileMerge_total | {
"checked_file": "Vale.X64.Decls.fst.checked",
"dependencies": [
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_s.fst.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Lemmas.fsti.checked",
"Vale.X64.Bytes_Code_s.fst.checked",
"Vale.Def.PossiblyMonad.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Map.fsti.checked",
"FStar.IO.fst.checked"
],
"interface_file": true,
"source_file": "Vale.X64.Decls.fst"
} | [] | [
"Vale.X64.Lemmas.lemma_whileMerge_total"
] | [] | module Vale.X64.Decls
open FStar.Mul
open Vale.X64.Machine_s
open Vale.X64
open Vale.X64.State
open Vale.X64.StateLemmas
open FStar.UInt
module P = Vale.X64.Print_s
module BC = Vale.X64.Bytes_Code_s
module BS = Vale.X64.Machine_Semantics_s
#reset-options "--max_fuel 0 --max_ifuel 0 --smtencoding.elim_box true --smtencoding.l_arith_repr boxwrap --smtencoding.nl_arith_repr boxwrap --z3cliopt smt.arith.nl=true --using_facts_from 'Prims FStar.UInt Vale.Def.Words_s FStar.UInt64'"
let lemma_mul_in_bounds (x y:nat64) : Lemma (requires x * y < pow2_64) (ensures FStar.UInt.mul_mod #64 x y == x * y) = ()
#reset-options "--z3cliopt smt.arith.nl=true --using_facts_from Prims --using_facts_from FStar.Math"
let lemma_mul_nat (x:nat) (y:nat) : Lemma (ensures 0 <= (x * y)) = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
let cf flags = match Lemmas.cf flags with | Some v -> v | None -> false
let overflow flags = match Lemmas.overflow flags with | Some v -> v | None -> false
let valid_cf flags = match Lemmas.cf flags with | Some v -> true | None -> false
let valid_of flags = match Lemmas.overflow flags with | Some v -> true | None -> false
let updated_cf new_flags new_cf = Lemmas.cf new_flags = Some new_cf
let updated_of new_flags new_cf = Lemmas.overflow new_flags = Some new_cf
let maintained_cf new_flags flags = Lemmas.cf new_flags = Lemmas.cf flags
let maintained_of new_flags flags = Lemmas.overflow new_flags = Lemmas.overflow flags
let ins = BS.ins
type ocmp = BS.ocmp
type va_fuel = nat
type va_pbool = Vale.Def.PossiblyMonad.pbool
let va_ttrue () = Vale.Def.PossiblyMonad.ttrue
let va_ffalse = Vale.Def.PossiblyMonad.ffalse
let va_pbool_and x y = Vale.Def.PossiblyMonad.((&&.)) x y
let get_reason p =
match p with
| Vale.Def.PossiblyMonad.Ok () -> None
| Vale.Def.PossiblyMonad.Err reason -> Some reason
let mul_nat_helper x y =
FStar.Math.Lemmas.nat_times_nat_is_nat x y
let va_fuel_default () = 0
let lemma_opr_Mem64 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (b:M.buffer64) (index:int) (t:taint) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf64 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 8 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand (va_opr_code_Mem64 id base offset t) s /\
M.load_mem64 (M.buffer_addr b h + 8 * index) (s.vs_heap.vf_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem64_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem64 id base offset t in
M.lemma_valid_mem64 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr64 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem64 b index h
let lemma_opr_Mem128 (id:heaplet_id) (s:va_state) (base:operand64) (offset:int) (t:taint) (b:M.buffer128) (index:int) : Lemma
(requires (
let h = Map16.sel s.vs_heap.vf_heaplets id in
M.mem_inv s.vs_heap /\
OReg? base /\
valid_src_addr h b index /\
M.valid_layout_buffer b (s.vs_heap.vf_layout) h false /\
M.valid_taint_buf128 b h (full_heap_taint s.vs_heap) t /\
eval_operand base s + offset == M.buffer_addr b h + 16 * index
))
(ensures (
let h = Map16.sel s.vs_heap.vf_heaplets id in
valid_operand128 (va_opr_code_Mem128 id base offset t) s /\
M.load_mem128 (M.buffer_addr b h + 16 * index) (M.get_vale_heap s.vs_heap) == M.buffer_read b index h
))
=
Vale.X64.Memory_Sems.low_lemma_load_mem128_full b index s.vs_heap t id;
let h = M.get_vale_heap s.vs_heap in
let t = va_opr_code_Mem128 id base offset t in
M.lemma_valid_mem128 b index h;
let OMem (m, t) = t in
assert (valid_buf_maddr128 (eval_maddr m s) h s.vs_heap.vf_layout b index t);
M.lemma_load_mem128 b index h
let taint_at memTaint addr = Map.sel memTaint addr
let va_cmp_eq o1 o2 = BC.OEq o1 o2
let va_cmp_ne o1 o2 = BC.ONe o1 o2
let va_cmp_le o1 o2 = BC.OLe o1 o2
let va_cmp_ge o1 o2 = BC.OGe o1 o2
let va_cmp_lt o1 o2 = BC.OLt o1 o2
let va_cmp_gt o1 o2 = BC.OGt o1 o2
let eval_code = Lemmas.eval_code
let eval_while_inv = Lemmas.eval_while_inv
let va_ins_lemma (c0:va_code) (s0:va_state) : Lemma
(requires True)
(ensures
(forall (i:ins) (s:BS.machine_state).{:pattern (BS.machine_eval_code_ins i s)}
BS.machine_eval_code_ins i s == BS.machine_eval_code_ins_def i s)
)
=
reveal_opaque (`%BS.machine_eval_code_ins) BS.machine_eval_code_ins
let eval_ocmp = Lemmas.eval_ocmp
let valid_ocmp = Lemmas.valid_ocmp
let havoc_flags = Lemmas.havoc_flags
unfold let va_eval_ins = Lemmas.eval_ins
let lemma_cmp_eq s o1 o2 = ()
let lemma_cmp_ne s o1 o2 = ()
let lemma_cmp_le s o1 o2 = ()
let lemma_cmp_ge s o1 o2 = ()
let lemma_cmp_lt s o1 o2 = ()
let lemma_cmp_gt s o1 o2 = ()
let lemma_valid_cmp_eq s o1 o2 = ()
let lemma_valid_cmp_ne s o1 o2 = ()
let lemma_valid_cmp_le s o1 o2 = ()
let lemma_valid_cmp_ge s o1 o2 = ()
let lemma_valid_cmp_lt s o1 o2 = ()
let lemma_valid_cmp_gt s o1 o2 = ()
let va_compute_merge_total = Lemmas.compute_merge_total
let va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM
let va_lemma_empty_total = Lemmas.lemma_empty_total
let va_lemma_ifElse_total = Lemmas.lemma_ifElse_total
let va_lemma_ifElseTrue_total = Lemmas.lemma_ifElseTrue_total
let va_lemma_ifElseFalse_total = Lemmas.lemma_ifElseFalse_total
let va_lemma_while_total = Lemmas.lemma_while_total
let va_lemma_whileTrue_total = Lemmas.lemma_whileTrue_total | false | false | Vale.X64.Decls.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 2,
"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 va_lemma_whileMerge_total (c:va_code) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel
(requires While? c /\ (
let cond = While?.whileCond c in
sN.vs_ok /\
valid_ocmp cond sM /\
eval_ocmp sM cond /\
eval_while_inv c s0 f0 sM /\
eval_code (While?.whileBody c) ({sM with vs_flags = havoc_flags}) fM sN
))
(ensures (fun fN ->
eval_while_inv c s0 fN sN
)) | [] | Vale.X64.Decls.va_lemma_whileMerge_total | {
"file_name": "vale/code/arch/x64/Vale.X64.Decls.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
c: Vale.X64.Decls.va_code ->
s0: Vale.X64.Decls.va_state ->
f0: Vale.X64.Decls.va_fuel ->
sM: Vale.X64.Decls.va_state ->
fM: Vale.X64.Decls.va_fuel ->
sN: Vale.X64.Decls.va_state
-> Prims.Ghost Vale.X64.Decls.va_fuel | {
"end_col": 61,
"end_line": 142,
"start_col": 32,
"start_line": 142
} |
Prims.GTot | val store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 store_stack64 i v h = BS.update_stack64' i v h | val store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack
let store_stack64 i v h = | false | null | false | BS.update_stack64' i v h | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.update_stack64'"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st | false | false | Vale.PPC64LE.Stack_i.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 store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack | [] | Vale.PPC64LE.Stack_i.store_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | {
"end_col": 50,
"end_line": 10,
"start_col": 26,
"start_line": 10
} |
Prims.GTot | val load_stack128 (ptr:int) (h:vale_stack) : GTot quad32 | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 load_stack128 i st = BS.eval_stack128 i st | val load_stack128 (ptr:int) (h:vale_stack) : GTot quad32
let load_stack128 i st = | false | null | false | BS.eval_stack128 i st | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.eval_stack128",
"Vale.PPC64LE.Memory.quad32"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h | false | false | Vale.PPC64LE.Stack_i.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 load_stack128 (ptr:int) (h:vale_stack) : GTot quad32 | [] | Vale.PPC64LE.Stack_i.load_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Vale.PPC64LE.Memory.quad32 | {
"end_col": 46,
"end_line": 14,
"start_col": 25,
"start_line": 14
} |
Prims.GTot | val load_stack64 (ptr:int) (h:vale_stack) : GTot nat64 | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 load_stack64 i st = BS.eval_stack i st | val load_stack64 (ptr:int) (h:vale_stack) : GTot nat64
let load_stack64 i st = | false | null | false | BS.eval_stack i st | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.eval_stack",
"Vale.PPC64LE.Memory.nat64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack | false | false | Vale.PPC64LE.Stack_i.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 load_stack64 (ptr:int) (h:vale_stack) : GTot nat64 | [] | Vale.PPC64LE.Stack_i.load_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Vale.PPC64LE.Memory.nat64 | {
"end_col": 42,
"end_line": 9,
"start_col": 24,
"start_line": 9
} |
Prims.Tot | val vale_stack : Type u#0 | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let vale_stack = machine_stack | val vale_stack : Type u#0
let vale_stack = | false | null | false | machine_stack | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"total"
] | [
"Vale.PPC64LE.Machine_s.machine_stack"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s | false | true | Vale.PPC64LE.Stack_i.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 vale_stack : Type u#0 | [] | Vale.PPC64LE.Stack_i.vale_stack | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 30,
"end_line": 6,
"start_col": 17,
"start_line": 6
} |
Prims.GTot | val free_stack128 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 free_stack128 start finish h = BS.free_stack' start finish h | val free_stack128 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack
let free_stack128 start finish h = | false | null | false | BS.free_stack' start finish h | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.free_stack'"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st | false | false | Vale.PPC64LE.Stack_i.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 free_stack128 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | [] | Vale.PPC64LE.Stack_i.free_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> finish: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | {
"end_col": 64,
"end_line": 16,
"start_col": 35,
"start_line": 16
} |
Prims.GTot | val valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 valid_src_stack128 i st = BS.valid_src_stack128 i st | val valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool
let valid_src_stack128 i st = | false | null | false | BS.valid_src_stack128 i st | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.valid_src_stack128",
"Prims.bool"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h | false | false | Vale.PPC64LE.Stack_i.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 valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool | [] | Vale.PPC64LE.Stack_i.valid_src_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Prims.bool | {
"end_col": 56,
"end_line": 13,
"start_col": 30,
"start_line": 13
} |
Prims.GTot | val valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t | val valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0
let valid_taint_stack128 ptr t stackTaint = | false | null | false | Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Prims.b2t",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Map.sel",
"Prims.op_Addition",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t | false | false | Vale.PPC64LE.Stack_i.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 valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | [] | Vale.PPC64LE.Stack_i.valid_taint_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 35,
"end_line": 138,
"start_col": 2,
"start_line": 123
} |
Prims.GTot | val store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t | val store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint
let store_taint_stack64 ptr t stackTaint = | false | null | false | BS.update_n ptr 8 stackTaint t | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Vale.PPC64LE.Semantics_s.update_n"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t
let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t | false | false | Vale.PPC64LE.Stack_i.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 store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | [] | Vale.PPC64LE.Stack_i.store_taint_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.PPC64LE.Memory.memtaint | {
"end_col": 73,
"end_line": 140,
"start_col": 43,
"start_line": 140
} |
Prims.GTot | val valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t | val valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0
let valid_taint_stack64 ptr t stackTaint = | false | null | false | Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Prims.b2t",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"FStar.Map.sel",
"Prims.op_Addition",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = () | false | false | Vale.PPC64LE.Stack_i.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 valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0 | [] | Vale.PPC64LE.Stack_i.valid_taint_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 34,
"end_line": 120,
"start_col": 2,
"start_line": 113
} |
Prims.GTot | val free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 free_stack64 start finish h = BS.free_stack' start finish h | val free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack
let free_stack64 start finish h = | false | null | false | BS.free_stack' start finish h | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.free_stack'"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st | false | false | Vale.PPC64LE.Stack_i.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 free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack | [] | Vale.PPC64LE.Stack_i.free_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> finish: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | {
"end_col": 63,
"end_line": 11,
"start_col": 34,
"start_line": 11
} |
Prims.GTot | val valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 valid_src_stack64 i st = BS.valid_src_stack64 i st | val valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool
let valid_src_stack64 i st = | false | null | false | BS.valid_src_stack64 i st | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.valid_src_stack64",
"Prims.bool"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack | false | false | Vale.PPC64LE.Stack_i.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 valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool | [] | Vale.PPC64LE.Stack_i.valid_src_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack -> Prims.GTot Prims.bool | {
"end_col": 54,
"end_line": 8,
"start_col": 29,
"start_line": 8
} |
Prims.Tot | val init_r1 (h:vale_stack) : (n:nat64{n >= 65536}) | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 init_r1 h = h.initial_r1 | val init_r1 (h:vale_stack) : (n:nat64{n >= 65536})
let init_r1 h = | false | null | false | h.initial_r1 | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"total"
] | [
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.__proj__Machine_stack__item__initial_r1",
"Vale.PPC64LE.Memory.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h | false | false | Vale.PPC64LE.Stack_i.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 init_r1 (h:vale_stack) : (n:nat64{n >= 65536}) | [] | Vale.PPC64LE.Stack_i.init_r1 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: Vale.PPC64LE.Stack_i.vale_stack -> n: Vale.PPC64LE.Memory.nat64{n >= 65536} | {
"end_col": 28,
"end_line": 18,
"start_col": 16,
"start_line": 18
} |
Prims.GTot | val store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 store_stack128 i v h = BS.update_stack128' i v h | val store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack
let store_stack128 i v h = | false | null | false | BS.update_stack128' i v h | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Semantics_s.update_stack128'"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st | false | false | Vale.PPC64LE.Stack_i.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 store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack | [] | Vale.PPC64LE.Stack_i.store_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.quad32 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> Prims.GTot Vale.PPC64LE.Stack_i.vale_stack | {
"end_col": 52,
"end_line": 15,
"start_col": 27,
"start_line": 15
} |
Prims.GTot | val store_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 store_taint_stack128 ptr t stackTaint = BS.update_n ptr 16 stackTaint t | val store_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint
let store_taint_stack128 ptr t stackTaint = | false | null | false | BS.update_n ptr 16 stackTaint t | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"sometrivial"
] | [
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Vale.PPC64LE.Memory.memtaint",
"Vale.PPC64LE.Semantics_s.update_n"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t
let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t
let store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t | false | false | Vale.PPC64LE.Stack_i.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 store_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint | [] | Vale.PPC64LE.Stack_i.store_taint_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.PPC64LE.Memory.memtaint
-> Prims.GTot Vale.PPC64LE.Memory.memtaint | {
"end_col": 75,
"end_line": 142,
"start_col": 44,
"start_line": 142
} |
FStar.Pervasives.Lemma | val lemma_free_stack_same_load128 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack128 ptr h /\
(ptr >= finish \/ ptr + 16 <= start))
(ensures load_stack128 ptr h == load_stack128 ptr (free_stack128 start finish h))
[SMTPat (load_stack128 ptr (free_stack128 start finish h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal () | val lemma_free_stack_same_load128 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack128 ptr h /\
(ptr >= finish \/ ptr + 16 <= start))
(ensures load_stack128 ptr h == load_stack128 ptr (free_stack128 start finish h))
[SMTPat (load_stack128 ptr (free_stack128 start finish h))]
let lemma_free_stack_same_load128 start finish ptr h = | false | null | true | reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap_s.get_heap_val128_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap_s.get_heap_val32_reveal",
"FStar.Classical.forall_intro",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Negation",
"FStar.Set.mem",
"Vale.Lib.Set.remove_between",
"Prims.l_or",
"Prims.op_Equality",
"Prims.bool",
"Vale.Lib.Set.remove_between_reveal",
"FStar.Set.set",
"FStar.Map.domain",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Arch.MachineHeap_s.valid_addr128"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal () | false | false | Vale.PPC64LE.Stack_i.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 lemma_free_stack_same_load128 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack128 ptr h /\
(ptr >= finish \/ ptr + 16 <= start))
(ensures load_stack128 ptr h == load_stack128 ptr (free_stack128 start finish h))
[SMTPat (load_stack128 ptr (free_stack128 start finish h))] | [] | Vale.PPC64LE.Stack_i.lemma_free_stack_same_load128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(requires
Vale.PPC64LE.Stack_i.valid_src_stack128 ptr h /\ (ptr >= finish \/ ptr + 16 <= start))
(ensures
Vale.PPC64LE.Stack_i.load_stack128 ptr h ==
Vale.PPC64LE.Stack_i.load_stack128 ptr (Vale.PPC64LE.Stack_i.free_stack128 start finish h))
[
SMTPat (Vale.PPC64LE.Stack_i.load_stack128 ptr
(Vale.PPC64LE.Stack_i.free_stack128 start finish h))
] | {
"end_col": 30,
"end_line": 85,
"start_col": 2,
"start_line": 80
} |
FStar.Pervasives.Lemma | val lemma_correct_store_load_stack128 (ptr:int) (v:quad32) (h:vale_stack) : Lemma
(load_stack128 ptr (store_stack128 ptr v h) == v)
[SMTPat (load_stack128 ptr (store_stack128 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem | val lemma_correct_store_load_stack128 (ptr:int) (v:quad32) (h:vale_stack) : Lemma
(load_stack128 ptr (store_stack128 ptr v h) == v)
[SMTPat (load_stack128 ptr (store_stack128 ptr v h))]
let lemma_correct_store_load_stack128 ptr v h = | false | null | true | let Machine_stack _ mem = h in
correct_update_get128 ptr v mem | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap.correct_update_get128",
"Prims.unit"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal () | false | false | Vale.PPC64LE.Stack_i.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 lemma_correct_store_load_stack128 (ptr:int) (v:quad32) (h:vale_stack) : Lemma
(load_stack128 ptr (store_stack128 ptr v h) == v)
[SMTPat (load_stack128 ptr (store_stack128 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_correct_store_load_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.quad32 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(ensures
Vale.PPC64LE.Stack_i.load_stack128 ptr (Vale.PPC64LE.Stack_i.store_stack128 ptr v h) == v)
[
SMTPat (Vale.PPC64LE.Stack_i.load_stack128 ptr (Vale.PPC64LE.Stack_i.store_stack128 ptr v h)
)
] | {
"end_col": 33,
"end_line": 71,
"start_col": 47,
"start_line": 69
} |
FStar.Pervasives.Lemma | val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures valid_src_stack64 ptr (free_stack64 start finish h))
[SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures valid_src_stack64 ptr (free_stack64 start finish h))
[SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))]
let lemma_free_stack_same_valid64 start finish ptr h = | false | null | true | reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"FStar.Classical.forall_intro",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Negation",
"FStar.Set.mem",
"Vale.Lib.Set.remove_between",
"Prims.l_or",
"Prims.op_Equality",
"Prims.bool",
"Vale.Lib.Set.remove_between_reveal",
"FStar.Set.set",
"FStar.Map.domain",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Arch.MachineHeap_s.valid_addr64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | false | false | Vale.PPC64LE.Stack_i.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures valid_src_stack64 ptr (free_stack64 start finish h))
[SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))] | [] | Vale.PPC64LE.Stack_i.lemma_free_stack_same_valid64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start))
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack64 ptr
(Vale.PPC64LE.Stack_i.free_stack64 start finish h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack64 ptr
(Vale.PPC64LE.Stack_i.free_stack64 start finish h))
] | {
"end_col": 81,
"end_line": 30,
"start_col": 2,
"start_line": 27
} |
FStar.Pervasives.Lemma | val lemma_free_stack_same_valid128 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack128 ptr h /\
(ptr >= finish \/ ptr + 16 <= start))
(ensures valid_src_stack128 ptr (free_stack128 start finish h))
[SMTPat (valid_src_stack128 ptr (free_stack128 start finish h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | val lemma_free_stack_same_valid128 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack128 ptr h /\
(ptr >= finish \/ ptr + 16 <= start))
(ensures valid_src_stack128 ptr (free_stack128 start finish h))
[SMTPat (valid_src_stack128 ptr (free_stack128 start finish h))]
let lemma_free_stack_same_valid128 start finish ptr h = | false | null | true | reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"FStar.Classical.forall_intro",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Negation",
"FStar.Set.mem",
"Vale.Lib.Set.remove_between",
"Prims.l_or",
"Prims.op_Equality",
"Prims.bool",
"Vale.Lib.Set.remove_between_reveal",
"FStar.Set.set",
"FStar.Map.domain",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Arch.MachineHeap_s.valid_addr128"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal () | false | false | Vale.PPC64LE.Stack_i.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_free_stack_same_valid128 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack128 ptr h /\
(ptr >= finish \/ ptr + 16 <= start))
(ensures valid_src_stack128 ptr (free_stack128 start finish h))
[SMTPat (valid_src_stack128 ptr (free_stack128 start finish h))] | [] | Vale.PPC64LE.Stack_i.lemma_free_stack_same_valid128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(requires
Vale.PPC64LE.Stack_i.valid_src_stack128 ptr h /\ (ptr >= finish \/ ptr + 16 <= start))
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack128 ptr
(Vale.PPC64LE.Stack_i.free_stack128 start finish h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack128 ptr
(Vale.PPC64LE.Stack_i.free_stack128 start finish h))
] | {
"end_col": 81,
"end_line": 41,
"start_col": 2,
"start_line": 38
} |
FStar.Pervasives.Lemma | val lemma_correct_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma
(load_stack64 ptr (store_stack64 ptr v h) == v)
[SMTPat (load_stack64 ptr (store_stack64 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem | val lemma_correct_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma
(load_stack64 ptr (store_stack64 ptr v h) == v)
[SMTPat (load_stack64 ptr (store_stack64 ptr v h))]
let lemma_correct_store_load_stack64 ptr v h = | false | null | true | let Machine_stack _ mem = h in
correct_update_get64 ptr v mem | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap.correct_update_get64",
"Prims.unit"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options | false | false | Vale.PPC64LE.Stack_i.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 lemma_correct_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma
(load_stack64 ptr (store_stack64 ptr v h) == v)
[SMTPat (load_stack64 ptr (store_stack64 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_correct_store_load_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(ensures
Vale.PPC64LE.Stack_i.load_stack64 ptr (Vale.PPC64LE.Stack_i.store_stack64 ptr v h) == v)
[SMTPat (Vale.PPC64LE.Stack_i.load_stack64 ptr (Vale.PPC64LE.Stack_i.store_stack64 ptr v h))] | {
"end_col": 32,
"end_line": 55,
"start_col": 46,
"start_line": 53
} |
FStar.Pervasives.Lemma | val lemma_frame_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 8 \/ i + 8 <= ptr))
(ensures (load_stack64 i (store_stack64 ptr v h) == load_stack64 i h))
[SMTPat (load_stack64 i (store_stack64 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal () | val lemma_frame_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 8 \/ i + 8 <= ptr))
(ensures (load_stack64 i (store_stack64 ptr v h) == load_stack64 i h))
[SMTPat (load_stack64 i (store_stack64 ptr v h))]
let lemma_frame_store_load_stack64 ptr v h i = | false | null | true | let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap_s.get_heap_val64_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap.frame_update_heap64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem | false | false | Vale.PPC64LE.Stack_i.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 lemma_frame_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 8 \/ i + 8 <= ptr))
(ensures (load_stack64 i (store_stack64 ptr v h) == load_stack64 i h))
[SMTPat (load_stack64 i (store_stack64 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_frame_store_load_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.Stack_i.vale_stack -> i: Prims.int
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr))
(ensures
Vale.PPC64LE.Stack_i.load_stack64 i (Vale.PPC64LE.Stack_i.store_stack64 ptr v h) ==
Vale.PPC64LE.Stack_i.load_stack64 i h)
[SMTPat (Vale.PPC64LE.Stack_i.load_stack64 i (Vale.PPC64LE.Stack_i.store_stack64 ptr v h))] | {
"end_col": 29,
"end_line": 60,
"start_col": 46,
"start_line": 57
} |
FStar.Pervasives.Lemma | val lemma_frame_store_load_stack128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack128 i h /\
(i >= ptr + 16 \/ i + 16 <= ptr))
(ensures (load_stack128 i (store_stack128 ptr v h) == load_stack128 i h))
[SMTPat (load_stack128 i (store_stack128 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal () | val lemma_frame_store_load_stack128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack128 i h /\
(i >= ptr + 16 \/ i + 16 <= ptr))
(ensures (load_stack128 i (store_stack128 ptr v h) == load_stack128 i h))
[SMTPat (load_stack128 i (store_stack128 ptr v h))]
let lemma_frame_store_load_stack128 ptr v h i = | false | null | true | let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap_s.get_heap_val128_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap_s.get_heap_val32_reveal",
"Vale.Arch.MachineHeap.frame_update_heap128"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem | false | false | Vale.PPC64LE.Stack_i.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 lemma_frame_store_load_stack128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack128 i h /\
(i >= ptr + 16 \/ i + 16 <= ptr))
(ensures (load_stack128 i (store_stack128 ptr v h) == load_stack128 i h))
[SMTPat (load_stack128 i (store_stack128 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_frame_store_load_stack128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ptr: Prims.int ->
v: Vale.PPC64LE.Memory.quad32 ->
h: Vale.PPC64LE.Stack_i.vale_stack ->
i: Prims.int
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack128 i h /\ (i >= ptr + 16 \/ i + 16 <= ptr))
(ensures
Vale.PPC64LE.Stack_i.load_stack128 i (Vale.PPC64LE.Stack_i.store_stack128 ptr v h) ==
Vale.PPC64LE.Stack_i.load_stack128 i h)
[SMTPat (Vale.PPC64LE.Stack_i.load_stack128 i (Vale.PPC64LE.Stack_i.store_stack128 ptr v h))] | {
"end_col": 30,
"end_line": 77,
"start_col": 47,
"start_line": 73
} |
FStar.Pervasives.Lemma | val lemma_store_stack_same_valid64_128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 16 \/ i + 8 <= ptr))
(ensures valid_src_stack64 i (store_stack128 ptr v h))
[SMTPat (valid_src_stack64 i (store_stack128 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_store_stack_same_valid64_128 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap128_reveal ();
BS.update_heap32_reveal () | val lemma_store_stack_same_valid64_128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 16 \/ i + 8 <= ptr))
(ensures valid_src_stack64 i (store_stack128 ptr v h))
[SMTPat (valid_src_stack64 i (store_stack128 ptr v h))]
let lemma_store_stack_same_valid64_128 ptr v h i = | false | null | true | reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap128_reveal ();
BS.update_heap32_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.Arch.MachineHeap_s.update_heap32_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap_s.update_heap128_reveal",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Prims.bool",
"Vale.Arch.MachineHeap_s.valid_addr64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t
let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t
let store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t
let store_taint_stack128 ptr t stackTaint = BS.update_n ptr 16 stackTaint t
let lemma_valid_taint_stack64 ptr t stackTaint = ()
let lemma_valid_taint_stack128 ptr t stackTaint = ()
let lemma_valid_taint_stack64_reveal ptr t stackTaint = ()
let lemma_correct_store_load_taint_stack64 ptr t stackTaint = ()
let lemma_frame_store_load_taint_stack64 ptr t stackTaint i t' = ()
let lemma_valid_taint_stack128_reveal ptr t stackTaint = ()
let lemma_correct_store_load_taint_stack128 ptr t stackTaint = ()
let lemma_frame_store_load_taint_stack128 ptr t stackTaint i t' = () | false | false | Vale.PPC64LE.Stack_i.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 lemma_store_stack_same_valid64_128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 16 \/ i + 8 <= ptr))
(ensures valid_src_stack64 i (store_stack128 ptr v h))
[SMTPat (valid_src_stack64 i (store_stack128 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_store_stack_same_valid64_128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ptr: Prims.int ->
v: Vale.PPC64LE.Memory.quad32 ->
h: Vale.PPC64LE.Stack_i.vale_stack ->
i: Prims.int
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 i h /\ (i >= ptr + 16 \/ i + 8 <= ptr))
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack64 i (Vale.PPC64LE.Stack_i.store_stack128 ptr v h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack64 i
(Vale.PPC64LE.Stack_i.store_stack128 ptr v h))
] | {
"end_col": 28,
"end_line": 162,
"start_col": 2,
"start_line": 160
} |
FStar.Pervasives.Lemma | val lemma_free_stack_same_load64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures load_stack64 ptr h == load_stack64 ptr (free_stack64 start finish h))
[SMTPat (load_stack64 ptr (free_stack64 start finish h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal () | val lemma_free_stack_same_load64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures load_stack64 ptr h == load_stack64 ptr (free_stack64 start finish h))
[SMTPat (load_stack64 ptr (free_stack64 start finish h))]
let lemma_free_stack_same_load64 start finish ptr h = | false | null | true | reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap_s.get_heap_val64_reveal",
"Prims.unit",
"FStar.Classical.forall_intro",
"Prims.l_and",
"Prims.l_imp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Negation",
"FStar.Set.mem",
"Vale.Lib.Set.remove_between",
"Prims.l_or",
"Prims.op_Equality",
"Prims.bool",
"Vale.Lib.Set.remove_between_reveal",
"FStar.Set.set",
"FStar.Map.domain",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Vale.Arch.MachineHeap_s.valid_addr64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal () | false | false | Vale.PPC64LE.Stack_i.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 lemma_free_stack_same_load64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma
(requires valid_src_stack64 ptr h /\
(ptr >= finish \/ ptr + 8 <= start))
(ensures load_stack64 ptr h == load_stack64 ptr (free_stack64 start finish h))
[SMTPat (load_stack64 ptr (free_stack64 start finish h))] | [] | Vale.PPC64LE.Stack_i.lemma_free_stack_same_load64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start))
(ensures
Vale.PPC64LE.Stack_i.load_stack64 ptr h ==
Vale.PPC64LE.Stack_i.load_stack64 ptr (Vale.PPC64LE.Stack_i.free_stack64 start finish h))
[
SMTPat (Vale.PPC64LE.Stack_i.load_stack64 ptr
(Vale.PPC64LE.Stack_i.free_stack64 start finish h))
] | {
"end_col": 29,
"end_line": 67,
"start_col": 2,
"start_line": 63
} |
FStar.Pervasives.Lemma | val lemma_store_new_valid128 (ptr:int) (v:quad32) (h:vale_stack) : Lemma
(valid_src_stack128 ptr (store_stack128 ptr v h))
[SMTPat (valid_src_stack128 ptr (store_stack128 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal () | val lemma_store_new_valid128 (ptr:int) (v:quad32) (h:vale_stack) : Lemma
(valid_src_stack128 ptr (store_stack128 ptr v h))
[SMTPat (valid_src_stack128 ptr (store_stack128 ptr v h))]
let lemma_store_new_valid128 ptr v h = | false | null | true | reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.Arch.MachineHeap_s.update_heap128_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap_s.update_heap32_reveal",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Prims.bool",
"Vale.Arch.MachineHeap_s.valid_addr128"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | false | false | Vale.PPC64LE.Stack_i.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_store_new_valid128 (ptr:int) (v:quad32) (h:vale_stack) : Lemma
(valid_src_stack128 ptr (store_stack128 ptr v h))
[SMTPat (valid_src_stack128 ptr (store_stack128 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_store_new_valid128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.quad32 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack128 ptr (Vale.PPC64LE.Stack_i.store_stack128 ptr v h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack128 ptr
(Vale.PPC64LE.Stack_i.store_stack128 ptr v h))
] | {
"end_col": 29,
"end_line": 50,
"start_col": 2,
"start_line": 48
} |
FStar.Pervasives.Lemma | val lemma_frame_store_load_stack64_128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 16 \/ i + 8 <= ptr))
(ensures (load_stack64 i (store_stack128 ptr v h) == load_stack64 i h))
[SMTPat (load_stack64 i (store_stack128 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_frame_store_load_stack64_128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val64_reveal () | val lemma_frame_store_load_stack64_128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 16 \/ i + 8 <= ptr))
(ensures (load_stack64 i (store_stack128 ptr v h) == load_stack64 i h))
[SMTPat (load_stack64 i (store_stack128 ptr v h))]
let lemma_frame_store_load_stack64_128 ptr v h i = | false | null | true | let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val64_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Vale.Arch.MachineHeap_s.get_heap_val64_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap.frame_update_heap128"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2)
let lemma_same_init_r1_free_stack64 start finish h = ()
let lemma_same_init_r1_store_stack64 ptr v h = ()
let lemma_same_init_r1_free_stack128 start finish h = ()
let lemma_same_init_r1_store_stack128 ptr v h = ()
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t
let valid_taint_stack128 ptr t stackTaint =
Map.sel stackTaint ptr = t &&
Map.sel stackTaint (ptr + 1) = t &&
Map.sel stackTaint (ptr + 2) = t &&
Map.sel stackTaint (ptr + 3) = t &&
Map.sel stackTaint (ptr + 4) = t &&
Map.sel stackTaint (ptr + 5) = t &&
Map.sel stackTaint (ptr + 6) = t &&
Map.sel stackTaint (ptr + 7) = t &&
Map.sel stackTaint (ptr + 8) = t &&
Map.sel stackTaint (ptr + 9) = t &&
Map.sel stackTaint (ptr + 10) = t &&
Map.sel stackTaint (ptr + 11) = t &&
Map.sel stackTaint (ptr + 12) = t &&
Map.sel stackTaint (ptr + 13) = t &&
Map.sel stackTaint (ptr + 14) = t &&
Map.sel stackTaint (ptr + 15) = t
let store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t
let store_taint_stack128 ptr t stackTaint = BS.update_n ptr 16 stackTaint t
let lemma_valid_taint_stack64 ptr t stackTaint = ()
let lemma_valid_taint_stack128 ptr t stackTaint = ()
let lemma_valid_taint_stack64_reveal ptr t stackTaint = ()
let lemma_correct_store_load_taint_stack64 ptr t stackTaint = ()
let lemma_frame_store_load_taint_stack64 ptr t stackTaint i t' = ()
let lemma_valid_taint_stack128_reveal ptr t stackTaint = ()
let lemma_correct_store_load_taint_stack128 ptr t stackTaint = ()
let lemma_frame_store_load_taint_stack128 ptr t stackTaint i t' = ()
let lemma_store_stack_same_valid64_128 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap128_reveal ();
BS.update_heap32_reveal () | false | false | Vale.PPC64LE.Stack_i.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 lemma_frame_store_load_stack64_128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 16 \/ i + 8 <= ptr))
(ensures (load_stack64 i (store_stack128 ptr v h) == load_stack64 i h))
[SMTPat (load_stack64 i (store_stack128 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_frame_store_load_stack64_128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ptr: Prims.int ->
v: Vale.PPC64LE.Memory.quad32 ->
h: Vale.PPC64LE.Stack_i.vale_stack ->
i: Prims.int
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 i h /\ (i >= ptr + 16 \/ i + 8 <= ptr))
(ensures
Vale.PPC64LE.Stack_i.load_stack64 i (Vale.PPC64LE.Stack_i.store_stack128 ptr v h) ==
Vale.PPC64LE.Stack_i.load_stack64 i h)
[SMTPat (Vale.PPC64LE.Stack_i.load_stack64 i (Vale.PPC64LE.Stack_i.store_stack128 ptr v h))] | {
"end_col": 29,
"end_line": 167,
"start_col": 50,
"start_line": 164
} |
FStar.Pervasives.Lemma | val lemma_store_new_valid64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma
(valid_src_stack64 ptr (store_stack64 ptr v h))
[SMTPat (valid_src_stack64 ptr (store_stack64 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | val lemma_store_new_valid64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma
(valid_src_stack64 ptr (store_stack64 ptr v h))
[SMTPat (valid_src_stack64 ptr (store_stack64 ptr v h))]
let lemma_store_new_valid64 ptr v h = | false | null | true | reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.Arch.MachineHeap_s.update_heap64_reveal",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Prims.bool",
"Vale.Arch.MachineHeap_s.valid_addr64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | false | false | Vale.PPC64LE.Stack_i.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_store_new_valid64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma
(valid_src_stack64 ptr (store_stack64 ptr v h))
[SMTPat (valid_src_stack64 ptr (store_stack64 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_store_new_valid64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack64 ptr (Vale.PPC64LE.Stack_i.store_stack64 ptr v h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack64 ptr
(Vale.PPC64LE.Stack_i.store_stack64 ptr v h))
] | {
"end_col": 28,
"end_line": 45,
"start_col": 2,
"start_line": 44
} |
FStar.Pervasives.Lemma | val lemma_store_stack_same_valid64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 8 \/ i + 8 <= ptr))
(ensures valid_src_stack64 i (store_stack64 ptr v h))
[SMTPat (valid_src_stack64 i (store_stack64 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | val lemma_store_stack_same_valid64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 8 \/ i + 8 <= ptr))
(ensures valid_src_stack64 i (store_stack64 ptr v h))
[SMTPat (valid_src_stack64 i (store_stack64 ptr v h))]
let lemma_store_stack_same_valid64 ptr v h i = | false | null | true | reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.Arch.MachineHeap_s.update_heap64_reveal",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Prims.bool",
"Vale.Arch.MachineHeap_s.valid_addr64"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40" | false | false | Vale.PPC64LE.Stack_i.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_store_stack_same_valid64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack64 i h /\
(i >= ptr + 8 \/ i + 8 <= ptr))
(ensures valid_src_stack64 i (store_stack64 ptr v h))
[SMTPat (valid_src_stack64 i (store_stack64 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_store_stack_same_valid64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ptr: Prims.int -> v: Vale.PPC64LE.Memory.nat64 -> h: Vale.PPC64LE.Stack_i.vale_stack -> i: Prims.int
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr))
(ensures Vale.PPC64LE.Stack_i.valid_src_stack64 i (Vale.PPC64LE.Stack_i.store_stack64 ptr v h)
)
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack64 i
(Vale.PPC64LE.Stack_i.store_stack64 ptr v h))
] | {
"end_col": 28,
"end_line": 24,
"start_col": 2,
"start_line": 23
} |
FStar.Pervasives.Lemma | val lemma_store_stack_same_valid128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack128 i h /\
(i >= ptr + 16 \/ i + 16 <= ptr))
(ensures valid_src_stack128 i (store_stack128 ptr v h))
[SMTPat (valid_src_stack128 i (store_stack128 ptr v h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal () | val lemma_store_stack_same_valid128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack128 i h /\
(i >= ptr + 16 \/ i + 16 <= ptr))
(ensures valid_src_stack128 i (store_stack128 ptr v h))
[SMTPat (valid_src_stack128 i (store_stack128 ptr v h))]
let lemma_store_stack_same_valid128 ptr v h i = | false | null | true | reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal () | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.Arch.MachineHeap_s.update_heap128_reveal",
"Prims.unit",
"Vale.Arch.MachineHeap_s.update_heap32_reveal",
"FStar.Pervasives.reveal_opaque",
"Vale.Arch.MachineHeap_s.machine_heap",
"Prims.bool",
"Vale.Arch.MachineHeap_s.valid_addr128"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) | false | false | Vale.PPC64LE.Stack_i.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": 40,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_store_stack_same_valid128 (ptr:int) (v:quad32) (h:vale_stack) (i:int) : Lemma
(requires valid_src_stack128 i h /\
(i >= ptr + 16 \/ i + 16 <= ptr))
(ensures valid_src_stack128 i (store_stack128 ptr v h))
[SMTPat (valid_src_stack128 i (store_stack128 ptr v h))] | [] | Vale.PPC64LE.Stack_i.lemma_store_stack_same_valid128 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ptr: Prims.int ->
v: Vale.PPC64LE.Memory.quad32 ->
h: Vale.PPC64LE.Stack_i.vale_stack ->
i: Prims.int
-> FStar.Pervasives.Lemma
(requires Vale.PPC64LE.Stack_i.valid_src_stack128 i h /\ (i >= ptr + 16 \/ i + 16 <= ptr))
(ensures
Vale.PPC64LE.Stack_i.valid_src_stack128 i (Vale.PPC64LE.Stack_i.store_stack128 ptr v h))
[
SMTPat (Vale.PPC64LE.Stack_i.valid_src_stack128 i
(Vale.PPC64LE.Stack_i.store_stack128 ptr v h))
] | {
"end_col": 29,
"end_line": 35,
"start_col": 2,
"start_line": 33
} |
FStar.Pervasives.Lemma | val lemma_compose_free_stack64 (start:int) (inter:int) (finish:int) (h:vale_stack) : Lemma
(requires start <= inter /\ inter <= finish)
(ensures free_stack64 inter finish (free_stack64 start inter h) == free_stack64 start finish h)
[SMTPat (free_stack64 inter finish (free_stack64 start inter h))] | [
{
"abbrev": false,
"full_module": "Vale.Arch.MachineHeap",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.PPC64LE.Semantics_s",
"short_module": "BS"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE",
"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 lemma_compose_free_stack64 start inter finish h =
let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i)
= Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in Classical.forall_intro aux;
assert (Map.equal mem1 mem2) | val lemma_compose_free_stack64 (start:int) (inter:int) (finish:int) (h:vale_stack) : Lemma
(requires start <= inter /\ inter <= finish)
(ensures free_stack64 inter finish (free_stack64 start inter h) == free_stack64 start finish h)
[SMTPat (free_stack64 inter finish (free_stack64 start inter h))]
let lemma_compose_free_stack64 start inter finish h = | false | null | true | let Machine_stack _ mem = h in
let domain = Map.domain mem in
let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in
let restrict = Map.domain map_restr in
let Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in
let Machine_stack _ mem2 = free_stack64 start finish h in
let aux (i: int)
: Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i) =
Vale.Lib.Set.remove_between_reveal domain start inter i;
Vale.Lib.Set.remove_between_reveal restrict inter finish i;
Vale.Lib.Set.remove_between_reveal domain start finish i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i;
Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i
in
Classical.forall_intro aux;
assert (Map.equal mem1 mem2) | {
"checked_file": "Vale.PPC64LE.Stack_i.fst.checked",
"dependencies": [
"Vale.PPC64LE.Semantics_s.fst.checked",
"Vale.Lib.Set.fsti.checked",
"Vale.Arch.MachineHeap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.PPC64LE.Stack_i.fst"
} | [
"lemma"
] | [
"Prims.int",
"Vale.PPC64LE.Stack_i.vale_stack",
"Vale.PPC64LE.Machine_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Vale.PPC64LE.Machine_s.nat8",
"Prims._assert",
"FStar.Map.equal",
"Prims.unit",
"FStar.Classical.forall_intro",
"Prims.l_and",
"Prims.op_Equality",
"Prims.bool",
"FStar.Map.contains",
"FStar.Map.sel",
"Prims.l_True",
"Prims.squash",
"Vale.Def.Words_s.nat8",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Vale.Lib.Set.lemma_sel_restrict",
"Vale.Lib.Set.remove_between",
"Vale.Lib.Set.remove_between_reveal",
"Vale.PPC64LE.Stack_i.free_stack64",
"FStar.Set.set",
"FStar.Map.domain",
"FStar.Map.restrict"
] | [] | module Vale.PPC64LE.Stack_i
open FStar.Mul
module BS = Vale.PPC64LE.Semantics_s
open Vale.Arch.MachineHeap
let vale_stack = machine_stack
let valid_src_stack64 i st = BS.valid_src_stack64 i st
let load_stack64 i st = BS.eval_stack i st
let store_stack64 i v h = BS.update_stack64' i v h
let free_stack64 start finish h = BS.free_stack' start finish h
let valid_src_stack128 i st = BS.valid_src_stack128 i st
let load_stack128 i st = BS.eval_stack128 i st
let store_stack128 i v h = BS.update_stack128' i v h
let free_stack128 start finish h = BS.free_stack' start finish h
let init_r1 h = h.initial_r1
(* Lemmas *)
#push-options "--z3rlimit 40"
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_stack_same_valid128 ptr v h i =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
let lemma_free_stack_same_valid128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
BS.update_heap64_reveal ()
let lemma_store_new_valid128 ptr v h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
BS.update_heap32_reveal ();
BS.update_heap128_reveal ()
#pop-options
let lemma_correct_store_load_stack64 ptr v h =
let Machine_stack _ mem = h in
correct_update_get64 ptr v mem
let lemma_frame_store_load_stack64 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap64 ptr v mem;
BS.get_heap_val64_reveal ()
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val64_reveal ()
let lemma_correct_store_load_stack128 ptr v h =
let Machine_stack _ mem = h in
correct_update_get128 ptr v mem
let lemma_frame_store_load_stack128 ptr v h i =
let Machine_stack _ mem = h in
frame_update_heap128 ptr v mem;
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal ()
let lemma_free_stack_same_load128 start finish ptr h =
reveal_opaque (`%BS.valid_addr128) BS.valid_addr128;
let Machine_stack _ mem = h in
let domain = Map.domain mem in
Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish);
BS.get_heap_val32_reveal ();
BS.get_heap_val128_reveal () | false | false | Vale.PPC64LE.Stack_i.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 lemma_compose_free_stack64 (start:int) (inter:int) (finish:int) (h:vale_stack) : Lemma
(requires start <= inter /\ inter <= finish)
(ensures free_stack64 inter finish (free_stack64 start inter h) == free_stack64 start finish h)
[SMTPat (free_stack64 inter finish (free_stack64 start inter h))] | [] | Vale.PPC64LE.Stack_i.lemma_compose_free_stack64 | {
"file_name": "vale/code/arch/ppc64le/Vale.PPC64LE.Stack_i.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | start: Prims.int -> inter: Prims.int -> finish: Prims.int -> h: Vale.PPC64LE.Stack_i.vale_stack
-> FStar.Pervasives.Lemma (requires start <= inter /\ inter <= finish)
(ensures
Vale.PPC64LE.Stack_i.free_stack64 inter
finish
(Vale.PPC64LE.Stack_i.free_stack64 start inter h) ==
Vale.PPC64LE.Stack_i.free_stack64 start finish h)
[
SMTPat (Vale.PPC64LE.Stack_i.free_stack64 inter
finish
(Vale.PPC64LE.Stack_i.free_stack64 start inter h))
] | {
"end_col": 30,
"end_line": 102,
"start_col": 53,
"start_line": 87
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 n = 32 | let n = | false | null | false | 32 | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val n : Prims.int | [] | FStar.UInt32.n | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.int | {
"end_col": 17,
"end_line": 20,
"start_col": 15,
"start_line": 20
} |
|
Prims.Tot | val eq (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | val eq (a b: t) : Tot bool
let eq (a b: t) : Tot bool = | false | null | false | eq #n (v a) (v b) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt.eq",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val eq (a b: t) : Tot bool | [] | FStar.UInt32.eq | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 49,
"end_line": 223,
"start_col": 32,
"start_line": 223
} |
Prims.Tot | val lte (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) | val lte (a b: t) : Tot bool
let lte (a b: t) : Tot bool = | false | null | false | lte #n (v a) (v b) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt.lte",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lte (a b: t) : Tot bool | [] | FStar.UInt32.lte | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 51,
"end_line": 235,
"start_col": 33,
"start_line": 235
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Star_Percent_Hat = mul_mod | let op_Star_Percent_Hat = | false | null | false | mul_mod | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.mul_mod"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Star_Percent_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 40,
"end_line": 323,
"start_col": 33,
"start_line": 323
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Subtraction_Percent_Hat = sub_mod | let op_Subtraction_Percent_Hat = | false | null | false | sub_mod | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.sub_mod"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Subtraction_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Subtraction_Percent_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 47,
"end_line": 320,
"start_col": 40,
"start_line": 320
} |
|
Prims.Tot | val lt (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) | val lt (a b: t) : Tot bool
let lt (a b: t) : Tot bool = | false | null | false | lt #n (v a) (v b) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt.lt",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lt (a b: t) : Tot bool | [] | FStar.UInt32.lt | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 49,
"end_line": 232,
"start_col": 32,
"start_line": 232
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Subtraction_Question_Hat = sub_underspec | let op_Subtraction_Question_Hat = | false | null | false | sub_underspec | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.sub_underspec"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Subtraction_Question_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Subtraction_Question_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 54,
"end_line": 319,
"start_col": 41,
"start_line": 319
} |
|
Prims.Tot | val gte (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) | val gte (a b: t) : Tot bool
let gte (a b: t) : Tot bool = | false | null | false | gte #n (v a) (v b) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt.gte",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gte (a b: t) : Tot bool | [] | FStar.UInt32.gte | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 51,
"end_line": 229,
"start_col": 33,
"start_line": 229
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Subtraction_Hat = sub | let op_Subtraction_Hat = | false | null | false | sub | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.sub"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Subtraction_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Subtraction_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 35,
"end_line": 318,
"start_col": 32,
"start_line": 318
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Plus_Question_Hat = add_underspec | let op_Plus_Question_Hat = | false | null | false | add_underspec | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.add_underspec"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *) | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Plus_Question_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Plus_Question_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 47,
"end_line": 316,
"start_col": 34,
"start_line": 316
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Plus_Hat = add | let op_Plus_Hat = | false | null | false | add | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.add"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Plus_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Plus_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 28,
"end_line": 315,
"start_col": 25,
"start_line": 315
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Plus_Percent_Hat = add_mod | let op_Plus_Percent_Hat = | false | null | false | add_mod | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.add_mod"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Plus_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Plus_Percent_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 40,
"end_line": 317,
"start_col": 33,
"start_line": 317
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Star_Question_Hat = mul_underspec | let op_Star_Question_Hat = | false | null | false | mul_underspec | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.mul_underspec"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Question_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Star_Question_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 47,
"end_line": 322,
"start_col": 34,
"start_line": 322
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Star_Hat = mul | let op_Star_Hat = | false | null | false | mul | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.mul"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Star_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 28,
"end_line": 321,
"start_col": 25,
"start_line": 321
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Bar_Hat = logor | let op_Bar_Hat = | false | null | false | logor | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.logor"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Bar_Hat : x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Bar_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 29,
"end_line": 328,
"start_col": 24,
"start_line": 328
} |
|
Prims.Tot | val gt (a b: t) : Tot bool | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) | val gt (a b: t) : Tot bool
let gt (a b: t) : Tot bool = | false | null | false | gt #n (v a) (v b) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt.gt",
"FStar.UInt32.n",
"FStar.UInt32.v",
"Prims.bool"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gt (a b: t) : Tot bool | [] | FStar.UInt32.gt | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 49,
"end_line": 226,
"start_col": 32,
"start_line": 226
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Hat_Hat = logxor | let op_Hat_Hat = | false | null | false | logxor | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.logxor"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Hat_Hat : x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Hat_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 30,
"end_line": 326,
"start_col": 24,
"start_line": 326
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Percent_Hat = rem | let op_Percent_Hat = | false | null | false | rem | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.rem"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Percent_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Percent_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t | {
"end_col": 31,
"end_line": 325,
"start_col": 28,
"start_line": 325
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Greater_Equals_Hat = gte | let op_Greater_Equals_Hat = | false | null | false | gte | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.gte"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Equals_Hat = eq | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Equals_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | [] | FStar.UInt32.op_Greater_Equals_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 38,
"end_line": 333,
"start_col": 35,
"start_line": 333
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Greater_Greater_Hat = shift_right | let op_Greater_Greater_Hat = | false | null | false | shift_right | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.shift_right"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Greater_Hat : a: FStar.UInt32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Greater_Greater_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 47,
"end_line": 330,
"start_col": 36,
"start_line": 330
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Less_Hat = lt | let op_Less_Hat = | false | null | false | lt | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.lt"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Equals_Hat = eq
unfold let op_Greater_Hat = gt | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Less_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | [] | FStar.UInt32.op_Less_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 27,
"end_line": 334,
"start_col": 25,
"start_line": 334
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Greater_Hat = gt | let op_Greater_Hat = | false | null | false | gt | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.gt"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Greater_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | [] | FStar.UInt32.op_Greater_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 30,
"end_line": 332,
"start_col": 28,
"start_line": 332
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Slash_Hat = div | let op_Slash_Hat = | false | null | false | div | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.div"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Slash_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Slash_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t | {
"end_col": 29,
"end_line": 324,
"start_col": 26,
"start_line": 324
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Amp_Hat = logand | let op_Amp_Hat = | false | null | false | logand | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.logand"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Amp_Hat : x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Amp_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.UInt32.t -> y: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 30,
"end_line": 327,
"start_col": 24,
"start_line": 327
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Equals_Hat = eq | let op_Equals_Hat = | false | null | false | eq | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.eq"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Equals_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | [] | FStar.UInt32.op_Equals_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 29,
"end_line": 331,
"start_col": 27,
"start_line": 331
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Less_Less_Hat = shift_left | let op_Less_Less_Hat = | false | null | false | shift_left | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.shift_left"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Less_Less_Hat : a: FStar.UInt32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | [] | FStar.UInt32.op_Less_Less_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 40,
"end_line": 329,
"start_col": 30,
"start_line": 329
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 op_Less_Equals_Hat = lte | let op_Less_Equals_Hat = | false | null | false | lte | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.lte"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c
#reset-options
(*** Infix notations *)
unfold let op_Plus_Hat = add
unfold let op_Plus_Question_Hat = add_underspec
unfold let op_Plus_Percent_Hat = add_mod
unfold let op_Subtraction_Hat = sub
unfold let op_Subtraction_Question_Hat = sub_underspec
unfold let op_Subtraction_Percent_Hat = sub_mod
unfold let op_Star_Hat = mul
unfold let op_Star_Question_Hat = mul_underspec
unfold let op_Star_Percent_Hat = mul_mod
unfold let op_Slash_Hat = div
unfold let op_Percent_Hat = rem
unfold let op_Hat_Hat = logxor
unfold let op_Amp_Hat = logand
unfold let op_Bar_Hat = logor
unfold let op_Less_Less_Hat = shift_left
unfold let op_Greater_Greater_Hat = shift_right
unfold let op_Equals_Hat = eq
unfold let op_Greater_Hat = gt
unfold let op_Greater_Equals_Hat = gte | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Less_Equals_Hat : a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | [] | FStar.UInt32.op_Less_Equals_Hat | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.bool | {
"end_col": 35,
"end_line": 335,
"start_col": 32,
"start_line": 335
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 minus (a:t) = add_mod (lognot a) (uint_to_t 1) | let minus (a: t) = | false | null | false | add_mod (lognot a) (uint_to_t 1) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.t",
"FStar.UInt32.add_mod",
"FStar.UInt32.lognot",
"FStar.UInt32.uint_to_t"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val minus : a: FStar.UInt32.t -> FStar.UInt32.t | [] | FStar.UInt32.minus | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> FStar.UInt32.t | {
"end_col": 50,
"end_line": 239,
"start_col": 18,
"start_line": 239
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 n_minus_one = uint_to_t (n - 1) | let n_minus_one = | false | null | false | uint_to_t (n - 1) | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [
"total"
] | [
"FStar.UInt32.uint_to_t",
"Prims.op_Subtraction",
"FStar.UInt32.n"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *) | false | true | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val n_minus_one : FStar.UInt32.t | [] | FStar.UInt32.n_minus_one | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | FStar.UInt32.t | {
"end_col": 35,
"end_line": 243,
"start_col": 18,
"start_line": 243
} |
|
Prims.Pure | val gte_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\ (v a < v b ==> v c = 0))) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\
(v a < v b ==> v c = 0)))
= let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c | val gte_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\ (v a < v b ==> v c = 0)))
let gte_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\ (v a < v b ==> v c = 0))) = | false | null | false | let x = a in
let y = b in
let x_xor_y = logxor x y in
let x_sub_y = sub_mod x y in
let x_sub_y_xor_y = logxor x_sub_y y in
let q = logor x_xor_y x_sub_y_xor_y in
let x_xor_q = logxor x q in
let x_xor_q_ = shift_right x_xor_q n_minus_one in
let c = sub_mod x_xor_q_ (uint_to_t 1) in
lemma_sub_msbs x y;
lemma_msb_gte (v x) (v y);
lemma_msb_gte (v y) (v x);
c | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.t",
"Prims.unit",
"FStar.UInt.lemma_msb_gte",
"FStar.UInt32.n",
"FStar.UInt32.v",
"FStar.UInt32.lemma_sub_msbs",
"FStar.UInt32.sub_mod",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.shift_right",
"FStar.UInt32.n_minus_one",
"FStar.UInt32.logxor",
"FStar.UInt32.logor",
"Prims.l_True",
"Prims.l_and",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_LessThan"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c
private
val lemma_sub_msbs (a:t) (b:t)
: Lemma ((msb (v a) = msb (v b)) ==> (v a < v b <==> msb (v (sub_mod a b))))
(** A constant-time way to compute the [>=] inequality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=0a483a9b431d87eca1b275463c632f8d5551978a
*)
[@ CNoInline ]
let gte_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\ | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 80,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gte_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a >= v b ==> v c = pow2 n - 1) /\ (v a < v b ==> v c = 0))) | [] | FStar.UInt32.gte_mask | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 5,
"end_line": 311,
"start_col": 3,
"start_line": 299
} |
Prims.Pure | val eq_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\ (v a <> v b ==> v c = 0))) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"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 eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\
(v a <> v b ==> v c = 0)))
= let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b then
begin
logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\
v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n)
end
else
begin
logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n)
end;
c | val eq_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\ (v a <> v b ==> v c = 0)))
let eq_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\ (v a <> v b ==> v c = 0))) = | false | null | false | let x = logxor a b in
let minus_x = minus x in
let x_or_minus_x = logor x minus_x in
let xnx = shift_right x_or_minus_x n_minus_one in
let c = sub_mod xnx (uint_to_t 1) in
if a = b
then
(logxor_self (v a);
lognot_lemma_1 #n;
logor_lemma_1 (v x);
assert (v x = 0 /\ v minus_x = 0 /\ v x_or_minus_x = 0 /\ v xnx = 0);
assert (v c = ones n))
else
(logxor_neq_nonzero (v a) (v b);
lemma_msb_pow2 #n (v (lognot x));
lemma_msb_pow2 #n (v minus_x);
lemma_minus_zero #n (v x);
assert (v c = FStar.UInt.zero n));
c | {
"checked_file": "FStar.UInt32.fsti.checked",
"dependencies": [
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.UInt32.fsti"
} | [] | [
"FStar.UInt32.t",
"Prims.unit",
"Prims.op_Equality",
"Prims._assert",
"Prims.b2t",
"FStar.UInt.uint_t",
"FStar.UInt32.n",
"FStar.UInt32.v",
"FStar.UInt.ones",
"Prims.l_and",
"Prims.int",
"FStar.UInt.logor_lemma_1",
"FStar.UInt.lognot_lemma_1",
"FStar.UInt.logxor_self",
"Prims.bool",
"FStar.UInt.zero",
"FStar.UInt.lemma_minus_zero",
"FStar.UInt.lemma_msb_pow2",
"FStar.UInt32.lognot",
"FStar.UInt.logxor_neq_nonzero",
"FStar.UInt32.sub_mod",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.shift_right",
"FStar.UInt32.n_minus_one",
"FStar.UInt32.logor",
"FStar.UInt32.minus",
"FStar.UInt32.logxor",
"Prims.l_True",
"Prims.l_imp",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_disEquality"
] | [] | (*
Copyright 2008-2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt32
(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
unfold let n = 32
/// For FStar.UIntN.fstp: anything that you fix/update here should be
/// reflected in [FStar.IntN.fstp], which is mostly a copy-paste of
/// this module.
///
/// Except, as compared to [FStar.IntN.fstp], here:
/// - every occurrence of [int_t] has been replaced with [uint_t]
/// - every occurrence of [@%] has been replaced with [%].
/// - some functions (e.g., add_underspec, etc.) are only defined here, not on signed integers
/// This module provides an abstract type for machine integers of a
/// given signedness and width. The interface is designed to be safe
/// with respect to arithmetic underflow and overflow.
/// Note, we have attempted several times to re-design this module to
/// make it more amenable to normalization and to impose less overhead
/// on the SMT solver when reasoning about machine integer
/// arithmetic. The following github issue reports on the current
/// status of that work.
///
/// https://github.com/FStarLang/FStar/issues/1757
open FStar.UInt
open FStar.Mul
#set-options "--max_fuel 0 --max_ifuel 0"
(** Abstract type of machine integers, with an underlying
representation using a bounded mathematical integer *)
new val t : eqtype
(** A coercion that projects a bounded mathematical integer from a
machine integer *)
val v (x:t) : Tot (uint_t n)
(** A coercion that injects a bounded mathematical integers into a
machine integer *)
val uint_to_t (x:uint_t n) : Pure t
(requires True)
(ensures (fun y -> v y = x))
(** Injection/projection inverse *)
val uv_inv (x : t) : Lemma
(ensures (uint_to_t (v x) == x))
[SMTPat (v x)]
(** Projection/injection inverse *)
val vu_inv (x : uint_t n) : Lemma
(ensures (v (uint_to_t x) == x))
[SMTPat (uint_to_t x)]
(** An alternate form of the injectivity of the [v] projection *)
val v_inj (x1 x2: t): Lemma
(requires (v x1 == v x2))
(ensures (x1 == x2))
(** Constants 0 and 1 *)
val zero : x:t{v x = 0}
val one : x:t{v x = 1}
(**** Addition primitives *)
(** Bounds-respecting addition
The precondition enforces that the sum does not overflow,
expressing the bound as an addition on mathematical integers *)
val add (a:t) (b:t) : Pure t
(requires (size (v a + v b) n))
(ensures (fun c -> v a + v b = v c))
(** Underspecified, possibly overflowing addition:
The postcondition only enures that the result is the sum of the
arguments in case there is no overflow *)
val add_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a + v b) n ==> v a + v b = v c))
(** Addition modulo [2^n]
Machine integers can always be added, but the postcondition is now
in terms of addition modulo [2^n] on mathematical integers *)
val add_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.add_mod (v a) (v b) = v c))
(**** Subtraction primitives *)
(** Bounds-respecting subtraction
The precondition enforces that the difference does not underflow,
expressing the bound as a difference on mathematical integers *)
val sub (a:t) (b:t) : Pure t
(requires (size (v a - v b) n))
(ensures (fun c -> v a - v b = v c))
(** Underspecified, possibly overflowing subtraction:
The postcondition only enures that the result is the difference of
the arguments in case there is no underflow *)
val sub_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a - v b) n ==> v a - v b = v c))
(** Subtraction modulo [2^n]
Machine integers can always be subtractd, but the postcondition is
now in terms of subtraction modulo [2^n] on mathematical integers *)
val sub_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.sub_mod (v a) (v b) = v c))
(**** Multiplication primitives *)
(** Bounds-respecting multiplication
The precondition enforces that the product does not overflow,
expressing the bound as a product on mathematical integers *)
val mul (a:t) (b:t) : Pure t
(requires (size (v a * v b) n))
(ensures (fun c -> v a * v b = v c))
(** Underspecified, possibly overflowing product
The postcondition only enures that the result is the product of
the arguments in case there is no overflow *)
val mul_underspec (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c ->
size (v a * v b) n ==> v a * v b = v c))
(** Multiplication modulo [2^n]
Machine integers can always be multiplied, but the postcondition
is now in terms of product modulo [2^n] on mathematical integers *)
val mul_mod (a:t) (b:t) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mul_mod (v a) (v b) = v c))
(**** Division primitives *)
(** Euclidean division of [a] and [b], with [b] non-zero *)
val div (a:t) (b:t{v b <> 0}) : Pure t
(requires (True))
(ensures (fun c -> v a / v b = v c))
(**** Modulo primitives *)
(** Euclidean remainder
The result is the modulus of [a] with respect to a non-zero [b] *)
val rem (a:t) (b:t{v b <> 0}) : Pure t
(requires True)
(ensures (fun c -> FStar.UInt.mod (v a) (v b) = v c))
(**** Bitwise operators *)
/// Also see FStar.BV
(** Bitwise logical conjunction *)
val logand (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logand` v y = v z))
(** Bitwise logical exclusive-or *)
val logxor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logxor` v y == v z))
(** Bitwise logical disjunction *)
val logor (x:t) (y:t) : Pure t
(requires True)
(ensures (fun z -> v x `logor` v y == v z))
(** Bitwise logical negation *)
val lognot (x:t) : Pure t
(requires True)
(ensures (fun z -> lognot (v x) == v z))
(**** Shift operators *)
(** Shift right with zero fill, shifting at most the integer width *)
val shift_right (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_right (v a) (v s) = v c))
(** Shift left with zero fill, shifting at most the integer width *)
val shift_left (a:t) (s:t) : Pure t
(requires (v s < n))
(ensures (fun c -> FStar.UInt.shift_left (v a) (v s) = v c))
(**** Comparison operators *)
(** Equality
Note, it is safe to also use the polymorphic decidable equality
operator [=] *)
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
(** Greater than *)
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
(** Greater than or equal *)
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
(** Less than *)
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
(** Less than or equal *)
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
(** Unary negation *)
inline_for_extraction
let minus (a:t) = add_mod (lognot a) (uint_to_t 1)
(** The maximum value for this type *)
inline_for_extraction
let n_minus_one = uint_to_t (n - 1)
#set-options "--z3rlimit 80 --initial_fuel 1 --max_fuel 1"
(** A constant-time way to compute the equality of
two machine integers.
With inspiration from https://git.zx2c4.com/WireGuard/commit/src/crypto/curve25519-hacl64.h?id=2e60bb395c1f589a398ec606d611132ef9ef764b
Note, the branching on [a=b] is just for proof-purposes.
*)
[@ CNoInline ]
let eq_mask (a:t) (b:t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\ | false | false | FStar.UInt32.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 80,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val eq_mask (a b: t)
: Pure t
(requires True)
(ensures (fun c -> (v a = v b ==> v c = pow2 n - 1) /\ (v a <> v b ==> v c = 0))) | [] | FStar.UInt32.eq_mask | {
"file_name": "ulib/FStar.UInt32.fsti",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t | {
"end_col": 5,
"end_line": 282,
"start_col": 3,
"start_line": 260
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) | let stt_vprop_post_equiv_univ_inst u = | false | null | false | R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_UInst",
"Pulse.Soundness.Common.stt_vprop_post_equiv_fv",
"Prims.Cons",
"Prims.Nil",
"FStar.Reflection.Types.term"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var)
let frame_type (u:R.universe) =
let var = 3 in
let t = mk_name var in
let t_type = RT.tm_type u in
mk_arrow (t_type, R.Q_Implicit)
(RT.close_term (frame_type_t u t) var)
(** Type of sub_stt **) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val stt_vprop_post_equiv_univ_inst : u105: FStar.Reflection.Types.universe -> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.stt_vprop_post_equiv_univ_inst | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | u105: FStar.Reflection.Types.universe -> FStar.Reflection.Types.term | {
"end_col": 89,
"end_line": 269,
"start_col": 39,
"start_line": 269
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ]) | let bind_type (u1 u2: R.universe) = | false | null | false | let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [RT.ND var 0]) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.Typing.subst_term",
"Pulse.Soundness.Common.bind_type_t1",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Reflection.Typing.tm_type",
"Pulse.Reflection.Util.mk_name",
"Prims.int"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ]) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_type : u1: FStar.Reflection.Types.universe -> u2: FStar.Reflection.Types.universe
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.bind_type | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | u1: FStar.Reflection.Types.universe -> u2: FStar.Reflection.Types.universe
-> FStar.Reflection.Types.term | {
"end_col": 42,
"end_line": 218,
"start_col": 34,
"start_line": 212
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 sub_stt_pre2 u t pre1 post1 =
let var = 1 in
let pre2 = mk_name var in
let pre2_type = vprop_tm in
mk_arrow (pre2_type, R.Q_Explicit)
(RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) | let sub_stt_pre2 u t pre1 post1 = | false | null | false | let var = 1 in
let pre2 = mk_name var in
let pre2_type = vprop_tm in
mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.Typing.close_term",
"Pulse.Soundness.Common.sub_stt_post2",
"Pulse.Reflection.Util.vprop_tm",
"Pulse.Reflection.Util.mk_name",
"Prims.int"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var)
let frame_type (u:R.universe) =
let var = 3 in
let t = mk_name var in
let t_type = RT.tm_type u in
mk_arrow (t_type, R.Q_Implicit)
(RT.close_term (frame_type_t u t) var)
(** Type of sub_stt **)
let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u])
let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) =
R.mk_app (stt_vprop_post_equiv_univ_inst u)
[(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)]
let sub_stt_res u t pre post = mk_stt_comp u t pre post
let sub_stt_equiv_post u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit)
(sub_stt_res u t pre2 post2)
let sub_stt_equiv_pre u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit)
(sub_stt_equiv_post u t pre1 pre2 post1 post2)
let sub_stt_post2 u t pre1 post1 pre2 =
let var = 0 in
let post2 = mk_name var in
let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post2_type, R.Q_Explicit)
(RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sub_stt_pre2 : u135: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre1: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.sub_stt_pre2 | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u135: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre1: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 66,
"end_line": 296,
"start_col": 33,
"start_line": 291
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var) | let frame_type_t (u: R.universe) (t: R.term) = | false | null | false | let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.Typing.close_term",
"Pulse.Soundness.Common.frame_type_t_pre",
"Pulse.Reflection.Util.vprop_tm",
"Pulse.Reflection.Util.mk_name",
"Prims.int"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val frame_type_t : u103: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.frame_type_t | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | u103: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 57,
"end_line": 256,
"start_col": 44,
"start_line": 251
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ]) | let bind_type_t1 (u1 u2: R.universe) (t1: R.term) = | false | null | false | let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [RT.ND var 0]) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.Typing.subst_term",
"Pulse.Soundness.Common.bind_type_t1_t2",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Reflection.Typing.tm_type",
"Pulse.Reflection.Util.mk_name",
"Prims.int"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ]) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_type_t1 : u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.bind_type_t1 | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 42,
"end_line": 210,
"start_col": 49,
"start_line": 204
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) | let frame_res (u: R.universe) (t pre post frame: R.term) = | false | null | false | mk_stt_comp u
t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_stt_comp",
"Pulse.Soundness.Common.mk_star",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"Pulse.Reflection.Util.bound_var",
"Prims.Nil"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val frame_res : u89: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
frame: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.frame_res | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u89: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
frame: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 101,
"end_line": 230,
"start_col": 4,
"start_line": 228
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 ln_comp = c:comp_st { ln_c c } | let ln_comp = | false | null | false | c: comp_st{ln_c c} | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"Pulse.Syntax.Base.comp_st",
"Prims.b2t",
"Pulse.Syntax.Naming.ln_c"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate | false | true | Pulse.Soundness.Common.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 ln_comp : Type0 | [] | Pulse.Soundness.Common.ln_comp | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | Type0 | {
"end_col": 34,
"end_line": 12,
"start_col": 14,
"start_line": 12
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] | let mk_star (l r: R.term) = | false | null | false | let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_FVar",
"FStar.Reflection.V2.Builtins.pack_fv",
"Pulse.Reflection.Util.star_lid"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mk_star : l: FStar.Reflection.Types.term -> r: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.mk_star | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | l: FStar.Reflection.Types.term -> r: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 50,
"end_line": 225,
"start_col": 2,
"start_line": 223
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ]) | let bind_type_t1_t2_pre (u1 u2: R.universe) (t1 t2 pre: R.term) = | false | null | false | let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [RT.ND var 0]) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"Pulse.Soundness.Common.post1_type_bind",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.Typing.subst_term",
"Pulse.Soundness.Common.bind_type_t1_t2_pre_post1",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"Pulse.Reflection.Util.mk_name",
"Prims.int"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ]) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_type_t1_t2_pre : u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.bind_type_t1_t2_pre | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 42,
"end_line": 194,
"start_col": 63,
"start_line": 189
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm | let post2_type_bind t2 = | false | null | false | mk_arrow (t2, R.Q_Explicit) vprop_tm | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Reflection.Util.vprop_tm"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val post2_type_bind : t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.post2_type_bind | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 61,
"end_line": 180,
"start_col": 25,
"start_line": 180
} |
|
Prims.GTot | val tot_typing_soundness (#g: env) (#e #t: term) (d: tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d | val tot_typing_soundness (#g: env) (#e #t: term) (d: tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
let tot_typing_soundness (#g: env) (#e #t: term) (d: tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = | false | null | false | let E d = d in
d | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"sometrivial"
] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"FStar.Reflection.Typing.typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Reflection.Types.typ",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Reflection.Typing.tot_typing"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t) | false | false | Pulse.Soundness.Common.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 tot_typing_soundness (#g: env) (#e #t: term) (d: tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) | [] | Pulse.Soundness.Common.tot_typing_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | d: Pulse.Typing.tot_typing g e t
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Pure.elab_term e)
(Pulse.Elaborate.Pure.elab_term t)) | {
"end_col": 5,
"end_line": 52,
"start_col": 3,
"start_line": 51
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2) | let bind_type_t1_t2_pre_post1_post2_f (u1 u2: R.universe) (t1 t2 pre post1 post2: R.term) = | false | null | false | mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"Pulse.Soundness.Common.g_type_bind",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Soundness.Common.bind_res"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_type_t1_t2_pre_post1_post2_f : u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.bind_type_t1_t2_pre_post1_post2_f | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 37,
"end_line": 173,
"start_col": 2,
"start_line": 172
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm | let post1_type_bind t1 = | false | null | false | mk_arrow (t1, R.Q_Explicit) vprop_tm | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Reflection.Util.vprop_tm"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ]) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val post1_type_bind : t1: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.post1_type_bind | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | t1: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 61,
"end_line": 188,
"start_col": 25,
"start_line": 188
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) | let g_type_bind (u2: R.universe) (t1 t2 post1 post2: R.term) = | false | null | false | mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0, R.Q_Explicit]) post2) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Soundness.Common.bind_res",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Reflection.V2.Data.argv",
"Pulse.Reflection.Util.bound_var",
"Prims.Nil"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2 | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val g_type_bind : u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.g_type_bind | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 88,
"end_line": 169,
"start_col": 4,
"start_line": 168
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 stt_env = e:env { has_stt_bindings (fstar_env e) } | let stt_env = | false | null | false | e: env{has_stt_bindings (fstar_env e)} | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"Pulse.Typing.Env.env",
"Pulse.Soundness.Common.has_stt_bindings",
"Pulse.Typing.Env.fstar_env"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var)
let frame_type (u:R.universe) =
let var = 3 in
let t = mk_name var in
let t_type = RT.tm_type u in
mk_arrow (t_type, R.Q_Implicit)
(RT.close_term (frame_type_t u t) var)
(** Type of sub_stt **)
let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u])
let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) =
R.mk_app (stt_vprop_post_equiv_univ_inst u)
[(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)]
let sub_stt_res u t pre post = mk_stt_comp u t pre post
let sub_stt_equiv_post u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit)
(sub_stt_res u t pre2 post2)
let sub_stt_equiv_pre u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit)
(sub_stt_equiv_post u t pre1 pre2 post1 post2)
let sub_stt_post2 u t pre1 post1 pre2 =
let var = 0 in
let post2 = mk_name var in
let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post2_type, R.Q_Explicit)
(RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var)
let sub_stt_pre2 u t pre1 post1 =
let var = 1 in
let pre2 = mk_name var in
let pre2_type = vprop_tm in
mk_arrow (pre2_type, R.Q_Explicit)
(RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var)
let sub_stt_post1 u t pre1 =
let var = 2 in
let post1 = mk_name var in
let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post1_type, R.Q_Explicit)
(RT.close_term (sub_stt_pre2 u t pre1 post1) var)
let sub_stt_pre1 u t =
let var = 3 in
let pre1 = mk_name var in
let pre1_type = vprop_tm in
mk_arrow (pre1_type, R.Q_Explicit)
(RT.close_term (sub_stt_post1 u t pre1) var)
let sub_stt_type u =
let var = 4 in
let t = mk_name var in
let ty_typ = RT.tm_type u in
mk_arrow (ty_typ, R.Q_Explicit)
(RT.close_term (sub_stt_pre1 u t) var)
(** Properties of environments suitable for elaboration **)
let has_stt_bindings (f:RT.fstar_top_env) =
RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\
RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True
//(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\
//(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\
//(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val stt_env : Type0 | [] | Pulse.Soundness.Common.stt_env | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | Type0 | {
"end_col": 54,
"end_line": 328,
"start_col": 14,
"start_line": 328
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) | let bind_type_t1_t2_pre_post1_post2 (u1 u2: R.universe) (t1 t2 pre post1 post2: R.term) = | false | null | false | let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Soundness.Common.bind_type_t1_t2_pre_post1_post2_f",
"Pulse.Reflection.Util.mk_stt_comp"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bind_type_t1_t2_pre_post1_post2 : u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.bind_type_t1_t2_pre_post1_post2 | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 74,
"end_line": 178,
"start_col": 87,
"start_line": 175
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 sub_stt_res u t pre post = mk_stt_comp u t pre post | let sub_stt_res u t pre post = | false | null | false | mk_stt_comp u t pre post | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_stt_comp"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var)
let frame_type (u:R.universe) =
let var = 3 in
let t = mk_name var in
let t_type = RT.tm_type u in
mk_arrow (t_type, R.Q_Implicit)
(RT.close_term (frame_type_t u t) var)
(** Type of sub_stt **)
let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u])
let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) =
R.mk_app (stt_vprop_post_equiv_univ_inst u)
[(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sub_stt_res : u113: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.sub_stt_res | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u113: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 55,
"end_line": 274,
"start_col": 31,
"start_line": 274
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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 sub_stt_equiv_pre u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit)
(sub_stt_equiv_post u t pre1 pre2 post1 post2) | let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = | false | null | false | mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"Pulse.Reflection.Util.stt_vprop_equiv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Soundness.Common.sub_stt_equiv_post"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var)
let frame_type (u:R.universe) =
let var = 3 in
let t = mk_name var in
let t_type = RT.tm_type u in
mk_arrow (t_type, R.Q_Implicit)
(RT.close_term (frame_type_t u t) var)
(** Type of sub_stt **)
let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u])
let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) =
R.mk_app (stt_vprop_post_equiv_univ_inst u)
[(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)]
let sub_stt_res u t pre post = mk_stt_comp u t pre post
let sub_stt_equiv_post u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit)
(sub_stt_res u t pre2 post2) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sub_stt_equiv_pre : u126: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre1: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
pre2: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.sub_stt_equiv_pre | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u126: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre1: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
pre2: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 57,
"end_line": 282,
"start_col": 2,
"start_line": 281
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let soundness_t (d:'a) =
g:stt_env ->
t:st_term ->
c:comp ->
d':st_typing g t c{d' << d} ->
GTot (RT.tot_typing (elab_env g)
(elab_st_typing d')
(elab_comp c)) | let soundness_t (d: 'a) = | false | null | false | g: stt_env -> t: st_term -> c: comp -> d': st_typing g t c {d' << d}
-> GTot (RT.tot_typing (elab_env g) (elab_st_typing d') (elab_comp c)) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_typing",
"Prims.precedes",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Core.elab_st_typing",
"Pulse.Elaborate.Pure.elab_comp"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame)
let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var)
let frame_type_t_pre (u:R.universe) (t pre:R.term) =
let var = 1 in
let post = mk_name var in
let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t (u:R.universe) (t:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.close_term (frame_type_t_pre u t pre) var)
let frame_type (u:R.universe) =
let var = 3 in
let t = mk_name var in
let t_type = RT.tm_type u in
mk_arrow (t_type, R.Q_Implicit)
(RT.close_term (frame_type_t u t) var)
(** Type of sub_stt **)
let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u])
let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) =
R.mk_app (stt_vprop_post_equiv_univ_inst u)
[(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)]
let sub_stt_res u t pre post = mk_stt_comp u t pre post
let sub_stt_equiv_post u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit)
(sub_stt_res u t pre2 post2)
let sub_stt_equiv_pre u t pre1 post1 pre2 post2 =
mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit)
(sub_stt_equiv_post u t pre1 pre2 post1 post2)
let sub_stt_post2 u t pre1 post1 pre2 =
let var = 0 in
let post2 = mk_name var in
let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post2_type, R.Q_Explicit)
(RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var)
let sub_stt_pre2 u t pre1 post1 =
let var = 1 in
let pre2 = mk_name var in
let pre2_type = vprop_tm in
mk_arrow (pre2_type, R.Q_Explicit)
(RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var)
let sub_stt_post1 u t pre1 =
let var = 2 in
let post1 = mk_name var in
let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in
mk_arrow (post1_type, R.Q_Explicit)
(RT.close_term (sub_stt_pre2 u t pre1 post1) var)
let sub_stt_pre1 u t =
let var = 3 in
let pre1 = mk_name var in
let pre1_type = vprop_tm in
mk_arrow (pre1_type, R.Q_Explicit)
(RT.close_term (sub_stt_post1 u t pre1) var)
let sub_stt_type u =
let var = 4 in
let t = mk_name var in
let ty_typ = RT.tm_type u in
mk_arrow (ty_typ, R.Q_Explicit)
(RT.close_term (sub_stt_pre1 u t) var)
(** Properties of environments suitable for elaboration **)
let has_stt_bindings (f:RT.fstar_top_env) =
RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\
RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True
//(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\
//(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\
//(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u))
let stt_env = e:env { has_stt_bindings (fstar_env e) }
let check_top_level_environment (f:RT.fstar_top_env)
: option stt_env
= admit(); Some (mk_env f) //we should implement this as a runtime check
let elab_comp_post (c:comp_st) : R.term =
let t = elab_term (comp_res c) in
let post = elab_term (comp_post c) in
mk_abs t R.Q_Explicit post
let comp_post_type (c:comp_st) : R.term =
let t = elab_term (comp_res c) in
mk_arrow (t, R.Q_Explicit) vprop_tm
assume
val inversion_of_stt_typing (g:env) (c:comp_st)
(u:R.universe)
// _ |- stt u#u t pre (fun (x:t) -> post) : Type _
(_:RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type u))
: GTot ( // _ |- t : Type u#u
RT.tot_typing (elab_env g)
(elab_term (comp_res c))
(RT.tm_type (comp_u c)) &
// _ |- pre : vprop
RT.tot_typing (elab_env g)
(elab_term (comp_pre c))
(elab_term (tm_vprop)) &
// _ |- (fun (x:t) -> post) : t -> vprop
RT.tot_typing (elab_env g)
(elab_comp_post c)
(elab_term (tm_arrow (null_binder (comp_res c)) None (C_Tot tm_vprop)))) | false | false | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val soundness_t : d: 'a -> Type0 | [] | Pulse.Soundness.Common.soundness_t | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | d: 'a -> Type0 | {
"end_col": 38,
"end_line": 368,
"start_col": 4,
"start_line": 362
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) =
let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit)
(RT.close_term (frame_res u t pre post frame) var) | let frame_type_t_pre_post (u: R.universe) (t pre post: R.term) = | false | null | false | let var = 0 in
let frame = mk_name var in
mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) | {
"checked_file": "Pulse.Soundness.Common.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Soundness.Common.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"Pulse.Reflection.Util.mk_arrow",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"Pulse.Reflection.Util.vprop_tm",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.Typing.close_term",
"Pulse.Soundness.Common.frame_res",
"Pulse.Reflection.Util.mk_name",
"Prims.int"
] | [] | module Pulse.Soundness.Common
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate
let ln_comp = c:comp_st { ln_c c }
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes)
: Lemma
(ensures
RT.lookup_fvar_uinst (extend_env_l g sg) fv us ==
RT.lookup_fvar_uinst g fv us)
[SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
= match sg with
| [] -> ()
| hd::tl -> extend_env_l_lookup_fvar g tl fv us
let elab_term_opt (b:option term) =
match b with
| Some b -> Some (elab_term b)
| None -> None
// let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var)
// : Lemma
// (requires (forall x. RT.lookup_bvar g x == None))
// (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x)))
// (decreases sg)
// [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]
// = match sg with
// | [] -> ()
// | hd :: tl -> extend_env_l_lookup_bvar g tl x
let lookup_elab_env (g:env) (x:var)
: Lemma
(ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x)))
[SMTPat (RT.lookup_bvar (elab_env g) x)]
= admit () // TODO: FIX ME!!!!
let tot_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:tot_typing g e t)
: GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
let ghost_typing_soundness (#g:env)
(#e:term)
(#t:term)
(d:ghost_typing g e t)
: GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
= let E d = d in
d
#push-options "--z3rlimit_factor 4"
let mk_t_abs_tot (g:env)
(#u:universe)
(#q:option qualifier)
(#ty:term)
(ppname:ppname)
(t_typing:tot_typing g ty (tm_type u))
(#body:term)
(#body_ty:term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) })
(body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty)
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body))
(elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))))
= let c = C_Tot body_ty in
let r_ty = elab_term ty in
let r_body = elab_term (open_term body x) in
let r_c = elab_comp c in
let r_t_typing = tot_typing_soundness t_typing in
let r_body_typing = tot_typing_soundness body_typing in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
elab_freevars body;
assert (~ (x `Set.mem` RT.freevars (elab_term body)));
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
assert (elab_term (tm_type u) == RT.tm_type u);
let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u)
= coerce_eq () r_t_typing //strange that this coercion is needed
in
let d : RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (elab_term (open_term body x)) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))
=
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
in
elab_open_commute' body (null_var x) 0;
RT.open_term_spec (elab_term body) x;
assert (elab_term (open_term body x) ==
RT.open_term (elab_term body) x);
let d : RT.typing _
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q)
(RT.close_term (RT.open_term (elab_term body) x) x))
_
= d
in
RT.close_open_inverse (elab_term body) x;
d
let mk_t_abs (g:env)
(#u:universe)
(#ty:term)
(#q:option qualifier)
(#t_typing:typing g ty T.E_Total (tm_type u))
(ppname:ppname)
(r_t_typing:RT.tot_typing (elab_env g)
(elab_term ty)
(elab_comp (C_Tot (tm_type u))))
(#body:st_term)
(#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) })
(#c:comp)
(#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c)
(r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty))
(elab_st_typing body_typing)
(elab_comp c))
: GTot (RT.tot_typing (elab_env g)
(mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x))
(elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x))))
= let r_ty = elab_term ty in
let r_body = elab_st_typing body_typing in
let r_c = elab_comp c in
RT.well_typed_terms_are_ln _ _ _ r_body_typing;
RT.open_close_inverse r_body x;
elab_comp_close_commute c x;
assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x)));
RT.close_term_spec (elab_comp c) x;
RT.T_Abs (elab_env g)
x
r_ty
(RT.close_term r_body x)
(T.E_Total, r_c)
u ppname.name (elab_qual q)
_
r_t_typing
r_body_typing
(*** Typing of combinators used
in the elaboration **)
(** Type of bind **)
let bind_res (u2:R.universe) (t2 pre post2:R.term) =
mk_stt_comp u2 t2 pre post2
let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) =
mk_arrow (t1, R.Q_Explicit)
(bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2)
let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit)
(bind_res u2 t2 pre post2)
let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) =
let f_type = mk_stt_comp u1 t1 pre post1 in
mk_arrow (f_type, R.Q_Explicit)
(bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) =
let var = 0 in
let post2 = mk_name var in
mk_arrow (post2_type_bind t2, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2)
[ RT.ND var 0 ])
let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm
let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) =
let var = 1 in
let post1 = mk_name var in
mk_arrow (post1_type_bind t1, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1)
[ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) =
let var = 2 in
let pre = mk_name var in
let pre_type = vprop_tm in
mk_arrow (pre_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre)
[ RT.ND var 0 ])
let bind_type_t1 (u1 u2:R.universe) (t1:R.term) =
let var = 3 in
let t2 = mk_name var in
let t2_type = RT.tm_type u2 in
mk_arrow (t2_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2)
[ RT.ND var 0 ])
let bind_type (u1 u2:R.universe) =
let var = 4 in
let t1 = mk_name var in
let t1_type = RT.tm_type u1 in
mk_arrow (t1_type, R.Q_Implicit)
(RT.subst_term (bind_type_t1 u1 u2 t1)
[ RT.ND var 0 ])
(** Type of frame **)
let mk_star (l r:R.term) =
let open R in
let head = pack_ln (Tv_FVar (pack_fv star_lid)) in
R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)]
let frame_res (u:R.universe) (t pre post frame:R.term) =
mk_stt_comp u t
(mk_star pre frame)
(mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) =
let open R in
let f_type = mk_stt_comp u t pre post in
mk_arrow (f_type, Q_Explicit)
(frame_res u t pre post frame) | false | true | Pulse.Soundness.Common.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": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val frame_type_t_pre_post : u98: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Soundness.Common.frame_type_t_pre_post | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u98: FStar.Reflection.Types.universe ->
t: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 61,
"end_line": 242,
"start_col": 62,
"start_line": 238
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.