file_name
stringlengths
5
52
name
stringlengths
4
95
original_source_type
stringlengths
0
23k
source_type
stringlengths
9
23k
source_definition
stringlengths
9
57.9k
source
dict
source_range
dict
file_context
stringlengths
0
721k
dependencies
dict
opens_and_abbrevs
listlengths
2
94
vconfig
dict
interleaved
bool
1 class
verbose_type
stringlengths
1
7.42k
effect
stringclasses
118 values
effect_flags
listlengths
0
2
mutual_with
listlengths
0
11
ideal_premises
listlengths
0
236
proof_features
listlengths
0
1
is_simple_lemma
bool
2 classes
is_div
bool
2 classes
is_proof
bool
2 classes
is_simply_typed
bool
2 classes
is_type
bool
2 classes
partial_definition
stringlengths
5
3.99k
completed_definiton
stringlengths
1
1.63M
isa_cross_project_example
bool
1 class
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.type_of_var
val type_of_var (x: namedv) : Tac typ
val type_of_var (x: namedv) : Tac typ
let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 34, "end_line": 52, "start_col": 0, "start_line": 51 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
x: FStar.Tactics.NamedView.namedv -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.typ
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.namedv", "FStar.Tactics.Unseal.unseal", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Reflection.V2.Data.__proj__Mknamedv_view__item__sort", "FStar.Tactics.NamedView.inspect_namedv" ]
[]
false
true
false
false
false
let type_of_var (x: namedv) : Tac typ =
unseal ((inspect_namedv x).sort)
false
Vale.AES.X64.AESopt.fst
Vale.AES.X64.AESopt.va_wpProof_Loop6x_partial
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0) -> Ghost (va_state & va_fuel & quad32_6) (requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0) -> Ghost (va_state & va_fuel & quad32_6) (requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0, init) = va_lemma_Loop6x_partial (va_code_Loop6x_partial alg) va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = (init) in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.AES.X64.AESopt.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 2216, "start_col": 0, "start_line": 2196 }
module Vale.AES.X64.AESopt open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open FStar.Seq open Vale.Arch.Types open Vale.Arch.HeapImpl open Vale.AES.AES_s open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.AES.AES_helpers //open Vale.Poly1305.Math // For lemma_poly_bits64() open Vale.AES.GCM_helpers open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.Arch.TypesNative open Vale.X64.CPU_Features_s open Vale.Math.Poly2_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.AES.GHash open Vale.AES.X64.PolyOps open Vale.AES.X64.AESopt2 open Vale.AES.X64.AESGCM_expected_code open Vale.Transformers.Transform open FStar.Mul let add = Vale.Math.Poly2_s.add #reset-options "--z3rlimit 30" //-- finish_aes_encrypt_le val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32) -> Lemma (requires (Vale.AES.AES_s.is_aes_key_LE alg key)) (ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key))) let finish_aes_encrypt_le alg input_LE key = Vale.AES.AES_s.aes_encrypt_LE_reveal (); Vale.AES.AES_s.eval_cipher_reveal (); () //-- //-- Load_two_lsb [@ "opaque_to_smt"] let va_code_Load_two_lsb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) [@ "opaque_to_smt"] let va_codegen_success_Load_two_lsb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@"opaque_to_smt"] let va_lemma_Load_two_lsb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0; assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2); let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_two_lsb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_0xc2_msb val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code [@ "opaque_to_smt"] let va_code_Load_0xc2_msb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Load_0xc2_msb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_Load_0xc2_msb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0 3254779904) == 13979173243358019584); Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904; let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (()))) val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Load_0xc2_msb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) = (va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) (va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst)) //-- //-- Load_one_lsb [@ "opaque_to_smt"] let va_code_Load_one_lsb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) [@ "opaque_to_smt"] let va_codegen_success_Load_one_lsb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@"opaque_to_smt"] let va_lemma_Load_one_lsb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_one_lsb) (va_code_Load_one_lsb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 1 0; assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 1 0) == 1); let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 1 0 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_one_lsb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_one_lsb (va_code_Load_one_lsb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Handle_ctr32 val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Handle_ctr32 () = (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load_two_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CNil ())))))))))))))))))))) val va_codegen_success_Handle_ctr32 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Handle_ctr32 () = (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Load_two_lsb (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_ttrue ()))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Handle_ctr32 (va_mods:va_mods_t) (ctr_BE:quad32) : (va_quickCode unit (va_code_Handle_ctr32 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 261 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_one_lsb (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 262 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 263 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_two_lsb (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 264 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 265 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 266 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 267 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 268 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 269 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 270 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 271 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 272 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 273 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 274 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 275 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 276 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_QEmpty (()))))))))))))))))))))) val va_lemma_Handle_ctr32 : va_b0:va_code -> va_s0:va_state -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Handle_ctr32 ()) va_s0 /\ va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))))))))))))) [@"opaque_to_smt"] let va_lemma_Handle_ctr32 va_b0 va_s0 ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_ok] in let va_qc = va_qcode_Handle_ctr32 va_mods ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Handle_ctr32 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 234 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 254 column 107 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Handle_ctr32 (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE) /\ (forall (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) ==> va_k va_sM (()))) val va_wpProof_Handle_ctr32 : ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Handle_ctr32 ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Handle_ctr32 ()) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Handle_ctr32 ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Handle_ctr32 (va_code_Handle_ctr32 ()) va_s0 ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Handle_ctr32 (ctr_BE:quad32) : (va_quickCode unit (va_code_Handle_ctr32 ())) = (va_QProc (va_code_Handle_ctr32 ()) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) (va_wp_Handle_ctr32 ctr_BE) (va_wpProof_Handle_ctr32 ctr_BE)) //-- //-- Loop6x_ctr_update val va_code_Loop6x_ctr_update : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_ctr_update alg = (va_Block (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_CCons (va_IfElse (va_cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_Handle_ctr32 ()) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_CNil ()))))) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CNil ()))))))) (va_CNil ())))) val va_codegen_success_Loop6x_ctr_update : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_ctr_update alg = (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_pbool_and (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_Handle_ctr32 ()) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)))))))) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_ctr_update (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_ctr_update alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 339 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 340 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qIf va_mods (Cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret hkeys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Handle_ctr32 ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_QEmpty (())))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret hkeys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 348 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg36:Prims.nat) = va_get_reg64 rRbx va_old_s in let (va_arg35:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg34:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in let (va_arg33:Vale.Def.Types_s.quad32) = ctr_BE in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 349 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_msb_in_bounds va_arg33 va_arg34 va_arg35 va_arg36) (va_QEmpty (()))))))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) val va_lemma_Loop6x_ctr_update : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_ctr_update alg) va_s0 /\ va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM) /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM va_s0)))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_ctr_update va_b0 va_s0 alg h_LE key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok] in let va_qc = va_qcode_Loop6x_ctr_update va_mods alg h_LE key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_ctr_update alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 279 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in label va_range1 "***** POSTCONDITION NOT MET AT line 330 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 331 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 334 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 335 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_ctr_update (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h) /\ (forall (va_x_rbx:nat64) (va_x_r11:nat64) (va_x_xmm3:quad32) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_xmm 3 va_x_xmm3 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx va_s0)))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM) /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Loop6x_ctr_update : alg:algorithm -> h_LE:quad32 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_ctr_update alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_ctr_update (va_code_Loop6x_ctr_update alg) va_s0 alg h_LE key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM va_s0))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_ctr_update (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_ctr_update alg)) = (va_QProc (va_code_Loop6x_ctr_update alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) (va_wp_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE) (va_wpProof_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE)) //-- //-- Loop6x_plain val va_code_Loop6x_plain : alg:algorithm -> rnd:nat -> rndkey:va_operand_xmm -> Tot va_code [@ "opaque_to_smt"] let va_code_Loop6x_plain alg rnd rndkey = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey) (va_CNil ()))))))))) val va_codegen_success_Loop6x_plain : alg:algorithm -> rnd:nat -> rndkey:va_operand_xmm -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Loop6x_plain alg rnd rndkey = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey) (va_ttrue ())))))))) val va_lemma_Loop6x_plain : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> rnd:nat -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> init:quad32_6 -> rndkey:va_operand_xmm -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_plain alg rnd rndkey) va_s0 /\ va_is_dst_xmm rndkey va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ (rndkey == 1 \/ rndkey == 2 \/ rndkey == 15) /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ rnd + 1 < FStar.Seq.Base.length #quad32 round_keys /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys rnd))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (rnd + 1) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_operand_xmm rndkey va_sM va_s0))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_plain va_b0 va_s0 alg rnd key_words round_keys keys_b init rndkey = va_reveal_opaque (`%va_code_Loop6x_plain) (va_code_Loop6x_plain alg rnd rndkey); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s9, va_fc9) = va_lemma_Load128_buffer (va_hd va_b1) va_s0 (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret keys_b (rnd + 1) in let va_b9 = va_tl va_b1 in let (va_s10, va_fc10) = va_lemma_VAESNI_enc (va_hd va_b9) va_s9 (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey in let va_b10 = va_tl va_b9 in let (va_s11, va_fc11) = va_lemma_VAESNI_enc (va_hd va_b10) va_s10 (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey in let va_b11 = va_tl va_b10 in let (va_s12, va_fc12) = va_lemma_VAESNI_enc (va_hd va_b11) va_s11 (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey in let va_b12 = va_tl va_b11 in let (va_s13, va_fc13) = va_lemma_VAESNI_enc (va_hd va_b12) va_s12 (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey in let va_b13 = va_tl va_b12 in let (va_s14, va_fc14) = va_lemma_VAESNI_enc (va_hd va_b13) va_s13 (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey in let va_b14 = va_tl va_b13 in let (va_s15, va_fc15) = va_lemma_VAESNI_enc (va_hd va_b14) va_s14 (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey in let va_b15 = va_tl va_b14 in Vale.AES.AES_s.eval_rounds_reveal (); Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall (); let (va_sM, va_f15) = va_lemma_empty_total va_s15 va_b15 in let va_f14 = va_lemma_merge_total va_b14 va_s14 va_fc15 va_s15 va_f15 va_sM in let va_f13 = va_lemma_merge_total va_b13 va_s13 va_fc14 va_s14 va_f14 va_sM in let va_f12 = va_lemma_merge_total va_b12 va_s12 va_fc13 va_s13 va_f13 va_sM in let va_f11 = va_lemma_merge_total va_b11 va_s11 va_fc12 va_s12 va_f12 va_sM in let va_f10 = va_lemma_merge_total va_b10 va_s10 va_fc11 va_s11 va_f11 va_sM in let va_f9 = va_lemma_merge_total va_b9 va_s9 va_fc10 va_s10 va_f10 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc9 va_s9 va_f9 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_plain (alg:algorithm) (rnd:nat) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (init:quad32_6) (rndkey:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_xmm rndkey va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ (rndkey == 1 \/ rndkey == 2 \/ rndkey == 15) /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ rnd + 1 < FStar.Seq.Base.length #quad32 round_keys /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys rnd) /\ (forall (va_x_rndkey:va_value_xmm) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_operand_xmm rndkey va_x_rndkey va_s0))))))) in va_get_ok va_sM /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (rnd + 1) ==> va_k va_sM (()))) val va_wpProof_Loop6x_plain : alg:algorithm -> rnd:nat -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> init:quad32_6 -> rndkey:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_plain alg rnd rndkey) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_plain (va_code_Loop6x_plain alg rnd rndkey) va_s0 alg rnd key_words round_keys keys_b init rndkey in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_operand_xmm rndkey va_sM va_s0)))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_plain (alg:algorithm) (rnd:nat) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (init:quad32_6) (rndkey:va_operand_xmm) : (va_quickCode unit (va_code_Loop6x_plain alg rnd rndkey)) = (va_QProc (va_code_Loop6x_plain alg rnd rndkey) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) (va_wp_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey) (va_wpProof_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey)) //-- //-- Loop6x_preamble val va_code_Loop6x_preamble : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_preamble alg = (va_Block (va_CCons (va_code_Loop6x_ctr_update alg) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_CNil ()))))))) val va_codegen_success_Loop6x_preamble : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_preamble alg = (va_pbool_and (va_codegen_success_Loop6x_ctr_update alg) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_preamble (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_preamble alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE) (fun (va_s:va_state) _ -> let (va_arg43:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg42:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 479 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg42 va_arg43) (let (va_arg41:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg40:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 480 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg40 va_arg41) (let (va_arg39:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg38:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 481 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg38 va_arg39) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 498 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret scratch_b 8) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg37:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg36:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 499 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg36 va_arg37) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 500 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg35:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg34:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 500 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg34 va_arg35) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 501 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg33:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg32:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 501 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg32 va_arg33) (va_QEmpty (())))))))))))))) val va_lemma_Loop6x_preamble : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 -> iv_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_preamble alg) va_s0 /\ va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8 /\ (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0 /\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_preamble va_b0 va_s0 alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_preamble va_mods alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_preamble alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 402 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in label va_range1 "***** POSTCONDITION NOT MET AT line 459 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 464 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in label va_range1 "***** POSTCONDITION NOT MET AT line 466 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 469 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 472 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 473 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 475 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_preamble (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_r11:nat64) (va_x_xmm3:quad32) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_xmm 3 va_x_xmm3 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem va_x_mem va_s0)))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8 /\ (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0 /\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))) ==> va_k va_sM (()))) val va_wpProof_Loop6x_preamble : alg:algorithm -> h_LE:quad32 -> iv_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_preamble alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_preamble (va_code_Loop6x_preamble alg) va_s0 alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_preamble (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_preamble alg)) = (va_QProc (va_code_Loop6x_preamble alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_wpProof_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)) //-- //-- Loop6x_reverse128 val va_code_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_reverse128 in0_offset stack_offset = (va_Block (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true) (va_CNil ())))))) val va_codegen_success_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_reverse128 in0_offset stack_offset = (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_reverse128 (va_mods:va_mods_t) (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) : (va_quickCode unit (va_code_Loop6x_reverse128 in0_offset stack_offset)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 527 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true in0_b (start + in0_offset)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 528 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false in0_b (start + in0_offset)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 529 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false scratch_b stack_offset) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 530 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true scratch_b stack_offset) (fun (va_s:va_state) _ -> let (va_arg10:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_s) in let (va_arg9:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_old_s) in let (va_arg8:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_old_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 531 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.lemma_reverse_bytes_quad32_64 va_arg8 va_arg9 va_arg10) (va_QEmpty (())))))))) val va_lemma_Loop6x_reverse128 : va_b0:va_code -> va_s0:va_state -> in0_offset:nat -> stack_offset:nat -> start:nat -> in0_b:buffer128 -> scratch_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_reverse128 in0_offset stack_offset) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b start (in0_offset + 1) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b (stack_offset + 1) (va_get_mem_layout va_s0) Secret))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset /\ Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_reverse128 va_b0 va_s0 in0_offset stack_offset start in0_b scratch_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_reverse128 va_mods in0_offset stack_offset start in0_b scratch_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_reverse128 in0_offset stack_offset) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 504 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 523 column 94 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_reverse128 (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b start (in0_offset + 1) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b (stack_offset + 1) (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_heap3:vale_heap) . let va_sM = va_upd_mem_heaplet 3 va_x_heap3 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12 (va_upd_mem va_x_mem va_s0))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset /\ Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))) ==> va_k va_sM (()))) val va_wpProof_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> start:nat -> in0_b:buffer128 -> scratch_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_reverse128 in0_offset stack_offset) ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_reverse128 (va_code_Loop6x_reverse128 in0_offset stack_offset) va_s0 in0_offset stack_offset start in0_b scratch_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_reverse128 (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) : (va_quickCode unit (va_code_Loop6x_reverse128 in0_offset stack_offset)) = (va_QProc (va_code_Loop6x_reverse128 in0_offset stack_offset) ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) (va_wp_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b) (va_wpProof_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b)) //-- //-- Loop6x_round9 val va_code_Loop6x_round9 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_round9 alg = (va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_CNil ()))))))))))))))) val va_codegen_success_Loop6x_round9 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_round9 alg = (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_ttrue ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_round9 (va_mods:va_mods_t) (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Loop6x_round9 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 567 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret scratch_b 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 568 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret in_b (count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 568 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 569 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret in_b (count `op_Multiply` 6 + 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 569 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret in_b (count `op_Multiply` 6 + 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret in_b (count `op_Multiply` 6 + 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret in_b (count `op_Multiply` 6 + 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 573 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret in_b (count `op_Multiply` 6 + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 573 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_QEmpty (())))))))))))))))) val va_lemma_Loop6x_round9 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> count:nat -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_round9 alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 1 va_s0 == Vale.X64.Decls.buffer128_read keys_b (Vale.AES.AES_common_s.nr alg) (va_get_mem_heaplet 0 va_s0)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1 /\ (va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_round9 va_b0 va_s0 alg count in_b scratch_b key_words round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_round9 va_mods alg count in_b scratch_b key_words round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_round9 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 561 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 563 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 564 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_round9 (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 1 va_s0 == Vale.X64.Decls.buffer128_read keys_b (Vale.AES.AES_common_s.nr alg) (va_get_mem_heaplet 0 va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM = va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_mem va_x_mem va_s0))))))))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1 /\ (va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0) ==> va_k va_sM (()))) val va_wpProof_Loop6x_round9 : alg:algorithm -> count:nat -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_round9 alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_round9 (va_code_Loop6x_round9 alg) va_s0 alg count in_b scratch_b key_words round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_round9 (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Loop6x_round9 alg)) = (va_QProc (va_code_Loop6x_round9 alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) (va_wp_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b) (va_wpProof_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b)) //-- //-- load_one_msb val va_code_load_one_msb : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_load_one_msb () = (va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 2)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) val va_codegen_success_load_one_msb : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_load_one_msb () = (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_load_one_msb (va_mods:va_mods_t) : (va_quickCode unit (va_code_load_one_msb ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 583 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ZeroXmm (va_op_xmm_xmm 2)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 584 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0 16777216) == 72057594037927936) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 585 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 586 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Def.Types_s.insert_nat64_reveal ()) (va_QEmpty (()))))))) val va_lemma_load_one_msb : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_load_one_msb ()) va_s0 /\ va_get_ok va_s0 /\ sse_enabled)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_load_one_msb va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok] in let va_qc = va_qcode_load_one_msb va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_load_one_msb ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 576 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 581 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_load_one_msb (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_r11:nat64) (va_x_xmm2:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 2 va_x_xmm2 (va_upd_reg64 rR11 va_x_r11 va_s0)) in va_get_ok va_sM /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 ==> va_k va_sM (()))) val va_wpProof_load_one_msb : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_load_one_msb va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_load_one_msb ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_load_one_msb va_s0 va_k = let (va_sM, va_f0) = va_lemma_load_one_msb (va_code_load_one_msb ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_load_one_msb () : (va_quickCode unit (va_code_load_one_msb ())) = (va_QProc (va_code_load_one_msb ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_wp_load_one_msb va_wpProof_load_one_msb) //-- //-- Loop6x_final [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_final alg = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_CCons (va_code_load_one_msb ()) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_final alg = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_load_one_msb ()) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (va_ttrue ()))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_final (va_mods:va_mods_t) (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6) (ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 667 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes_forall ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 669 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret scratch_b 8) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 671 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 672 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_load_one_msb ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 673 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 674 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 675 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false scratch_b 7) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 676 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 677 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 678 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 679 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true scratch_b 7) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 680 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 681 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret keys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 683 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 684 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 685 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 686 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 687 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 688 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (fun (va_s:va_state) _ -> let (va_arg117:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg116:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in let (va_arg115:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_old_s in let (va_arg114:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg113:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg112:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg111:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 690 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg111 va_arg112 va_arg113 va_arg114 va_arg115 va_arg116 va_arg117) (let (va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg109:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_s in let (va_arg108:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_old_s in let (va_arg107:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg106:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg105:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg104:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 691 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg104 va_arg105 va_arg106 va_arg107 va_arg108 va_arg109 va_arg110) (let (va_arg103:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg102:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let (va_arg101:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_old_s in let (va_arg100:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg99:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg98:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg97:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 692 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg97 va_arg98 va_arg99 va_arg100 va_arg101 va_arg102 va_arg103) (let (va_arg96:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg95:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_s in let (va_arg94:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_old_s in let (va_arg93:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg92:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg91:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg90:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 693 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg90 va_arg91 va_arg92 va_arg93 va_arg94 va_arg95 va_arg96) (let (va_arg89:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg88:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_s in let (va_arg87:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_old_s in let (va_arg86:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg85:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg84:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg83:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 694 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg83 va_arg84 va_arg85 va_arg86 va_arg87 va_arg88 va_arg89) (let (va_arg82:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg81:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in let (va_arg80:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_old_s in let (va_arg79:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg78:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg77:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg76:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 695 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg76 va_arg77 va_arg78 va_arg79 va_arg80 va_arg81 va_arg82) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 696 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 697 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 698 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 699 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 700 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 701 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (let (va_arg75:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_s) in let (va_arg74:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_old_s) in let (va_arg73:Vale.Def.Types_s.quad32) = inb in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 703 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.lemma_reverse_bytes_quad32_64 va_arg73 va_arg74 va_arg75) (let (va_arg72:Vale.Def.Types_s.quad32) = va_get_xmm 0 va_s in let (va_arg71:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg70:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 705 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg70 va_arg71 va_arg72 1) (let (va_arg69:Vale.Def.Types_s.quad32) = va_get_xmm 5 va_s in let (va_arg68:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg67:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 706 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg67 va_arg68 va_arg69 2) (let (va_arg66:Vale.Def.Types_s.quad32) = va_get_xmm 6 va_s in let (va_arg65:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg64:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 707 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg64 va_arg65 va_arg66 3) (let (va_arg63:Vale.Def.Types_s.quad32) = va_get_xmm 7 va_s in let (va_arg62:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg61:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 708 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg61 va_arg62 va_arg63 4) (let (va_arg60:Vale.Def.Types_s.quad32) = va_get_xmm 3 va_s in let (va_arg59:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg58:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 709 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg58 va_arg59 va_arg60 5) (va_QEmpty (())))))))))))))))))))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_final va_b0 va_s0 alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_final va_mods alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_final alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 589 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 649 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 7 7) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 652 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 654 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32) (c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 655 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 657 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 658 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 660 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 662 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 663 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in label va_range1 "***** POSTCONDITION NOT MET AT line 665 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (ctr + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15 va_sM))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_final (va_code_Loop6x_final alg) va_s0 alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Loop6x_save_output [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_save_output () = (va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_CNil ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_save_output () = (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_ttrue ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_save_output (va_mods:va_mods_t) (count:nat) (out_b:buffer128) : (va_quickCode unit (va_code_Loop6x_save_output ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 744 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret out_b (count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 745 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 746 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret out_b (count `op_Multiply` 6 + 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 747 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 748 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret out_b (count `op_Multiply` 6 + 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 749 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 750 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret out_b (count `op_Multiply` 6 + 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 751 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 752 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret out_b (count `op_Multiply` 6 + 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 753 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 754 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret out_b (count `op_Multiply` 6 + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 755 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_QEmpty (()))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_save_output va_b0 va_s0 count out_b = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_save_output va_mods count out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_save_output ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 712 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 737 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 738 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0 (6 `op_Multiply` count)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 740 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 742 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor (va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Loop6x_save_output count out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_save_output (va_code_Loop6x_save_output ()) va_s0 count out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Loop6x_partial #push-options "--z3rlimit 50 --max_ifuel 0" [@ "opaque_to_smt" va_qattr] let va_code_untransformedoriginal_Loop6x_partial alg = (va_Block (va_CCons (va_code_Loop6x_preamble alg) (va_CCons (va_code_Loop6x_plain alg 0 (va_op_xmm_xmm 2)) (va_CCons (va_code_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_CCons (va_code_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_Loop6x_plain alg 1 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 5 2) (va_CCons (va_code_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_CCons (va_code_Loop6x_plain alg 2 (va_op_xmm_xmm 15)) (va_CCons (va_code_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 3 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 4 3) (va_CCons (va_code_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_CCons (va_code_Loop6x_plain alg 4 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 3 4) (va_CCons (va_code_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3)) (va_CCons (va_code_Loop6x_plain alg 5 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 2 5) (va_CCons (va_code_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_CCons (va_code_ReduceLast false) (va_CCons (va_code_Loop6x_plain alg 6 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 1 6) (va_CCons (va_code_Loop6x_plain alg 7 (va_op_xmm_xmm 1)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_CCons (va_code_Loop6x_plain alg 8 (va_op_xmm_xmm 15)) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 10 (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 12 (va_op_xmm_xmm 15)) (va_CNil ()))))))))))))))))) else va_Block (va_CNil ())) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_CNil ())) else va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CNil ()))) (va_CCons (va_code_Loop6x_round9 alg) (va_CNil ())))))))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_untransformedoriginal_Loop6x_partial alg = (va_pbool_and (va_codegen_success_Loop6x_preamble alg) (va_pbool_and (va_codegen_success_Loop6x_plain alg 0 (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 1 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 5 2) (va_pbool_and (va_codegen_success_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 2 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 3 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 4 3) (va_pbool_and (va_codegen_success_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 4 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 3 4) (va_pbool_and (va_codegen_success_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 5 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 2 5) (va_pbool_and (va_codegen_success_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_ReduceLast false) (va_pbool_and (va_codegen_success_Loop6x_plain alg 6 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 1 6) (va_pbool_and (va_codegen_success_Loop6x_plain alg 7 (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Loop6x_plain alg 8 (va_op_xmm_xmm 15)) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 10 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 12 (va_op_xmm_xmm 15)) (va_ttrue ())))))))))))))))) else va_ttrue ()) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_ttrue ()) else va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_ttrue ())) (va_pbool_and (va_codegen_success_Loop6x_round9 alg) (va_ttrue ()))))))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_untransformedoriginal_Loop6x_partial (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) (count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode (quad32_6) (va_code_untransformedoriginal_Loop6x_partial alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (init:quad32_6) = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_s)) in let (start:(va_int_at_least 0)) = in0_count `op_Multiply` 6 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 871 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 872 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 0 key_words round_keys keys_b init (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 873 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 874 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 875 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 1 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 876 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 5 2 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 877 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 878 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 2 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 879 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 880 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 3 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 881 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 4 3 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 882 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 883 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 4 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 884 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 3 4 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 885 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 886 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 5 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 887 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 2 5 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 888 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 891 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ReduceLast false h_LE y_prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 892 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 6 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 893 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 1 6 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 894 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 7 key_words round_keys keys_b init (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 895 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true in0_b (in0_count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 896 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false in0_b (in0_count `op_Multiply` 6 + 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 897 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 8 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 901 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qInlineIf va_mods (alg = AES_256) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 913 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret keys_b 10) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 914 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 915 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 916 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 917 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 918 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 919 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 921 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_s.eval_rounds_reveal ()) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 922 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 923 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 10 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 926 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret keys_b 12) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 927 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 928 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 929 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 930 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 931 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 932 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 934 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 12 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QEmpty (()))))))))))))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 937 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qInlineIf va_mods (alg = AES_256) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 939 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret keys_b 14) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 943 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret keys_b 10) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 946 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b) (va_QEmpty ((init)))))))))))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_untransformedoriginal_Loop6x_partial va_b0 va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_untransformedoriginal_Loop6x_partial va_mods alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_untransformedoriginal_Loop6x_partial alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let init = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 758 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in label va_range1 "***** POSTCONDITION NOT MET AT line 837 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 838 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 843 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 844 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 847 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 848 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rR13 va_sM == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 849 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rR12 va_sM == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 850 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in label va_range1 "***** POSTCONDITION NOT MET AT line 852 column 107 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 853 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 857 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 858 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 3 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 859 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 860 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 5 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 861 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 863 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (init == make_six_of #quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 864 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in label va_range1 "***** POSTCONDITION NOT MET AT line 865 column 94 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; let init = va_g in (va_sM, va_fM, init) [@ "opaque_to_smt" va_qattr] let va_transform_Loop6x_partial alg = (reorder (va_code_untransformedoriginal_Loop6x_partial alg) (va_code_Loop6x_partial_expected_code alg)) [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_partial alg = (va_get_result (va_transform_Loop6x_partial alg)) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_partial alg = (va_pbool_and (va_codegen_success_untransformedoriginal_Loop6x_partial alg) (va_get_success (va_transform_Loop6x_partial alg))) [@"opaque_to_smt"] let va_lemma_Loop6x_partial va_b0 va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let va_orig = va_code_untransformedoriginal_Loop6x_partial alg in let va_hint = va_code_Loop6x_partial_expected_code alg in let va_transformed = va_code_Loop6x_partial alg in let (va_sM_orig, va_fM_orig, init) = va_lemma_untransformedoriginal_Loop6x_partial va_orig va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_reveal_opaque (`%va_transform_Loop6x_partial) (va_transform_Loop6x_partial alg); va_reveal_opaque (`%va_code_Loop6x_partial) (va_code_Loop6x_partial alg); let (va_sM, va_fM) = lemma_reorder va_orig va_hint va_transformed va_s0 va_sM_orig va_fM_orig in (va_sM, va_fM, init)
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Flags.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Transformers.Transform.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.X64.PolyOps.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.X64.AESGCM_expected_code.fsti.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_helpers.fsti.checked", "Vale.AES.AES_common_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.AESopt.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers.Transform", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM_expected_code", "short_module": null }, { "abbrev...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "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": 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": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> h_LE: Vale.X64.Decls.quad32 -> y_prev: Vale.X64.Decls.quad32 -> data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> count: Prims.nat -> in0_count: Prims.nat -> iv_b: Vale.X64.Memory.buffer128 -> in0_b: Vale.X64.Memory.buffer128 -> in_b: Vale.X64.Memory.buffer128 -> scratch_b: Vale.X64.Memory.buffer128 -> key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> keys_b: Vale.X64.Memory.buffer128 -> hkeys_b: Vale.X64.Memory.buffer128 -> ctr_BE: Vale.X64.Decls.quad32 -> va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Vale.AES.X64.AESopt.quad32_6 -> Type0) -> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Vale.AES.X64.AESopt.quad32_6)
Prims.Ghost
[]
[]
[ "Vale.AES.AES_common_s.algorithm", "Vale.X64.Decls.quad32", "FStar.Seq.Base.seq", "Prims.nat", "Vale.X64.Memory.buffer128", "Vale.X64.Memory.nat32", "Vale.X64.Decls.va_state", "Vale.AES.X64.AESopt.quad32_6", "Vale.X64.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Prims.unit", "Vale.X64....
[]
false
false
false
false
false
let va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k =
let va_sM, va_f0, init = va_lemma_Loop6x_partial (va_code_Loop6x_partial alg) va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM ( va_update_mem va_sM va_s0 ) )) )))))))))) ))))))))))))); va_lemma_norm_mods ([ va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem ]) va_sM va_s0; let va_g = (init) in (va_sM, va_f0, va_g)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.goals
val goals: Prims.unit -> Tac (list goal)
val goals: Prims.unit -> Tac (list goal)
let goals () : Tac (list goal) = goals_of (get ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 59, "start_col": 0, "start_line": 59 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Stubs.Tactics.Types.goal)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.goals_of", "Prims.list", "FStar.Stubs.Tactics.Types.goal", "FStar.Stubs.Tactics.Types.proofstate", "FStar.Tactics.Effect.get" ]
[]
false
true
false
false
false
let goals () : Tac (list goal) =
goals_of (get ())
false
CQueue.LList.fst
CQueue.LList.cllist1
val cllist1 (#a: Type0) (c: cllist_ptrvalue a) : Tot vprop
val cllist1 (#a: Type0) (c: cllist_ptrvalue a) : Tot vprop
let cllist1 (#a: Type0) (c: cllist_ptrvalue a) : Tot vprop = emp `vrefine` cllist0_refine c `vrewrite` cllist0_rewrite c `vdep` cllist0 a `vrewrite` cllist_rewrite c
{ "file_name": "share/steel/examples/steel/CQueue.LList.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 106, "end_line": 60, "start_col": 0, "start_line": 56 }
module CQueue.LList noeq type cllist_ptrvalue (a: Type0) = { head: ref (ccell_ptrvalue a); tail: ref (ref (ccell_ptrvalue a)); all_or_none_null: squash (is_null head == is_null tail); } let cllist_ptrvalue_null a = {head = null; tail = null; all_or_none_null = ()} let cllist_ptrvalue_is_null #a x = is_null x.head let cllist_head #a c = c.head let cllist_tail #a c = c.tail #push-options "--ide_id_info_off" let cllist0_refine (#a: Type0) (c: cllist_ptrvalue a) (_: t_of emp) : Tot prop = cllist_ptrvalue_is_null c == false // unfold let cllist0_rewrite (#a: Type0) (c: cllist_ptrvalue a) (_: t_of (emp `vrefine` cllist0_refine c)) : Tot (cllist_lvalue a) = c [@@ __steel_reduce__] let cllist0 (a: Type0) (c: cllist_lvalue a) : Tot vprop = (vptr (cllist_head c) `star` vptr (cllist_tail c)) // unfold let cllist_rewrite (#a: Type0) (c: cllist_ptrvalue a) (x: dtuple2 (cllist_lvalue a) (vdep_payload (emp `vrefine` cllist0_refine c `vrewrite` cllist0_rewrite c) (cllist0 a))) : GTot (vllist a) = let p = dsnd #(cllist_lvalue a) #(vdep_payload (emp `vrefine` cllist0_refine c `vrewrite` cllist0_rewrite c) (cllist0 a)) x in { vllist_head = fst p; vllist_tail = snd p; }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "CQueue.LList.fst" }
[ { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "f...
{ "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" }
false
c: CQueue.LList.cllist_ptrvalue a -> Steel.Effect.Common.vprop
Prims.Tot
[ "total" ]
[]
[ "CQueue.LList.cllist_ptrvalue", "Steel.Effect.Common.vrewrite", "Steel.Effect.Common.vdep", "Steel.Effect.Common.vrefine", "Steel.Effect.Common.emp", "CQueue.LList.cllist0_refine", "CQueue.LList.cllist_lvalue", "CQueue.LList.cllist0_rewrite", "CQueue.LList.cllist0", "CQueue.LList.vllist", "CQueu...
[]
false
false
false
true
false
let cllist1 (#a: Type0) (c: cllist_ptrvalue a) : Tot vprop =
(((emp `vrefine` (cllist0_refine c)) `vrewrite` (cllist0_rewrite c)) `vdep` (cllist0 a)) `vrewrite` (cllist_rewrite c)
false
CQueue.LList.fst
CQueue.LList.cllist_ptrvalue_is_null
val cllist_ptrvalue_is_null (#a: Type0) (c: cllist_ptrvalue a) : Pure bool (requires True) (ensures (fun b -> b == true <==> c == cllist_ptrvalue_null a))
val cllist_ptrvalue_is_null (#a: Type0) (c: cllist_ptrvalue a) : Pure bool (requires True) (ensures (fun b -> b == true <==> c == cllist_ptrvalue_null a))
let cllist_ptrvalue_is_null #a x = is_null x.head
{ "file_name": "share/steel/examples/steel/CQueue.LList.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 49, "end_line": 12, "start_col": 0, "start_line": 12 }
module CQueue.LList noeq type cllist_ptrvalue (a: Type0) = { head: ref (ccell_ptrvalue a); tail: ref (ref (ccell_ptrvalue a)); all_or_none_null: squash (is_null head == is_null tail); } let cllist_ptrvalue_null a = {head = null; tail = null; all_or_none_null = ()}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "CQueue.LList.fst" }
[ { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "f...
{ "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" }
false
c: CQueue.LList.cllist_ptrvalue a -> Prims.Pure Prims.bool
Prims.Pure
[]
[]
[ "CQueue.LList.cllist_ptrvalue", "Steel.Reference.is_null", "CQueue.Cell.ccell_ptrvalue", "CQueue.LList.__proj__Mkcllist_ptrvalue__item__head", "Prims.bool" ]
[]
false
false
false
false
false
let cllist_ptrvalue_is_null #a x =
is_null x.head
false
CQueue.LList.fst
CQueue.LList.cllist0_rewrite
val cllist0_rewrite: #a: Type0 -> c: cllist_ptrvalue a -> t_of (emp `vrefine` (cllist0_refine c)) -> Tot (cllist_lvalue a)
val cllist0_rewrite: #a: Type0 -> c: cllist_ptrvalue a -> t_of (emp `vrefine` (cllist0_refine c)) -> Tot (cllist_lvalue a)
let cllist0_rewrite (#a: Type0) (c: cllist_ptrvalue a) (_: t_of (emp `vrefine` cllist0_refine c)) : Tot (cllist_lvalue a) = c
{ "file_name": "share/steel/examples/steel/CQueue.LList.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 3, "end_line": 35, "start_col": 0, "start_line": 30 }
module CQueue.LList noeq type cllist_ptrvalue (a: Type0) = { head: ref (ccell_ptrvalue a); tail: ref (ref (ccell_ptrvalue a)); all_or_none_null: squash (is_null head == is_null tail); } let cllist_ptrvalue_null a = {head = null; tail = null; all_or_none_null = ()} let cllist_ptrvalue_is_null #a x = is_null x.head let cllist_head #a c = c.head let cllist_tail #a c = c.tail #push-options "--ide_id_info_off" let cllist0_refine (#a: Type0) (c: cllist_ptrvalue a) (_: t_of emp) : Tot prop = cllist_ptrvalue_is_null c == false
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "CQueue.LList.fst" }
[ { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "f...
{ "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" }
false
c: CQueue.LList.cllist_ptrvalue a -> _: Steel.Effect.Common.t_of (Steel.Effect.Common.vrefine Steel.Effect.Common.emp (CQueue.LList.cllist0_refine c)) -> CQueue.LList.cllist_lvalue a
Prims.Tot
[ "total" ]
[]
[ "CQueue.LList.cllist_ptrvalue", "Steel.Effect.Common.t_of", "Steel.Effect.Common.vrefine", "Steel.Effect.Common.emp", "CQueue.LList.cllist0_refine", "CQueue.LList.cllist_lvalue" ]
[]
false
false
false
false
false
let cllist0_rewrite (#a: Type0) (c: cllist_ptrvalue a) (_: t_of (emp `vrefine` (cllist0_refine c))) : Tot (cllist_lvalue a) =
c
false
Spec.Ed25519.fst
Spec.Ed25519.aff_point_add_c
val aff_point_add_c (p q: aff_point_c) : aff_point_c
val aff_point_add_c (p q: aff_point_c) : aff_point_c
let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 19, "end_line": 37, "start_col": 0, "start_line": 35 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Spec.Ed25519.aff_point_c -> q: Spec.Ed25519.aff_point_c -> Spec.Ed25519.aff_point_c
Prims.Tot
[ "total" ]
[]
[ "Spec.Ed25519.aff_point_c", "Spec.Ed25519.PointOps.aff_point_add", "Prims.unit", "Spec.Ed25519.Lemmas.aff_point_add_lemma" ]
[]
false
false
false
true
false
let aff_point_add_c (p q: aff_point_c) : aff_point_c =
EL.aff_point_add_lemma p q; aff_point_add p q
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_wpProof_Load_stack128
val va_wpProof_Load_stack128 : dst:va_operand_vec_opr -> offset:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_stack128 dst offset va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_stack128 dst offset) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Load_stack128 : dst:va_operand_vec_opr -> offset:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_stack128 dst offset va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_stack128 dst offset) ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Load_stack128 dst offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_stack128 (va_code_Load_stack128 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 136, "start_col": 0, "start_line": 130 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack128 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack128 (va_code_Store_stack128 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack128 [@ "opaque_to_smt"] let va_code_Load_stack128 dst offset = (Ins (S.LoadStack128 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack128 dst offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Load_stack128 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
dst: Vale.PPC64LE.Decls.va_operand_vec_opr -> offset: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_operand_vec_opr", "Prims.int", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_mod_vec_opr", ...
[]
false
false
false
false
false
let va_wpProof_Load_stack128 dst offset va_s0 va_k =
let va_sM, va_f0 = va_lemma_Load_stack128 (va_code_Load_stack128 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.smt_goals
val smt_goals: Prims.unit -> Tac (list goal)
val smt_goals: Prims.unit -> Tac (list goal)
let smt_goals () : Tac (list goal) = smt_goals_of (get ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 58, "end_line": 60, "start_col": 0, "start_line": 60 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Stubs.Tactics.Types.goal)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.smt_goals_of", "Prims.list", "FStar.Stubs.Tactics.Types.goal", "FStar.Stubs.Tactics.Types.proofstate", "FStar.Tactics.Effect.get" ]
[]
false
true
false
false
false
let smt_goals () : Tac (list goal) =
smt_goals_of (get ())
false
Vale.AES.X64.AESopt.fst
Vale.AES.X64.AESopt.va_qcode_untransformedoriginal_Loop6x_partial
val va_qcode_untransformedoriginal_Loop6x_partial (va_mods: va_mods_t) (alg: algorithm) (h_LE y_prev: quad32) (data: (seq quad32)) (count in0_count: nat) (iv_b in0_b in_b scratch_b: buffer128) (key_words: (seq nat32)) (round_keys: (seq quad32)) (keys_b hkeys_b: buffer128) (ctr_BE: quad32) : (va_quickCode (quad32_6) (va_code_untransformedoriginal_Loop6x_partial alg))
val va_qcode_untransformedoriginal_Loop6x_partial (va_mods: va_mods_t) (alg: algorithm) (h_LE y_prev: quad32) (data: (seq quad32)) (count in0_count: nat) (iv_b in0_b in_b scratch_b: buffer128) (key_words: (seq nat32)) (round_keys: (seq quad32)) (keys_b hkeys_b: buffer128) (ctr_BE: quad32) : (va_quickCode (quad32_6) (va_code_untransformedoriginal_Loop6x_partial alg))
let va_qcode_untransformedoriginal_Loop6x_partial (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) (count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode (quad32_6) (va_code_untransformedoriginal_Loop6x_partial alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (init:quad32_6) = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_s)) in let (start:(va_int_at_least 0)) = in0_count `op_Multiply` 6 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 871 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 872 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 0 key_words round_keys keys_b init (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 873 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 874 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 875 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 1 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 876 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 5 2 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 877 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 878 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 2 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 879 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 880 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 3 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 881 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 4 3 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 882 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 883 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 4 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 884 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 3 4 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 885 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 886 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 5 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 887 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 2 5 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 888 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 891 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ReduceLast false h_LE y_prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 892 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 6 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 893 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 1 6 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 894 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 7 key_words round_keys keys_b init (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 895 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true in0_b (in0_count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 896 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false in0_b (in0_count `op_Multiply` 6 + 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 897 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 8 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 901 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qInlineIf va_mods (alg = AES_256) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 913 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret keys_b 10) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 914 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 915 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 916 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 917 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 918 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 919 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 921 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_s.eval_rounds_reveal ()) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 922 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 923 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 10 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 926 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret keys_b 12) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 927 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 928 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 929 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 930 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 931 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 932 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 934 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 12 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QEmpty (()))))))))))))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 937 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qInlineIf va_mods (alg = AES_256) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 939 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret keys_b 14) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 943 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret keys_b 10) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 946 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b) (va_QEmpty ((init))))))))))))))))))))))))))))))))
{ "file_name": "obj/Vale.AES.X64.AESopt.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 42, "end_line": 2072, "start_col": 0, "start_line": 1923 }
module Vale.AES.X64.AESopt open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open FStar.Seq open Vale.Arch.Types open Vale.Arch.HeapImpl open Vale.AES.AES_s open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.AES.AES_helpers //open Vale.Poly1305.Math // For lemma_poly_bits64() open Vale.AES.GCM_helpers open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.Arch.TypesNative open Vale.X64.CPU_Features_s open Vale.Math.Poly2_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.AES.GHash open Vale.AES.X64.PolyOps open Vale.AES.X64.AESopt2 open Vale.AES.X64.AESGCM_expected_code open Vale.Transformers.Transform open FStar.Mul let add = Vale.Math.Poly2_s.add #reset-options "--z3rlimit 30" //-- finish_aes_encrypt_le val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32) -> Lemma (requires (Vale.AES.AES_s.is_aes_key_LE alg key)) (ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key))) let finish_aes_encrypt_le alg input_LE key = Vale.AES.AES_s.aes_encrypt_LE_reveal (); Vale.AES.AES_s.eval_cipher_reveal (); () //-- //-- Load_two_lsb [@ "opaque_to_smt"] let va_code_Load_two_lsb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) [@ "opaque_to_smt"] let va_codegen_success_Load_two_lsb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@"opaque_to_smt"] let va_lemma_Load_two_lsb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0; assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2); let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_two_lsb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_0xc2_msb val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code [@ "opaque_to_smt"] let va_code_Load_0xc2_msb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Load_0xc2_msb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_Load_0xc2_msb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0 3254779904) == 13979173243358019584); Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904; let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (()))) val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Load_0xc2_msb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) = (va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) (va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst)) //-- //-- Load_one_lsb [@ "opaque_to_smt"] let va_code_Load_one_lsb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) [@ "opaque_to_smt"] let va_codegen_success_Load_one_lsb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@"opaque_to_smt"] let va_lemma_Load_one_lsb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_one_lsb) (va_code_Load_one_lsb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 1 0; assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 1 0) == 1); let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 1 0 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_one_lsb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_one_lsb (va_code_Load_one_lsb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Handle_ctr32 val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Handle_ctr32 () = (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load_two_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CNil ())))))))))))))))))))) val va_codegen_success_Handle_ctr32 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Handle_ctr32 () = (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Load_two_lsb (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_ttrue ()))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Handle_ctr32 (va_mods:va_mods_t) (ctr_BE:quad32) : (va_quickCode unit (va_code_Handle_ctr32 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 261 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_one_lsb (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 262 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 263 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_two_lsb (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 264 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 265 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 266 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 267 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 268 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 269 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 270 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 271 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 272 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 273 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 274 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 275 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 276 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_QEmpty (()))))))))))))))))))))) val va_lemma_Handle_ctr32 : va_b0:va_code -> va_s0:va_state -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Handle_ctr32 ()) va_s0 /\ va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))))))))))))) [@"opaque_to_smt"] let va_lemma_Handle_ctr32 va_b0 va_s0 ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_ok] in let va_qc = va_qcode_Handle_ctr32 va_mods ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Handle_ctr32 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 234 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 254 column 107 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Handle_ctr32 (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE) /\ (forall (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) ==> va_k va_sM (()))) val va_wpProof_Handle_ctr32 : ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Handle_ctr32 ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Handle_ctr32 ()) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Handle_ctr32 ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Handle_ctr32 (va_code_Handle_ctr32 ()) va_s0 ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Handle_ctr32 (ctr_BE:quad32) : (va_quickCode unit (va_code_Handle_ctr32 ())) = (va_QProc (va_code_Handle_ctr32 ()) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) (va_wp_Handle_ctr32 ctr_BE) (va_wpProof_Handle_ctr32 ctr_BE)) //-- //-- Loop6x_ctr_update val va_code_Loop6x_ctr_update : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_ctr_update alg = (va_Block (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_CCons (va_IfElse (va_cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_Handle_ctr32 ()) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_CNil ()))))) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CNil ()))))))) (va_CNil ())))) val va_codegen_success_Loop6x_ctr_update : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_ctr_update alg = (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_pbool_and (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_Handle_ctr32 ()) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)))))))) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_ctr_update (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_ctr_update alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 339 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 340 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qIf va_mods (Cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret hkeys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Handle_ctr32 ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_QEmpty (())))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret hkeys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 348 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg36:Prims.nat) = va_get_reg64 rRbx va_old_s in let (va_arg35:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg34:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in let (va_arg33:Vale.Def.Types_s.quad32) = ctr_BE in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 349 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_msb_in_bounds va_arg33 va_arg34 va_arg35 va_arg36) (va_QEmpty (()))))))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) val va_lemma_Loop6x_ctr_update : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_ctr_update alg) va_s0 /\ va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM) /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM va_s0)))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_ctr_update va_b0 va_s0 alg h_LE key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok] in let va_qc = va_qcode_Loop6x_ctr_update va_mods alg h_LE key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_ctr_update alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 279 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in label va_range1 "***** POSTCONDITION NOT MET AT line 330 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 331 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 334 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 335 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_ctr_update (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h) /\ (forall (va_x_rbx:nat64) (va_x_r11:nat64) (va_x_xmm3:quad32) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_xmm 3 va_x_xmm3 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx va_s0)))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM) /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Loop6x_ctr_update : alg:algorithm -> h_LE:quad32 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_ctr_update alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_ctr_update (va_code_Loop6x_ctr_update alg) va_s0 alg h_LE key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM va_s0))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_ctr_update (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_ctr_update alg)) = (va_QProc (va_code_Loop6x_ctr_update alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) (va_wp_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE) (va_wpProof_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE)) //-- //-- Loop6x_plain val va_code_Loop6x_plain : alg:algorithm -> rnd:nat -> rndkey:va_operand_xmm -> Tot va_code [@ "opaque_to_smt"] let va_code_Loop6x_plain alg rnd rndkey = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey) (va_CNil ()))))))))) val va_codegen_success_Loop6x_plain : alg:algorithm -> rnd:nat -> rndkey:va_operand_xmm -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Loop6x_plain alg rnd rndkey = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey) (va_ttrue ())))))))) val va_lemma_Loop6x_plain : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> rnd:nat -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> init:quad32_6 -> rndkey:va_operand_xmm -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_plain alg rnd rndkey) va_s0 /\ va_is_dst_xmm rndkey va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ (rndkey == 1 \/ rndkey == 2 \/ rndkey == 15) /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ rnd + 1 < FStar.Seq.Base.length #quad32 round_keys /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys rnd))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (rnd + 1) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_operand_xmm rndkey va_sM va_s0))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_plain va_b0 va_s0 alg rnd key_words round_keys keys_b init rndkey = va_reveal_opaque (`%va_code_Loop6x_plain) (va_code_Loop6x_plain alg rnd rndkey); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s9, va_fc9) = va_lemma_Load128_buffer (va_hd va_b1) va_s0 (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret keys_b (rnd + 1) in let va_b9 = va_tl va_b1 in let (va_s10, va_fc10) = va_lemma_VAESNI_enc (va_hd va_b9) va_s9 (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey in let va_b10 = va_tl va_b9 in let (va_s11, va_fc11) = va_lemma_VAESNI_enc (va_hd va_b10) va_s10 (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey in let va_b11 = va_tl va_b10 in let (va_s12, va_fc12) = va_lemma_VAESNI_enc (va_hd va_b11) va_s11 (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey in let va_b12 = va_tl va_b11 in let (va_s13, va_fc13) = va_lemma_VAESNI_enc (va_hd va_b12) va_s12 (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey in let va_b13 = va_tl va_b12 in let (va_s14, va_fc14) = va_lemma_VAESNI_enc (va_hd va_b13) va_s13 (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey in let va_b14 = va_tl va_b13 in let (va_s15, va_fc15) = va_lemma_VAESNI_enc (va_hd va_b14) va_s14 (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey in let va_b15 = va_tl va_b14 in Vale.AES.AES_s.eval_rounds_reveal (); Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall (); let (va_sM, va_f15) = va_lemma_empty_total va_s15 va_b15 in let va_f14 = va_lemma_merge_total va_b14 va_s14 va_fc15 va_s15 va_f15 va_sM in let va_f13 = va_lemma_merge_total va_b13 va_s13 va_fc14 va_s14 va_f14 va_sM in let va_f12 = va_lemma_merge_total va_b12 va_s12 va_fc13 va_s13 va_f13 va_sM in let va_f11 = va_lemma_merge_total va_b11 va_s11 va_fc12 va_s12 va_f12 va_sM in let va_f10 = va_lemma_merge_total va_b10 va_s10 va_fc11 va_s11 va_f11 va_sM in let va_f9 = va_lemma_merge_total va_b9 va_s9 va_fc10 va_s10 va_f10 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc9 va_s9 va_f9 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_plain (alg:algorithm) (rnd:nat) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (init:quad32_6) (rndkey:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_xmm rndkey va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ (rndkey == 1 \/ rndkey == 2 \/ rndkey == 15) /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ rnd + 1 < FStar.Seq.Base.length #quad32 round_keys /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys rnd) /\ (forall (va_x_rndkey:va_value_xmm) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_operand_xmm rndkey va_x_rndkey va_s0))))))) in va_get_ok va_sM /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (rnd + 1) ==> va_k va_sM (()))) val va_wpProof_Loop6x_plain : alg:algorithm -> rnd:nat -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> init:quad32_6 -> rndkey:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_plain alg rnd rndkey) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_plain (va_code_Loop6x_plain alg rnd rndkey) va_s0 alg rnd key_words round_keys keys_b init rndkey in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_operand_xmm rndkey va_sM va_s0)))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_plain (alg:algorithm) (rnd:nat) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (init:quad32_6) (rndkey:va_operand_xmm) : (va_quickCode unit (va_code_Loop6x_plain alg rnd rndkey)) = (va_QProc (va_code_Loop6x_plain alg rnd rndkey) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) (va_wp_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey) (va_wpProof_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey)) //-- //-- Loop6x_preamble val va_code_Loop6x_preamble : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_preamble alg = (va_Block (va_CCons (va_code_Loop6x_ctr_update alg) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_CNil ()))))))) val va_codegen_success_Loop6x_preamble : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_preamble alg = (va_pbool_and (va_codegen_success_Loop6x_ctr_update alg) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_preamble (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_preamble alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE) (fun (va_s:va_state) _ -> let (va_arg43:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg42:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 479 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg42 va_arg43) (let (va_arg41:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg40:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 480 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg40 va_arg41) (let (va_arg39:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg38:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 481 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg38 va_arg39) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 498 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret scratch_b 8) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg37:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg36:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 499 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg36 va_arg37) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 500 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg35:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg34:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 500 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg34 va_arg35) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 501 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg33:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg32:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 501 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg32 va_arg33) (va_QEmpty (())))))))))))))) val va_lemma_Loop6x_preamble : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 -> iv_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_preamble alg) va_s0 /\ va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8 /\ (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0 /\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_preamble va_b0 va_s0 alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_preamble va_mods alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_preamble alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 402 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in label va_range1 "***** POSTCONDITION NOT MET AT line 459 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 464 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in label va_range1 "***** POSTCONDITION NOT MET AT line 466 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 469 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 472 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 473 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 475 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_preamble (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_r11:nat64) (va_x_xmm3:quad32) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_xmm 3 va_x_xmm3 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem va_x_mem va_s0)))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8 /\ (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0 /\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))) ==> va_k va_sM (()))) val va_wpProof_Loop6x_preamble : alg:algorithm -> h_LE:quad32 -> iv_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_preamble alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_preamble (va_code_Loop6x_preamble alg) va_s0 alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_preamble (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_preamble alg)) = (va_QProc (va_code_Loop6x_preamble alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_wpProof_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)) //-- //-- Loop6x_reverse128 val va_code_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_reverse128 in0_offset stack_offset = (va_Block (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true) (va_CNil ())))))) val va_codegen_success_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_reverse128 in0_offset stack_offset = (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_reverse128 (va_mods:va_mods_t) (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) : (va_quickCode unit (va_code_Loop6x_reverse128 in0_offset stack_offset)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 527 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true in0_b (start + in0_offset)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 528 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false in0_b (start + in0_offset)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 529 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false scratch_b stack_offset) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 530 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true scratch_b stack_offset) (fun (va_s:va_state) _ -> let (va_arg10:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_s) in let (va_arg9:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_old_s) in let (va_arg8:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_old_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 531 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.lemma_reverse_bytes_quad32_64 va_arg8 va_arg9 va_arg10) (va_QEmpty (())))))))) val va_lemma_Loop6x_reverse128 : va_b0:va_code -> va_s0:va_state -> in0_offset:nat -> stack_offset:nat -> start:nat -> in0_b:buffer128 -> scratch_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_reverse128 in0_offset stack_offset) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b start (in0_offset + 1) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b (stack_offset + 1) (va_get_mem_layout va_s0) Secret))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset /\ Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_reverse128 va_b0 va_s0 in0_offset stack_offset start in0_b scratch_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_reverse128 va_mods in0_offset stack_offset start in0_b scratch_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_reverse128 in0_offset stack_offset) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 504 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 523 column 94 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_reverse128 (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b start (in0_offset + 1) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b (stack_offset + 1) (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_heap3:vale_heap) . let va_sM = va_upd_mem_heaplet 3 va_x_heap3 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12 (va_upd_mem va_x_mem va_s0))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset /\ Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))) ==> va_k va_sM (()))) val va_wpProof_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> start:nat -> in0_b:buffer128 -> scratch_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_reverse128 in0_offset stack_offset) ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_reverse128 (va_code_Loop6x_reverse128 in0_offset stack_offset) va_s0 in0_offset stack_offset start in0_b scratch_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_reverse128 (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) : (va_quickCode unit (va_code_Loop6x_reverse128 in0_offset stack_offset)) = (va_QProc (va_code_Loop6x_reverse128 in0_offset stack_offset) ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) (va_wp_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b) (va_wpProof_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b)) //-- //-- Loop6x_round9 val va_code_Loop6x_round9 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_round9 alg = (va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_CNil ()))))))))))))))) val va_codegen_success_Loop6x_round9 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_round9 alg = (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_ttrue ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_round9 (va_mods:va_mods_t) (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Loop6x_round9 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 567 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret scratch_b 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 568 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret in_b (count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 568 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 569 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret in_b (count `op_Multiply` 6 + 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 569 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret in_b (count `op_Multiply` 6 + 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret in_b (count `op_Multiply` 6 + 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret in_b (count `op_Multiply` 6 + 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 573 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret in_b (count `op_Multiply` 6 + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 573 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_QEmpty (())))))))))))))))) val va_lemma_Loop6x_round9 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> count:nat -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_round9 alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 1 va_s0 == Vale.X64.Decls.buffer128_read keys_b (Vale.AES.AES_common_s.nr alg) (va_get_mem_heaplet 0 va_s0)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1 /\ (va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_round9 va_b0 va_s0 alg count in_b scratch_b key_words round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_round9 va_mods alg count in_b scratch_b key_words round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_round9 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 561 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 563 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 564 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_round9 (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 1 va_s0 == Vale.X64.Decls.buffer128_read keys_b (Vale.AES.AES_common_s.nr alg) (va_get_mem_heaplet 0 va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM = va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_mem va_x_mem va_s0))))))))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1 /\ (va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0) ==> va_k va_sM (()))) val va_wpProof_Loop6x_round9 : alg:algorithm -> count:nat -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_round9 alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_round9 (va_code_Loop6x_round9 alg) va_s0 alg count in_b scratch_b key_words round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_round9 (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Loop6x_round9 alg)) = (va_QProc (va_code_Loop6x_round9 alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) (va_wp_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b) (va_wpProof_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b)) //-- //-- load_one_msb val va_code_load_one_msb : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_load_one_msb () = (va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 2)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) val va_codegen_success_load_one_msb : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_load_one_msb () = (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_load_one_msb (va_mods:va_mods_t) : (va_quickCode unit (va_code_load_one_msb ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 583 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ZeroXmm (va_op_xmm_xmm 2)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 584 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0 16777216) == 72057594037927936) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 585 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 586 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Def.Types_s.insert_nat64_reveal ()) (va_QEmpty (()))))))) val va_lemma_load_one_msb : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_load_one_msb ()) va_s0 /\ va_get_ok va_s0 /\ sse_enabled)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_load_one_msb va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok] in let va_qc = va_qcode_load_one_msb va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_load_one_msb ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 576 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 581 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_load_one_msb (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_r11:nat64) (va_x_xmm2:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 2 va_x_xmm2 (va_upd_reg64 rR11 va_x_r11 va_s0)) in va_get_ok va_sM /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 ==> va_k va_sM (()))) val va_wpProof_load_one_msb : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_load_one_msb va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_load_one_msb ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_load_one_msb va_s0 va_k = let (va_sM, va_f0) = va_lemma_load_one_msb (va_code_load_one_msb ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_load_one_msb () : (va_quickCode unit (va_code_load_one_msb ())) = (va_QProc (va_code_load_one_msb ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_wp_load_one_msb va_wpProof_load_one_msb) //-- //-- Loop6x_final [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_final alg = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_CCons (va_code_load_one_msb ()) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_final alg = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_load_one_msb ()) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (va_ttrue ()))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_final (va_mods:va_mods_t) (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6) (ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 667 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes_forall ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 669 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret scratch_b 8) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 671 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 672 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_load_one_msb ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 673 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 674 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 675 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false scratch_b 7) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 676 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 677 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 678 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 679 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true scratch_b 7) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 680 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 681 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret keys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 683 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 684 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 685 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 686 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 687 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 688 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (fun (va_s:va_state) _ -> let (va_arg117:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg116:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in let (va_arg115:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_old_s in let (va_arg114:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg113:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg112:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg111:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 690 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg111 va_arg112 va_arg113 va_arg114 va_arg115 va_arg116 va_arg117) (let (va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg109:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_s in let (va_arg108:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_old_s in let (va_arg107:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg106:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg105:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg104:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 691 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg104 va_arg105 va_arg106 va_arg107 va_arg108 va_arg109 va_arg110) (let (va_arg103:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg102:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let (va_arg101:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_old_s in let (va_arg100:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg99:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg98:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg97:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 692 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg97 va_arg98 va_arg99 va_arg100 va_arg101 va_arg102 va_arg103) (let (va_arg96:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg95:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_s in let (va_arg94:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_old_s in let (va_arg93:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg92:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg91:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg90:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 693 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg90 va_arg91 va_arg92 va_arg93 va_arg94 va_arg95 va_arg96) (let (va_arg89:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg88:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_s in let (va_arg87:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_old_s in let (va_arg86:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg85:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg84:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg83:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 694 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg83 va_arg84 va_arg85 va_arg86 va_arg87 va_arg88 va_arg89) (let (va_arg82:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg81:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in let (va_arg80:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_old_s in let (va_arg79:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg78:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg77:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg76:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 695 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg76 va_arg77 va_arg78 va_arg79 va_arg80 va_arg81 va_arg82) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 696 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 697 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 698 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 699 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 700 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 701 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (let (va_arg75:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_s) in let (va_arg74:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_old_s) in let (va_arg73:Vale.Def.Types_s.quad32) = inb in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 703 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.lemma_reverse_bytes_quad32_64 va_arg73 va_arg74 va_arg75) (let (va_arg72:Vale.Def.Types_s.quad32) = va_get_xmm 0 va_s in let (va_arg71:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg70:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 705 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg70 va_arg71 va_arg72 1) (let (va_arg69:Vale.Def.Types_s.quad32) = va_get_xmm 5 va_s in let (va_arg68:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg67:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 706 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg67 va_arg68 va_arg69 2) (let (va_arg66:Vale.Def.Types_s.quad32) = va_get_xmm 6 va_s in let (va_arg65:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg64:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 707 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg64 va_arg65 va_arg66 3) (let (va_arg63:Vale.Def.Types_s.quad32) = va_get_xmm 7 va_s in let (va_arg62:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg61:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 708 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg61 va_arg62 va_arg63 4) (let (va_arg60:Vale.Def.Types_s.quad32) = va_get_xmm 3 va_s in let (va_arg59:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg58:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 709 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg58 va_arg59 va_arg60 5) (va_QEmpty (())))))))))))))))))))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_final va_b0 va_s0 alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_final va_mods alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_final alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 589 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 649 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 7 7) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 652 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 654 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32) (c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 655 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 657 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 658 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 660 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 662 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 663 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in label va_range1 "***** POSTCONDITION NOT MET AT line 665 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (ctr + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15 va_sM))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_final (va_code_Loop6x_final alg) va_s0 alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Loop6x_save_output [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_save_output () = (va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_CNil ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_save_output () = (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_ttrue ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_save_output (va_mods:va_mods_t) (count:nat) (out_b:buffer128) : (va_quickCode unit (va_code_Loop6x_save_output ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 744 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret out_b (count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 745 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 746 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret out_b (count `op_Multiply` 6 + 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 747 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 748 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret out_b (count `op_Multiply` 6 + 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 749 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 750 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret out_b (count `op_Multiply` 6 + 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 751 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 752 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret out_b (count `op_Multiply` 6 + 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 753 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 754 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret out_b (count `op_Multiply` 6 + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 755 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_QEmpty (()))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_save_output va_b0 va_s0 count out_b = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_save_output va_mods count out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_save_output ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 712 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 737 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 738 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0 (6 `op_Multiply` count)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 740 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 742 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor (va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Loop6x_save_output count out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_save_output (va_code_Loop6x_save_output ()) va_s0 count out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Loop6x_partial #push-options "--z3rlimit 50 --max_ifuel 0" [@ "opaque_to_smt" va_qattr] let va_code_untransformedoriginal_Loop6x_partial alg = (va_Block (va_CCons (va_code_Loop6x_preamble alg) (va_CCons (va_code_Loop6x_plain alg 0 (va_op_xmm_xmm 2)) (va_CCons (va_code_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_CCons (va_code_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_Loop6x_plain alg 1 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 5 2) (va_CCons (va_code_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_CCons (va_code_Loop6x_plain alg 2 (va_op_xmm_xmm 15)) (va_CCons (va_code_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 3 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 4 3) (va_CCons (va_code_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_CCons (va_code_Loop6x_plain alg 4 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 3 4) (va_CCons (va_code_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3)) (va_CCons (va_code_Loop6x_plain alg 5 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 2 5) (va_CCons (va_code_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_CCons (va_code_ReduceLast false) (va_CCons (va_code_Loop6x_plain alg 6 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 1 6) (va_CCons (va_code_Loop6x_plain alg 7 (va_op_xmm_xmm 1)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_CCons (va_code_Loop6x_plain alg 8 (va_op_xmm_xmm 15)) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 10 (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 12 (va_op_xmm_xmm 15)) (va_CNil ()))))))))))))))))) else va_Block (va_CNil ())) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_CNil ())) else va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CNil ()))) (va_CCons (va_code_Loop6x_round9 alg) (va_CNil ())))))))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_untransformedoriginal_Loop6x_partial alg = (va_pbool_and (va_codegen_success_Loop6x_preamble alg) (va_pbool_and (va_codegen_success_Loop6x_plain alg 0 (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 1 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 5 2) (va_pbool_and (va_codegen_success_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 2 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 3 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 4 3) (va_pbool_and (va_codegen_success_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 4 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 3 4) (va_pbool_and (va_codegen_success_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 5 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 2 5) (va_pbool_and (va_codegen_success_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_ReduceLast false) (va_pbool_and (va_codegen_success_Loop6x_plain alg 6 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 1 6) (va_pbool_and (va_codegen_success_Loop6x_plain alg 7 (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Loop6x_plain alg 8 (va_op_xmm_xmm 15)) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 10 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 12 (va_op_xmm_xmm 15)) (va_ttrue ())))))))))))))))) else va_ttrue ()) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_ttrue ()) else va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_ttrue ())) (va_pbool_and (va_codegen_success_Loop6x_round9 alg) (va_ttrue ())))))))))))))))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Flags.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Transformers.Transform.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.X64.PolyOps.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.X64.AESGCM_expected_code.fsti.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_helpers.fsti.checked", "Vale.AES.AES_common_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.AESopt.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers.Transform", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM_expected_code", "short_module": null }, { "abbrev...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "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": 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": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_mods: Vale.X64.QuickCode.va_mods_t -> alg: Vale.AES.AES_common_s.algorithm -> h_LE: Vale.X64.Decls.quad32 -> y_prev: Vale.X64.Decls.quad32 -> data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> count: Prims.nat -> in0_count: Prims.nat -> iv_b: Vale.X64.Memory.buffer128 -> in0_b: Vale.X64.Memory.buffer128 -> in_b: Vale.X64.Memory.buffer128 -> scratch_b: Vale.X64.Memory.buffer128 -> key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> keys_b: Vale.X64.Memory.buffer128 -> hkeys_b: Vale.X64.Memory.buffer128 -> ctr_BE: Vale.X64.Decls.quad32 -> Vale.X64.QuickCode.va_quickCode Vale.AES.X64.AESopt.quad32_6 (Vale.AES.X64.AESopt.va_code_untransformedoriginal_Loop6x_partial alg)
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.QuickCode.va_mods_t", "Vale.AES.AES_common_s.algorithm", "Vale.X64.Decls.quad32", "FStar.Seq.Base.seq", "Prims.nat", "Vale.X64.Memory.buffer128", "Vale.X64.Memory.nat32", "Vale.X64.QuickCodes.qblock", "Vale.AES.X64.AESopt.quad32_6", "Prims.Cons", "Vale.X64.Decls.va_code", "Vale.AES.X...
[]
false
false
false
false
false
let va_qcode_untransformedoriginal_Loop6x_partial (va_mods: va_mods_t) (alg: algorithm) (h_LE y_prev: quad32) (data: (seq quad32)) (count in0_count: nat) (iv_b in0_b in_b scratch_b: buffer128) (key_words: (seq nat32)) (round_keys: (seq quad32)) (keys_b hkeys_b: buffer128) (ctr_BE: quad32) : (va_quickCode (quad32_6) (va_code_untransformedoriginal_Loop6x_partial alg)) =
(qblock va_mods (fun (va_s: va_state) -> let va_old_s:va_state = va_s in let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let init:quad32_6 = make_six_of #Vale.Def.Types_s.quad32 (fun (n: (va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_s)) in let start:(va_int_at_least 0) = in0_count `op_Multiply` 6 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 871 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 872 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 0 key_words round_keys keys_b init (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 873 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 874 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 875 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 1 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 876 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 5 2 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 877 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 878 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 2 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 879 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 880 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 3 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 881 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 4 3 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 882 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 883 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 4 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 884 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 3 4 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 885 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 886 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 5 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 887 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 2 5 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 888 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 891 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ReduceLast false h_LE y_prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 892 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 6 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 893 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 1 6 start in0_b scratch_b ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 894 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 7 key_words round_keys keys_b init (va_op_xmm_xmm 1 )) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 895 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 6 ) ( va_op_reg_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rR14 ) ( 0 `op_Multiply` 16 + 8 ) Secret true in0_b ( in0_count `op_Multiply` 6 + 0 ) ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 896 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_LoadBe64_buffer128 ( va_op_heaplet_mem_heaplet 6 ) ( va_op_reg_opr64_reg64 rR12 ) ( va_op_reg_opr64_reg64 rR14 ) ( 0 `op_Multiply` 16 ) Secret false in0_b ( in0_count `op_Multiply` 6 + 0 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 897 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Loop6x_plain alg 8 key_words round_keys keys_b init ( va_op_xmm_xmm 15 ) ) ( fun ( va_s: va_state ) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 901 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_qInlineIf va_mods ( alg = AES_256 ) ( qblock va_mods ( fun ( va_s: va_state ) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 913 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 160 - 128 ) Secret keys_b 10 ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 914 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 915 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 916 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 917 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 918 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 919 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( fun ( va_s: va_state ) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 921 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( fun ( _: unit ) -> Vale.AES.AES_s.eval_rounds_reveal () ) ( va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 922 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( fun ( _: unit ) -> Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall () ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 923 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Loop6x_plain alg 10 key_words round_keys keys_b init ( va_op_xmm_xmm 15 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 926 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 192 - 128 ) Secret keys_b 12 ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 927 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 9 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 928 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 10 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 929 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 930 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 12 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 931 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 13 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 932 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_VAESNI_enc ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 14 ) ( va_op_xmm_xmm 1 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 934 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Loop6x_plain alg 12 key_words round_keys keys_b init ( va_op_xmm_xmm 15 ) ) ( va_QEmpty ( () ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ( qblock va_mods ( fun ( va_s: va_state ) -> va_QEmpty ( () ) ) ) ) ( fun ( va_s: va_state ) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 937 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_qInlineIf va_mods ( alg = AES_256 ) ( qblock va_mods ( fun ( va_s: va_state ) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 939 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 224 - 128 ) Secret keys_b 14 ) ( va_QEmpty ( () ) ) ) ) ( qblock va_mods ( fun ( va_s: va_state ) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 943 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Load128_buffer ( va_op_heaplet_mem_heaplet 0 ) ( va_op_xmm_xmm 1 ) ( va_op_reg_opr64_reg64 rRcx ) ( 160 - 128 ) Secret keys_b 10 ) ( va_QEmpty ( () ) ) ) ) ) ( fun ( va_s: va_state ) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 946 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ( va_quick_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b ) ( va_QEmpty ( ( init ) ) ) ) ) ) ) )) )))))))))) )))))))))))))
false
Spec.Ed25519.fst
Spec.Ed25519.point_add_c
val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid
val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid
let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 62, "start_col": 0, "start_line": 60 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.Exponentiation.mul_st Spec.Ed25519.ext_point_c Spec.Ed25519.mk_to_ed25519_comm_monoid
Prims.Tot
[ "total" ]
[]
[ "Spec.Ed25519.ext_point_c", "Spec.Ed25519.PointOps.point_add", "Prims.unit", "Spec.Ed25519.Lemmas.to_aff_point_add_lemma" ]
[]
false
false
false
true
false
let point_add_c p q =
EL.to_aff_point_add_lemma p q; point_add p q
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_wpProof_Load_stack64
val va_wpProof_Load_stack64 : dst:va_operand_reg_opr -> offset:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_stack64 dst offset va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_stack64 dst offset) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Load_stack64 : dst:va_operand_reg_opr -> offset:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_stack64 dst offset va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_stack64 dst offset) ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Load_stack64 dst offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_stack64 (va_code_Load_stack64 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 197, "start_col": 0, "start_line": 191 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack128 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack128 (va_code_Store_stack128 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack128 [@ "opaque_to_smt"] let va_code_Load_stack128 dst offset = (Ins (S.LoadStack128 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack128 dst offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Load_stack128 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_stack128 dst offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_stack128 (va_code_Load_stack128 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack64 [@ "opaque_to_smt"] let va_code_Store_stack64 src offset = (Ins (S.StoreStack64 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack64 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack64 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack64) (va_code_Store_stack64 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack64 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack64 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack64 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack64 (va_code_Store_stack64 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack64 [@ "opaque_to_smt"] let va_code_Load_stack64 dst offset = (Ins (S.LoadStack64 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack64 dst offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Load_stack64 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack64) (va_code_Load_stack64 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack64 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack64 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack64 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_mod_reg_opr", ...
[]
false
false
false
false
false
let va_wpProof_Load_stack64 dst offset va_s0 va_k =
let va_sM, va_f0 = va_lemma_Load_stack64 (va_code_Load_stack64 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Vale.AES.X64.AESopt.fst
Vale.AES.X64.AESopt.va_wpProof_Loop6x
val va_wpProof_Loop6x : alg:algorithm -> h_LE:quad32 -> y_orig:quad32 -> y_prev:quad32 -> count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128 -> plain_quads:(seq quad32) -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE_orig:quad32 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32 -> Type0) -> Ghost (va_state & va_fuel & quad32) (requires (va_t_require va_s0 /\ va_wp_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Loop6x : alg:algorithm -> h_LE:quad32 -> y_orig:quad32 -> y_prev:quad32 -> count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128 -> plain_quads:(seq quad32) -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE_orig:quad32 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32 -> Type0) -> Ghost (va_state & va_fuel & quad32) (requires (va_t_require va_s0 /\ va_wp_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE va_s0 va_k = let (va_sM, va_f0, y_new) = va_lemma_Loop6x (va_code_Loop6x alg) va_s0 alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_sM va_s0; let va_g = (y_new) in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.AES.X64.AESopt.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 2569, "start_col": 0, "start_line": 2546 }
module Vale.AES.X64.AESopt open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open FStar.Seq open Vale.Arch.Types open Vale.Arch.HeapImpl open Vale.AES.AES_s open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.AES.AES_helpers //open Vale.Poly1305.Math // For lemma_poly_bits64() open Vale.AES.GCM_helpers open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.Arch.TypesNative open Vale.X64.CPU_Features_s open Vale.Math.Poly2_s open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.AES.GHash open Vale.AES.X64.PolyOps open Vale.AES.X64.AESopt2 open Vale.AES.X64.AESGCM_expected_code open Vale.Transformers.Transform open FStar.Mul let add = Vale.Math.Poly2_s.add #reset-options "--z3rlimit 30" //-- finish_aes_encrypt_le val finish_aes_encrypt_le : alg:algorithm -> input_LE:quad32 -> key:(seq nat32) -> Lemma (requires (Vale.AES.AES_s.is_aes_key_LE alg key)) (ensures (Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key))) let finish_aes_encrypt_le alg input_LE key = Vale.AES.AES_s.aes_encrypt_LE_reveal (); Vale.AES.AES_s.eval_cipher_reveal (); () //-- //-- Load_two_lsb [@ "opaque_to_smt"] let va_code_Load_two_lsb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) [@ "opaque_to_smt"] let va_codegen_success_Load_two_lsb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 2 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@"opaque_to_smt"] let va_lemma_Load_two_lsb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_two_lsb) (va_code_Load_two_lsb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 2 0; assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 2 0) == 2); let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 2 0 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_two_lsb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_0xc2_msb val va_code_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_code [@ "opaque_to_smt"] let va_code_Load_0xc2_msb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) val va_codegen_success_Load_0xc2_msb : dst:va_operand_xmm -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Load_0xc2_msb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) val va_lemma_Load_0xc2_msb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_0xc2_msb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_Load_0xc2_msb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_0xc2_msb) (va_code_Load_0xc2_msb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0 3254779904) == 13979173243358019584); Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 0 3254779904; let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 13979173243358019584 1 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Load_0xc2_msb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm) (va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 3254779904 ==> va_k va_sM (()))) val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Load_0xc2_msb dst va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Load_0xc2_msb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Load_0xc2_msb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_0xc2_msb dst)) = (va_QProc (va_code_Load_0xc2_msb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) (va_wp_Load_0xc2_msb dst) (va_wpProof_Load_0xc2_msb dst)) //-- //-- Load_one_lsb [@ "opaque_to_smt"] let va_code_Load_one_lsb dst = (va_Block (va_CCons (va_code_ZeroXmm dst) (va_CCons (va_code_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) [@ "opaque_to_smt"] let va_codegen_success_Load_one_lsb dst = (va_pbool_and (va_codegen_success_ZeroXmm dst) (va_pbool_and (va_codegen_success_PinsrqImm dst 1 0 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@"opaque_to_smt"] let va_lemma_Load_one_lsb va_b0 va_s0 dst = va_reveal_opaque (`%va_code_Load_one_lsb) (va_code_Load_one_lsb dst); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s3, va_fc3) = va_lemma_ZeroXmm (va_hd va_b1) va_s0 dst in let va_b3 = va_tl va_b1 in Vale.Arch.Types.lemma_insert_nat64_nat32s (va_eval_xmm va_s3 dst) 1 0; assert (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 1 0) == 1); let (va_s6, va_fc6) = va_lemma_PinsrqImm (va_hd va_b3) va_s3 dst 1 0 (va_op_reg_opr64_reg64 rR11) in let va_b6 = va_tl va_b3 in let (va_sM, va_f6) = va_lemma_empty_total va_s6 va_b6 in let va_f3 = va_lemma_merge_total va_b3 va_s3 va_fc6 va_s6 va_f6 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_one_lsb dst va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_one_lsb (va_code_Load_one_lsb dst) va_s0 dst in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Handle_ctr32 val va_code_Handle_ctr32 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Handle_ctr32 () = (va_Block (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_Load_two_lsb (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_CNil ())))))))))))))))))))) val va_codegen_success_Handle_ctr32 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Handle_ctr32 () = (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Load_two_lsb (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_ttrue ()))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Handle_ctr32 (va_mods:va_mods_t) (ctr_BE:quad32) : (va_quickCode unit (va_code_Handle_ctr32 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_InitPshufbMask (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rR11)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 261 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_one_lsb (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 262 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 10) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 263 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_two_lsb (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 264 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 11) (va_op_xmm_xmm 6) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 265 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 12) (va_op_xmm_xmm 10) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 266 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 267 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 13) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 268 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 269 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 270 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 14) (va_op_xmm_xmm 12) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 271 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 272 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 273 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 13) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 274 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 275 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 276 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPshufb (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0)) (va_QEmpty (()))))))))))))))))))))) val va_lemma_Handle_ctr32 : va_b0:va_code -> va_s0:va_state -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Handle_ctr32 ()) va_s0 /\ va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))))))))))))) [@"opaque_to_smt"] let va_lemma_Handle_ctr32 va_b0 va_s0 ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_ok] in let va_qc = va_qcode_Handle_ctr32 va_mods ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Handle_ctr32 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 234 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 254 column 107 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Handle_ctr32 (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE) /\ (forall (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 va_s0))))))))))) in va_get_ok va_sM /\ (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) ==> va_k va_sM (()))) val va_wpProof_Handle_ctr32 : ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Handle_ctr32 ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Handle_ctr32 ()) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Handle_ctr32 ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Handle_ctr32 (va_code_Handle_ctr32 ()) va_s0 ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Handle_ctr32 (ctr_BE:quad32) : (va_quickCode unit (va_code_Handle_ctr32 ())) = (va_QProc (va_code_Handle_ctr32 ()) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11]) (va_wp_Handle_ctr32 ctr_BE) (va_wpProof_Handle_ctr32 ctr_BE)) //-- //-- Loop6x_ctr_update val va_code_Loop6x_ctr_update : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_ctr_update alg = (va_Block (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_CCons (va_IfElse (va_cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_Handle_ctr32 ()) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_CNil ()))))) (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (va_CNil ()))))))) (va_CNil ())))) val va_codegen_success_Loop6x_ctr_update : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_ctr_update alg = (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (va_pbool_and (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_Handle_ctr32 ()) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_codegen_success_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)))))))) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_ctr_update (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_ctr_update alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 339 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Add64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 6)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 340 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qIf va_mods (Cmp_ge (va_op_cmp_reg64 rRbx) (va_const_cmp 256)) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 341 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret hkeys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 342 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Handle_ctr32 ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 343 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Sub64 (va_op_dst_opr64_reg64 rRbx) (va_const_opr64 256)) (va_QEmpty (())))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 345 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 3) (va_op_reg_opr64_reg64 rR9) (0 - 32) Secret hkeys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 346 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 14)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 347 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_opr128_xmm 15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 348 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg36:Prims.nat) = va_get_reg64 rRbx va_old_s in let (va_arg35:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg34:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in let (va_arg33:Vale.Def.Types_s.quad32) = ctr_BE in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 349 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_msb_in_bounds va_arg33 va_arg34 va_arg35 va_arg36) (va_QEmpty (()))))))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) val va_lemma_Loop6x_ctr_update : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_ctr_update alg) va_s0 /\ va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM) /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM va_s0)))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_ctr_update va_b0 va_s0 alg h_LE key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok] in let va_qc = va_qcode_Loop6x_ctr_update va_mods alg h_LE key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_ctr_update alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 279 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in label va_range1 "***** POSTCONDITION NOT MET AT line 330 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 331 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 332 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 334 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 335 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_ctr_update (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h) /\ (forall (va_x_rbx:nat64) (va_x_r11:nat64) (va_x_xmm3:quad32) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_xmm 3 va_x_xmm3 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx va_s0)))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == xor_reverse_inc32lite_6 3 0 ctr_BE (va_get_xmm 15 va_sM) /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Loop6x_ctr_update : alg:algorithm -> h_LE:quad32 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_ctr_update alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_ctr_update (va_code_Loop6x_ctr_update alg) va_s0 alg h_LE key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM va_s0))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_ctr_update (alg:algorithm) (h_LE:quad32) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_ctr_update alg)) = (va_QProc (va_code_Loop6x_ctr_update alg) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx]) (va_wp_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE) (va_wpProof_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE)) //-- //-- Loop6x_plain val va_code_Loop6x_plain : alg:algorithm -> rnd:nat -> rndkey:va_operand_xmm -> Tot va_code [@ "opaque_to_smt"] let va_code_Loop6x_plain alg rnd rndkey = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey) (va_CNil ()))))))))) val va_codegen_success_Loop6x_plain : alg:algorithm -> rnd:nat -> rndkey:va_operand_xmm -> Tot va_pbool [@ "opaque_to_smt"] let va_codegen_success_Loop6x_plain alg rnd rndkey = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey) (va_ttrue ())))))))) val va_lemma_Loop6x_plain : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> rnd:nat -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> init:quad32_6 -> rndkey:va_operand_xmm -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_plain alg rnd rndkey) va_s0 /\ va_is_dst_xmm rndkey va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ (rndkey == 1 \/ rndkey == 2 \/ rndkey == 15) /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ rnd + 1 < FStar.Seq.Base.length #quad32 round_keys /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys rnd))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (rnd + 1) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_operand_xmm rndkey va_sM va_s0))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_plain va_b0 va_s0 alg rnd key_words round_keys keys_b init rndkey = va_reveal_opaque (`%va_code_Loop6x_plain) (va_code_Loop6x_plain alg rnd rndkey); let (va_old_s:va_state) = va_s0 in let (va_b1:va_codes) = va_get_block va_b0 in let (va_s9, va_fc9) = va_lemma_Load128_buffer (va_hd va_b1) va_s0 (va_op_heaplet_mem_heaplet 0) rndkey (va_op_reg_opr64_reg64 rRcx) (16 `op_Multiply` (rnd + 1) - 128) Secret keys_b (rnd + 1) in let va_b9 = va_tl va_b1 in let (va_s10, va_fc10) = va_lemma_VAESNI_enc (va_hd va_b9) va_s9 (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) rndkey in let va_b10 = va_tl va_b9 in let (va_s11, va_fc11) = va_lemma_VAESNI_enc (va_hd va_b10) va_s10 (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) rndkey in let va_b11 = va_tl va_b10 in let (va_s12, va_fc12) = va_lemma_VAESNI_enc (va_hd va_b11) va_s11 (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) rndkey in let va_b12 = va_tl va_b11 in let (va_s13, va_fc13) = va_lemma_VAESNI_enc (va_hd va_b12) va_s12 (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) rndkey in let va_b13 = va_tl va_b12 in let (va_s14, va_fc14) = va_lemma_VAESNI_enc (va_hd va_b13) va_s13 (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) rndkey in let va_b14 = va_tl va_b13 in let (va_s15, va_fc15) = va_lemma_VAESNI_enc (va_hd va_b14) va_s14 (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) rndkey in let va_b15 = va_tl va_b14 in Vale.AES.AES_s.eval_rounds_reveal (); Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall (); let (va_sM, va_f15) = va_lemma_empty_total va_s15 va_b15 in let va_f14 = va_lemma_merge_total va_b14 va_s14 va_fc15 va_s15 va_f15 va_sM in let va_f13 = va_lemma_merge_total va_b13 va_s13 va_fc14 va_s14 va_f14 va_sM in let va_f12 = va_lemma_merge_total va_b12 va_s12 va_fc13 va_s13 va_f13 va_sM in let va_f11 = va_lemma_merge_total va_b11 va_s11 va_fc12 va_s12 va_f12 va_sM in let va_f10 = va_lemma_merge_total va_b10 va_s10 va_fc11 va_s11 va_f11 va_sM in let va_f9 = va_lemma_merge_total va_b9 va_s9 va_fc10 va_s10 va_f10 va_sM in let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc9 va_s9 va_f9 va_sM in (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_plain (alg:algorithm) (rnd:nat) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (init:quad32_6) (rndkey:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_is_dst_xmm rndkey va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ (rndkey == 1 \/ rndkey == 2 \/ rndkey == 15) /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ rnd + 1 < FStar.Seq.Base.length #quad32 round_keys /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys rnd) /\ (forall (va_x_rndkey:va_value_xmm) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_operand_xmm rndkey va_x_rndkey va_s0))))))) in va_get_ok va_sM /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (rnd + 1) ==> va_k va_sM (()))) val va_wpProof_Loop6x_plain : alg:algorithm -> rnd:nat -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> init:quad32_6 -> rndkey:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_plain alg rnd rndkey) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_plain (va_code_Loop6x_plain alg rnd rndkey) va_s0 alg rnd key_words round_keys keys_b init rndkey in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_operand_xmm rndkey va_sM va_s0)))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_plain (alg:algorithm) (rnd:nat) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (init:quad32_6) (rndkey:va_operand_xmm) : (va_quickCode unit (va_code_Loop6x_plain alg rnd rndkey)) = (va_QProc (va_code_Loop6x_plain alg rnd rndkey) ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_mod_xmm rndkey]) (va_wp_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey) (va_wpProof_Loop6x_plain alg rnd key_words round_keys keys_b init rndkey)) //-- //-- Loop6x_preamble val va_code_Loop6x_preamble : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_preamble alg = (va_Block (va_CCons (va_code_Loop6x_ctr_update alg) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_CCons (va_code_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_CNil ()))))))) val va_codegen_success_Loop6x_preamble : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_preamble alg = (va_pbool_and (va_codegen_success_Loop6x_ctr_update alg) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_preamble (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_preamble alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_ctr_update alg h_LE key_words round_keys keys_b hkeys_b ctr_BE) (fun (va_s:va_state) _ -> let (va_arg43:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg42:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 479 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg42 va_arg43) (let (va_arg41:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg40:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 480 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg40 va_arg41) (let (va_arg39:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg38:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 481 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg38 va_arg39) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 498 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 128 Secret scratch_b 8) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg37:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg36:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 499 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg36 va_arg37) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 500 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg35:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg34:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 500 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg34 va_arg35) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 501 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_opr128_xmm 15)) (fun (va_s:va_state) _ -> let (va_arg33:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg32:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 501 column 54 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.init_rounds_opaque va_arg32 va_arg33) (va_QEmpty (())))))))))))))) val va_lemma_Loop6x_preamble : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 -> iv_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_preamble alg) va_s0 /\ va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8 /\ (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0 /\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_preamble va_b0 va_s0 alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_preamble va_mods alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_preamble alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 402 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in label va_range1 "***** POSTCONDITION NOT MET AT line 459 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 464 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in label va_range1 "***** POSTCONDITION NOT MET AT line 466 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 469 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 472 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 473 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 475 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_preamble (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in sse_enabled /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9 va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256 ==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\ hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_r11:nat64) (va_x_xmm3:quad32) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_xmm 3 va_x_xmm3 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem va_x_mem va_s0)))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 8 8 /\ (let init = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_sM)) in (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys 0 /\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ va_get_xmm 3 va_sM == Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 0 va_s0))) ==> va_k va_sM (()))) val va_wpProof_Loop6x_preamble : alg:algorithm -> h_LE:quad32 -> iv_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_preamble alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_preamble (va_code_Loop6x_preamble alg) va_s0 alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_xmm 3 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_preamble (alg:algorithm) (h_LE:quad32) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode unit (va_code_Loop6x_preamble alg)) = (va_QProc (va_code_Loop6x_preamble alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_xmm 3; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_wpProof_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)) //-- //-- Loop6x_reverse128 val va_code_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_reverse128 in0_offset stack_offset = (va_Block (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true) (va_CNil ())))))) val va_codegen_success_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_reverse128 in0_offset stack_offset = (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_reverse128 (va_mods:va_mods_t) (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) : (va_quickCode unit (va_code_Loop6x_reverse128 in0_offset stack_offset)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 527 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16 + 8) Secret true in0_b (start + in0_offset)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 528 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (in0_offset `op_Multiply` 16) Secret false in0_b (start + in0_offset)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 529 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (stack_offset `op_Multiply` 16) Secret false scratch_b stack_offset) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 530 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (stack_offset `op_Multiply` 16 + 8) Secret true scratch_b stack_offset) (fun (va_s:va_state) _ -> let (va_arg10:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_s) in let (va_arg9:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_old_s) in let (va_arg8:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_old_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 531 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.lemma_reverse_bytes_quad32_64 va_arg8 va_arg9 va_arg10) (va_QEmpty (())))))))) val va_lemma_Loop6x_reverse128 : va_b0:va_code -> va_s0:va_state -> in0_offset:nat -> stack_offset:nat -> start:nat -> in0_b:buffer128 -> scratch_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_reverse128 in0_offset stack_offset) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b start (in0_offset + 1) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b (stack_offset + 1) (va_get_mem_layout va_s0) Secret))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset /\ Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_reverse128 va_b0 va_s0 in0_offset stack_offset start in0_b scratch_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_reverse128 va_mods in0_offset stack_offset start in0_b scratch_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_reverse128 in0_offset stack_offset) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 504 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 523 column 94 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 88 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_reverse128 (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b start (in0_offset + 1) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b (stack_offset + 1) (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_heap3:vale_heap) . let va_sM = va_upd_mem_heaplet 3 va_x_heap3 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12 (va_upd_mem va_x_mem va_s0))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) stack_offset stack_offset /\ Vale.X64.Decls.buffer128_read scratch_b stack_offset (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (start + in0_offset) (va_get_mem_heaplet 6 va_s0))) ==> va_k va_sM (()))) val va_wpProof_Loop6x_reverse128 : in0_offset:nat -> stack_offset:nat -> start:nat -> in0_b:buffer128 -> scratch_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_reverse128 in0_offset stack_offset) ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_reverse128 (va_code_Loop6x_reverse128 in0_offset stack_offset) va_s0 in0_offset stack_offset start in0_b scratch_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_reverse128 (in0_offset:nat) (stack_offset:nat) (start:nat) (in0_b:buffer128) (scratch_b:buffer128) : (va_quickCode unit (va_code_Loop6x_reverse128 in0_offset stack_offset)) = (va_QProc (va_code_Loop6x_reverse128 in0_offset stack_offset) ([va_Mod_mem_heaplet 3; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_mem]) (va_wp_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b) (va_wpProof_Loop6x_reverse128 in0_offset stack_offset start in0_b scratch_b)) //-- //-- Loop6x_round9 val va_code_Loop6x_round9 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_round9 alg = (va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_CNil ()))))))))))))))) val va_codegen_success_Loop6x_round9 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_round9 alg = (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_ttrue ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_round9 (va_mods:va_mods_t) (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Loop6x_round9 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 567 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 7) 16 Secret scratch_b 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 568 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret in_b (count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 568 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 2) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 0 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 569 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret in_b (count `op_Multiply` 6 + 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 569 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 16 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret in_b (count `op_Multiply` 6 + 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 32 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret in_b (count `op_Multiply` 6 + 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 6) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 48 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret in_b (count `op_Multiply` 6 + 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 7) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 64 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 573 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret in_b (count `op_Multiply` 6 + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 573 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 3) (va_op_xmm_xmm 1) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 6) (va_op_reg64_reg64 rRdi) 80 Secret)) (va_QEmpty (())))))))))))))))) val va_lemma_Loop6x_round9 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> count:nat -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Loop6x_round9 alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 1 va_s0 == Vale.X64.Decls.buffer128_read keys_b (Vale.AES.AES_common_s.nr alg) (va_get_mem_heaplet 0 va_s0)))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1 /\ (va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_round9 va_b0 va_s0 alg count in_b scratch_b key_words round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_round9 va_mods alg count in_b scratch_b key_words round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_round9 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 561 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 563 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 564 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Loop6x_round9 (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 8 (va_get_mem_layout va_s0) Secret /\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 1 va_s0 == Vale.X64.Decls.buffer128_read keys_b (Vale.AES.AES_common_s.nr alg) (va_get_mem_heaplet 0 va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM = va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_mem va_x_mem va_s0))))))))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 1 /\ (va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys (Vale.AES.AES_common_s.nr alg)) (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM) == va_get_xmm 7 va_s0) ==> va_k va_sM (()))) val va_wpProof_Loop6x_round9 : alg:algorithm -> count:nat -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_round9 alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_round9 (va_code_Loop6x_round9 alg) va_s0 alg count in_b scratch_b key_words round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Loop6x_round9 (alg:algorithm) (count:nat) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Loop6x_round9 alg)) = (va_QProc (va_code_Loop6x_round9 alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_mem]) (va_wp_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b) (va_wpProof_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b)) //-- //-- load_one_msb val va_code_load_one_msb : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_load_one_msb () = (va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 2)) (va_CCons (va_code_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (va_CNil ())))) val va_codegen_success_load_one_msb : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_load_one_msb () = (va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_load_one_msb (va_mods:va_mods_t) : (va_quickCode unit (va_code_load_one_msb ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 583 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ZeroXmm (va_op_xmm_xmm 2)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 584 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.Arch.Types.two_to_nat32 (Vale.Def.Words_s.Mktwo #Vale.Def.Words_s.nat32 0 16777216) == 72057594037927936) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 585 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_PinsrqImm (va_op_xmm_xmm 2) 72057594037927936 1 (va_op_reg_opr64_reg64 rR11)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 586 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Def.Types_s.insert_nat64_reveal ()) (va_QEmpty (()))))))) val va_lemma_load_one_msb : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_load_one_msb ()) va_s0 /\ va_get_ok va_s0 /\ sse_enabled)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))) [@"opaque_to_smt"] let va_lemma_load_one_msb va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok] in let va_qc = va_qcode_load_one_msb va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_load_one_msb ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 576 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 581 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_load_one_msb (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_r11:nat64) (va_x_xmm2:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm 2 va_x_xmm2 (va_upd_reg64 rR11 va_x_r11 va_s0)) in va_get_ok va_sM /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 ==> va_k va_sM (()))) val va_wpProof_load_one_msb : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_load_one_msb va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_load_one_msb ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_load_one_msb va_s0 va_k = let (va_sM, va_f0) = va_lemma_load_one_msb (va_code_load_one_msb ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_load_one_msb () : (va_quickCode unit (va_code_load_one_msb ())) = (va_QProc (va_code_load_one_msb ()) ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_wp_load_one_msb va_wpProof_load_one_msb) //-- //-- Loop6x_final [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_final alg = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_CCons (va_code_load_one_msb ()) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_CCons (va_code_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_CCons (va_code_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (va_CNil ())))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_final alg = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_load_one_msb ()) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (va_ttrue ()))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_final (va_mods:va_mods_t) (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6) (ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 667 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.TypesNative.lemma_quad32_xor_commutes_forall ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 669 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRbp) 128 Secret scratch_b 8) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 671 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 672 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_load_one_msb ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 673 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 674 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 675 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR13) (7 `op_Multiply` 16) Secret false scratch_b 7) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 676 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRdi) (va_const_opr64 96)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 677 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 678 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 679 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store64_buffer128 (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rR12) (7 `op_Multiply` 16 + 8) Secret true scratch_b 7) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 680 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRsi) (va_const_opr64 96)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 681 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRcx) (0 - 128) Secret keys_b 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 683 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 684 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 6) (va_op_xmm_xmm 5) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 685 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 686 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 7) (va_op_xmm_xmm 6) (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 687 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc_last (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 688 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 3) (va_op_xmm_xmm 7) (va_op_xmm_xmm 2)) (fun (va_s:va_state) _ -> let (va_arg117:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg116:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_s in let (va_arg115:Vale.Def.Types_s.quad32) = va_get_xmm 9 va_old_s in let (va_arg114:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg113:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg112:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg111:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 690 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg111 va_arg112 va_arg113 va_arg114 va_arg115 va_arg116 va_arg117) (let (va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg109:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_s in let (va_arg108:Vale.Def.Types_s.quad32) = va_get_xmm 10 va_old_s in let (va_arg107:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg106:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg105:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg104:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 691 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg104 va_arg105 va_arg106 va_arg107 va_arg108 va_arg109 va_arg110) (let (va_arg103:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg102:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let (va_arg101:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_old_s in let (va_arg100:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg99:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg98:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg97:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 692 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg97 va_arg98 va_arg99 va_arg100 va_arg101 va_arg102 va_arg103) (let (va_arg96:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg95:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_s in let (va_arg94:Vale.Def.Types_s.quad32) = va_get_xmm 12 va_old_s in let (va_arg93:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg92:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg91:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg90:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 693 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg90 va_arg91 va_arg92 va_arg93 va_arg94 va_arg95 va_arg96) (let (va_arg89:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg88:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_s in let (va_arg87:Vale.Def.Types_s.quad32) = va_get_xmm 13 va_old_s in let (va_arg86:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg85:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg84:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg83:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 694 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg83 va_arg84 va_arg85 va_arg86 va_arg87 va_arg88 va_arg89) (let (va_arg82:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = round_keys in let (va_arg81:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_s in let (va_arg80:Vale.Def.Types_s.quad32) = va_get_xmm 14 va_old_s in let (va_arg79:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 init in let (va_arg78:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 plain in let (va_arg77:Vale.Def.Types_s.quad32) = __proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs in let (va_arg76:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 695 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.finish_cipher_opt va_arg76 va_arg77 va_arg78 va_arg79 va_arg80 va_arg81 va_arg82) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 696 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___1 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 697 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___2 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 698 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___3 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 699 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___4 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 700 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___5 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 701 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.is_aes_key_LE alg key) alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun _ -> (fun (alg:algorithm) (input_LE:quad32) (key:(seq nat32)) -> Vale.AES.AES_s.aes_encrypt_LE alg key input_LE == Vale.AES.AES_s.eval_cipher alg input_LE (Vale.AES.AES_s.key_to_round_keys_LE alg key)) alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (fun (_:unit) -> finish_aes_encrypt_le alg (__proj__Mktuple6__item___6 #quad32 #quad32 #quad32 #quad32 #quad32 #quad32 ctrs) key_words) (let (va_arg75:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_s) in let (va_arg74:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_old_s) in let (va_arg73:Vale.Def.Types_s.quad32) = inb in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 703 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.lemma_reverse_bytes_quad32_64 va_arg73 va_arg74 va_arg75) (let (va_arg72:Vale.Def.Types_s.quad32) = va_get_xmm 0 va_s in let (va_arg71:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg70:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 705 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg70 va_arg71 va_arg72 1) (let (va_arg69:Vale.Def.Types_s.quad32) = va_get_xmm 5 va_s in let (va_arg68:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg67:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 706 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg67 va_arg68 va_arg69 2) (let (va_arg66:Vale.Def.Types_s.quad32) = va_get_xmm 6 va_s in let (va_arg65:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg64:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 707 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg64 va_arg65 va_arg66 3) (let (va_arg63:Vale.Def.Types_s.quad32) = va_get_xmm 7 va_s in let (va_arg62:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg61:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 708 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg61 va_arg62 va_arg63 4) (let (va_arg60:Vale.Def.Types_s.quad32) = va_get_xmm 3 va_s in let (va_arg59:Vale.Def.Types_s.quad32) = va_get_xmm 1 va_s in let (va_arg58:Vale.Def.Types_s.quad32) = ctr_orig in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 709 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.lemma_incr_msb va_arg58 va_arg59 va_arg60 5) (va_QEmpty (())))))))))))))))))))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_final va_b0 va_s0 alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_final va_mods alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_final alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 589 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 649 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 7 7) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 652 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 654 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32) (c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 655 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 657 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 658 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 660 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 662 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 663 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in label va_range1 "***** POSTCONDITION NOT MET AT line 665 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (ctr + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15 va_sM))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_final (va_code_Loop6x_final alg) va_s0 alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Loop6x_save_output [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_save_output () = (va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret) (va_CCons (va_code_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_CNil ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_save_output () = (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret) (va_pbool_and (va_codegen_success_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_ttrue ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x_save_output (va_mods:va_mods_t) (count:nat) (out_b:buffer128) : (va_quickCode unit (va_code_Loop6x_save_output ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 744 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 9) (0 - 96) Secret out_b (count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 745 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPxor (va_op_xmm_xmm 9) (va_op_xmm_xmm 1) (va_op_opr128_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 746 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 10) (0 - 80) Secret out_b (count `op_Multiply` 6 + 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 747 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 748 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 11) (0 - 64) Secret out_b (count `op_Multiply` 6 + 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 749 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 11) (va_op_xmm_xmm 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 750 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 12) (0 - 48) Secret out_b (count `op_Multiply` 6 + 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 751 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 12) (va_op_xmm_xmm 6)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 752 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 13) (0 - 32) Secret out_b (count `op_Multiply` 6 + 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 753 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 13) (va_op_xmm_xmm 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 754 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rRsi) (va_op_xmm_xmm 14) (0 - 16) Secret out_b (count `op_Multiply` 6 + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 755 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 14) (va_op_xmm_xmm 3)) (va_QEmpty (()))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x_save_output va_b0 va_s0 count out_b = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x_save_output va_mods count out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x_save_output ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 712 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 737 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 738 column 120 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0 (6 `op_Multiply` count)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 740 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 742 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor (va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Loop6x_save_output count out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Loop6x_save_output (va_code_Loop6x_save_output ()) va_s0 count out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Loop6x_partial #push-options "--z3rlimit 50 --max_ifuel 0" [@ "opaque_to_smt" va_qattr] let va_code_untransformedoriginal_Loop6x_partial alg = (va_Block (va_CCons (va_code_Loop6x_preamble alg) (va_CCons (va_code_Loop6x_plain alg 0 (va_op_xmm_xmm 2)) (va_CCons (va_code_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_CCons (va_code_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_CCons (va_code_Loop6x_plain alg 1 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 5 2) (va_CCons (va_code_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_CCons (va_code_Loop6x_plain alg 2 (va_op_xmm_xmm 15)) (va_CCons (va_code_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 3 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 4 3) (va_CCons (va_code_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_CCons (va_code_Loop6x_plain alg 4 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 3 4) (va_CCons (va_code_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3)) (va_CCons (va_code_Loop6x_plain alg 5 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 2 5) (va_CCons (va_code_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_CCons (va_code_ReduceLast false) (va_CCons (va_code_Loop6x_plain alg 6 (va_op_xmm_xmm 15)) (va_CCons (va_code_Loop6x_reverse128 1 6) (va_CCons (va_code_Loop6x_plain alg 7 (va_op_xmm_xmm 1)) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_CCons (va_code_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_CCons (va_code_Loop6x_plain alg 8 (va_op_xmm_xmm 15)) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 10 (va_op_xmm_xmm 15)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_CCons (va_code_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_CCons (va_code_Loop6x_plain alg 12 (va_op_xmm_xmm 15)) (va_CNil ()))))))))))))))))) else va_Block (va_CNil ())) (va_CCons (if (alg = AES_256) then va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_CNil ())) else va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_CNil ()))) (va_CCons (va_code_Loop6x_round9 alg) (va_CNil ())))))))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_untransformedoriginal_Loop6x_partial alg = (va_pbool_and (va_codegen_success_Loop6x_preamble alg) (va_pbool_and (va_codegen_success_Loop6x_plain alg 0 (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 1 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 5 2) (va_pbool_and (va_codegen_success_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 2 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 3 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 4 3) (va_pbool_and (va_codegen_success_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 4 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 3 4) (va_pbool_and (va_codegen_success_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 5 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 2 5) (va_pbool_and (va_codegen_success_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_pbool_and (va_codegen_success_ReduceLast false) (va_pbool_and (va_codegen_success_Loop6x_plain alg 6 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Loop6x_reverse128 1 6) (va_pbool_and (va_codegen_success_Loop6x_plain alg 7 (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true) (va_pbool_and (va_codegen_success_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false) (va_pbool_and (va_codegen_success_Loop6x_plain alg 8 (va_op_xmm_xmm 15)) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 10 (va_op_xmm_xmm 15)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Loop6x_plain alg 12 (va_op_xmm_xmm 15)) (va_ttrue ())))))))))))))))) else va_ttrue ()) (va_pbool_and (if (alg = AES_256) then va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret) (va_ttrue ()) else va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret) (va_ttrue ())) (va_pbool_and (va_codegen_success_Loop6x_round9 alg) (va_ttrue ()))))))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_untransformedoriginal_Loop6x_partial (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32)) (count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode (quad32_6) (va_code_untransformedoriginal_Loop6x_partial alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in let (init:quad32_6) = make_six_of #Vale.Def.Types_s.quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (va_get_xmm 15 va_s)) in let (start:(va_int_at_least 0)) = in0_count `op_Multiply` 6 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 871 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_preamble alg h_LE iv_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 872 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 0 key_words round_keys keys_b init (va_op_xmm_xmm 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 873 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 0 0 (va_op_xmm_xmm 1) (va_op_xmm_xmm 5) (va_op_xmm_xmm 6) (va_op_xmm_xmm 7) (va_op_xmm_xmm 7) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 874 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 1 1 (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 0) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 875 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 1 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 876 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 5 2 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 877 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 2 3 (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 0) (va_op_xmm_xmm 5) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 878 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 2 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 879 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 3 4 (va_op_xmm_xmm 2) (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 0) (va_op_xmm_xmm 1) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 880 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 3 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 881 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 4 3 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 882 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 4 6 (va_op_xmm_xmm 3) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 2) (va_op_xmm_xmm 0) (va_op_xmm_xmm 2) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 883 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 4 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 884 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 3 4 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 885 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_MulAdd_step 5 7 (va_op_xmm_xmm 2) (va_op_xmm_xmm 5) (va_op_xmm_xmm 1) (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_xmm_xmm 3) hkeys_b scratch_b h prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 886 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 5 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 887 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 2 5 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 888 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load_0xc2_msb (va_op_xmm_xmm 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 891 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_ReduceLast false h_LE y_prev data) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 892 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 6 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 893 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_reverse128 1 6 start in0_b scratch_b) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 894 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 7 key_words round_keys keys_b init (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 895 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16 + 8) Secret true in0_b (in0_count `op_Multiply` 6 + 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 896 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_LoadBe64_buffer128 (va_op_heaplet_mem_heaplet 6) (va_op_reg_opr64_reg64 rR12) (va_op_reg_opr64_reg64 rR14) (0 `op_Multiply` 16) Secret false in0_b (in0_count `op_Multiply` 6 + 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 897 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 8 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 901 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qInlineIf va_mods (alg = AES_256) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 913 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret keys_b 10) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 914 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 915 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 916 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 917 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 918 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 919 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 921 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_s.eval_rounds_reveal ()) (va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 922 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.AES_helpers.commute_sub_bytes_shift_rows_forall ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 923 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 10 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 926 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (192 - 128) Secret keys_b 12) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 927 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 9) (va_op_xmm_xmm 9) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 928 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 10) (va_op_xmm_xmm 10) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 929 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 11) (va_op_xmm_xmm 11) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 930 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 12) (va_op_xmm_xmm 12) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 931 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 13) (va_op_xmm_xmm 13) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 932 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VAESNI_enc (va_op_xmm_xmm 14) (va_op_xmm_xmm 14) (va_op_xmm_xmm 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 934 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_plain alg 12 key_words round_keys keys_b init (va_op_xmm_xmm 15)) (va_QEmpty (()))))))))))))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 937 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qInlineIf va_mods (alg = AES_256) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 939 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (224 - 128) Secret keys_b 14) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 943 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) (160 - 128) Secret keys_b 10) (va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 946 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_round9 alg count in_b scratch_b key_words round_keys keys_b) (va_QEmpty ((init)))))))))))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_untransformedoriginal_Loop6x_partial va_b0 va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_untransformedoriginal_Loop6x_partial va_mods alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_untransformedoriginal_Loop6x_partial alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let init = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 758 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in label va_range1 "***** POSTCONDITION NOT MET AT line 837 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 838 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 843 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 844 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 847 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 848 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rR13 va_sM == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 849 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rR12 va_sM == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 850 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in label va_range1 "***** POSTCONDITION NOT MET AT line 852 column 107 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" ((va_get_xmm 2 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 853 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 857 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 858 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 3 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 859 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 860 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 5 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 861 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 863 column 90 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (init == make_six_of #quad32 (fun (n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 864 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in label va_range1 "***** POSTCONDITION NOT MET AT line 865 column 94 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; let init = va_g in (va_sM, va_fM, init) [@ "opaque_to_smt" va_qattr] let va_transform_Loop6x_partial alg = (reorder (va_code_untransformedoriginal_Loop6x_partial alg) (va_code_Loop6x_partial_expected_code alg)) [@ "opaque_to_smt" va_qattr] let va_code_Loop6x_partial alg = (va_get_result (va_transform_Loop6x_partial alg)) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x_partial alg = (va_pbool_and (va_codegen_success_untransformedoriginal_Loop6x_partial alg) (va_get_success (va_transform_Loop6x_partial alg))) [@"opaque_to_smt"] let va_lemma_Loop6x_partial va_b0 va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE = let va_orig = va_code_untransformedoriginal_Loop6x_partial alg in let va_hint = va_code_Loop6x_partial_expected_code alg in let va_transformed = va_code_Loop6x_partial alg in let (va_sM_orig, va_fM_orig, init) = va_lemma_untransformedoriginal_Loop6x_partial va_orig va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_reveal_opaque (`%va_transform_Loop6x_partial) (va_transform_Loop6x_partial alg); va_reveal_opaque (`%va_code_Loop6x_partial) (va_code_Loop6x_partial alg); let (va_sM, va_fM) = lemma_reorder va_orig va_hint va_transformed va_s0 va_sM_orig va_fM_orig in (va_sM, va_fM, init) [@"opaque_to_smt"] let va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k = let (va_sM, va_f0, init) = va_lemma_Loop6x_partial (va_code_Loop6x_partial alg) va_s0 alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = (init) in (va_sM, va_f0, va_g) #pop-options //-- //-- Loop6x #push-options "--z3rlimit 100" [@ "opaque_to_smt" va_qattr] let va_code_Loop6x alg = (va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Loop6x_partial alg) (va_CCons (va_code_Loop6x_final alg) (va_CCons (va_code_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 6)) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 96)) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_IfElse (va_cmp_gt (va_op_cmp_reg64 rRdx) (va_const_cmp 0)) (va_Block (va_CCons (va_code_Loop6x_save_output ()) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRbp) 32 Secret) (va_CCons (va_Block (va_CNil ())) (va_CNil ())))))) (va_Block (va_CCons (va_code_Mem128_lemma ()) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)) (va_CNil ())))))) (va_CNil ()))))))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Loop6x alg = (va_pbool_and (va_codegen_success_Loop6x_partial alg) (va_pbool_and (va_codegen_success_Loop6x_final alg) (va_pbool_and (va_codegen_success_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 6)) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 96)) (va_pbool_and (va_pbool_and (va_codegen_success_Loop6x_save_output ()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRbp) 32 Secret) (va_pbool_and (va_codegen_success_Mem128_lemma ()) (va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret)) (va_codegen_success_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)))))) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Loop6x (va_mods:va_mods_t) (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128) (plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) : (va_quickCode (quad32) (va_code_Loop6x alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (prev:Vale.Math.Poly2_s.poly) = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_s))) in let (y_prev:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 prev) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1100 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 2 >= 0 /\ count - 2 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) ((count - 2) `op_Multiply` 6) ((count - 2) `op_Multiply` 6 + 6)) (fun _ -> let (data:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) ((count - 2) `op_Multiply` 6) ((count - 2) `op_Multiply` 6 + 6) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 1101 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32 prev) (va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1103 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 1 >= 0) (fun _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 1103 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_partial alg h_LE y_prev data count (count - 1) iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE) (fun (va_s:va_state) (init:quad32_6) -> let (ctrs:(six_of Vale.Def.Types_s.quad32)) = make_six_of #Vale.Def.Types_s.quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE i)) in let (plains:(six_of Vale.X64.Decls.quad32)) = make_six_of #Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s)) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 1108 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b (Vale.AES.GCTR.inc32lite ctr_BE 6) init ctrs plains (Vale.X64.Decls.buffer128_read in0_b ((count - 1) `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_s))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 1111 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Sub64 (va_op_dst_opr64_reg64 rRdx) (va_const_opr64 6)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 1112 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 96)) (fun (va_s:va_state) _ -> let (y_new:quad32) = Vale.AES.GHash.ghash_incremental0 h_LE y_prev data in let (mem_snap:vale_heap) = va_get_mem_heaplet 6 va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1116 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 2 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 2) `op_Multiply` 6)) (fun _ -> let (va_arg93:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = data in let (va_arg92:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 2) `op_Multiply` 6) in let (va_arg91:Vale.Def.Types_s.quad32) = y_new in let (va_arg90:Vale.Def.Types_s.quad32) = y_orig in let (va_arg89:Vale.Def.Types_s.quad32) = h_LE in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 1116 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append va_arg89 va_arg90 y_prev va_arg91 va_arg92 va_arg93) (va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1117 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 2 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 2) `op_Multiply` 6)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1117 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (y_new == Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 2) `op_Multiply` 6)) data)) (va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1118 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 2 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 2) `op_Multiply` 6) /\ count - 1 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 1) `op_Multiply` 6)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1118 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 2) `op_Multiply` 6)) data) (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 1) `op_Multiply` 6))) (va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 1 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 1) `op_Multiply` 6)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (y_new == Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in0_b) 0 ((count - 1) `op_Multiply` 6))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 1123 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rRdx) (va_const_cmp 0)) (qblock va_mods (fun (va_s:va_state) -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 1125 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Loop6x_save_output count out_b) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1126 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (count - 1 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out_b) 0 ((count - 1) `op_Multiply` 6) /\ count - 1 >= 0 /\ (fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 mem_snap out_b) 0 ((count - 1) `op_Multiply` 6)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1126 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out_b) 0 ((count - 1) `op_Multiply` 6)) (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 mem_snap out_b) 0 ((count - 1) `op_Multiply` 6))) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 1129 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (fun (va_s:va_state) _ -> let (plain:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in_b in let (cipher:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out_b in let (bound:(va_int_at_least 0)) = count `op_Multiply` 6 in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 1134 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (bound >= 0 /\ bound <= 4294967295) (fun _ -> let (va_arg88:Vale.Def.Types_s.quad32) = ctr_BE_orig in let (va_arg87:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key_words in let (va_arg86:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher in let (va_arg85:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_old_s) out_b in let (va_arg84:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg83:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg82:Vale.Def.Types_s.nat32) = bound in let (va_arg81:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 1134 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_ignores_postfix va_arg81 va_arg82 va_arg83 va_arg84 va_arg85 va_arg86 va_arg87 va_arg88) (let (va_arg80:Vale.Def.Types_s.quad32) = ctr_BE_orig in let (va_arg79:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key_words in let (va_arg78:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher in let (va_arg77:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg76:Prims.nat) = bound in let (va_arg75:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 1137 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_partial_extend6 va_arg75 va_arg76 va_arg77 va_arg78 va_arg79 va_arg80) (let (va_arg74:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in let (va_arg73:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_s)) in let (va_arg72:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 1138 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_add_manip va_arg72 va_arg73 va_arg74) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1139 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (y_new == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) (va_QEmpty (())))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 1143 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_Mem128_lemma (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret scratch_b 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 1143 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_opr_code_Mem128 (va_op_heaplet_mem_heaplet 3) (va_op_reg64_reg64 rRbp) 16 Secret)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 1144 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_quick_VPolyAdd (va_op_xmm_xmm 8) (va_op_xmm_xmm 8) (va_op_opr128_xmm 4)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1145 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s) == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data))) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1146 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s)) == Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data)))) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 1147 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 8 va_s == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental h_LE y_prev data)) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 1149 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_registers_reveal ()) (va_QEmpty ((y_new))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Loop6x va_b0 va_s0 alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Loop6x va_mods alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop6x alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let y_new = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 952 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 1046 column 105 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM > 0 ==> Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1047 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM == va_get_mem_heaplet 6 va_s0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1048 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1049 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1052 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1053 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1054 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1055 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1057 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1060 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1061 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1062 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let z3' = va_if (va_get_reg64 rRdx va_sM = 0) (fun _ -> va_get_xmm 7 va_sM) (fun _ -> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in label va_range1 "***** POSTCONDITION NOT MET AT line 1063 column 112 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm 15 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1064 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1068 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM == 0 ==> Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM) (va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words ctr_BE_orig count) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1069 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (let inout4' = va_if (va_get_reg64 rRbx va_sM + 6 < 256) (fun _ -> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) (fun _ -> va_get_xmm 13 va_sM) in label va_range1 "***** POSTCONDITION NOT MET AT line 1071 column 109 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, inout4', va_get_xmm 3 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1075 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM > 0 ==> make_six_of #Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1078 column 112 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM > 0 ==> Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1081 column 101 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (y_new == Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1084 column 99 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))) (Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1 (va_get_mem_heaplet 3 va_sM)))))) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1085 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1087 column 97 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 1088 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****" (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_ok; va_Mod_mem]) va_sM va_s0; let y_new = va_g in (va_sM, va_fM, y_new)
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Flags.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Transformers.Transform.fsti.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.X64.PolyOps.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.X64.AESGCM_expected_code.fsti.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_helpers.fsti.checked", "Vale.AES.AES_common_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.AESopt.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Transformers.Transform", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM_expected_code", "short_module": null }, { "abbrev...
{ "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": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> h_LE: Vale.X64.Decls.quad32 -> y_orig: Vale.X64.Decls.quad32 -> y_prev: Vale.X64.Decls.quad32 -> count: Prims.nat -> iv_b: Vale.X64.Memory.buffer128 -> in0_b: Vale.X64.Memory.buffer128 -> in_b: Vale.X64.Memory.buffer128 -> out_b: Vale.X64.Memory.buffer128 -> scratch_b: Vale.X64.Memory.buffer128 -> plain_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> keys_b: Vale.X64.Memory.buffer128 -> hkeys_b: Vale.X64.Memory.buffer128 -> ctr_BE_orig: Vale.X64.Decls.quad32 -> ctr_BE: Vale.X64.Decls.quad32 -> va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Vale.X64.Decls.quad32 -> Type0) -> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Vale.X64.Decls.quad32)
Prims.Ghost
[]
[]
[ "Vale.AES.AES_common_s.algorithm", "Vale.X64.Decls.quad32", "Prims.nat", "Vale.X64.Memory.buffer128", "FStar.Seq.Base.seq", "Vale.X64.Memory.nat32", "Vale.X64.Decls.va_state", "Vale.X64.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.Def.Types_s.quad32", "Prims.unit", "Vale.X64.Quick...
[]
false
false
false
false
false
let va_wpProof_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE va_s0 va_k =
let va_sM, va_f0, y_new = va_lemma_Loop6x (va_code_Loop6x alg) va_s0 alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM ( va_update_reg64 rRbx va_sM ( va_update_reg64 rRdx va_sM ( va_update_reg64 rRsi va_sM ( va_update_reg64 rRdi va_sM ( va_update_ok va_sM ( va_update_mem va_sM va_s0 ) ) ) ) ) ) )) )))))))))) ))))))))))))); va_lemma_norm_mods ([ va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem ]) va_sM va_s0; let va_g = (y_new) in (va_sM, va_f0, va_g)
false
Spec.Ed25519.fst
Spec.Ed25519.point_double_c
val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid
val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid
let point_double_c p = EL.to_aff_point_double_lemma p; point_double p
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 67, "start_col": 0, "start_line": 65 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.Exponentiation.sqr_st Spec.Ed25519.ext_point_c Spec.Ed25519.mk_to_ed25519_comm_monoid
Prims.Tot
[ "total" ]
[]
[ "Spec.Ed25519.ext_point_c", "Spec.Ed25519.PointOps.point_double", "Prims.unit", "Spec.Ed25519.Lemmas.to_aff_point_double_lemma" ]
[]
false
false
false
true
false
let point_double_c p =
EL.to_aff_point_double_lemma p; point_double p
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.cur_goal
val cur_goal: Prims.unit -> Tac typ
val cur_goal: Prims.unit -> Tac typ
let cur_goal () : Tac typ = goal_type (_cur_goal ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 81, "start_col": 0, "start_line": 81 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.typ
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.goal_type", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Tactics.Types.goal", "FStar.Tactics.V2.Derived._cur_goal" ]
[]
false
true
false
false
false
let cur_goal () : Tac typ =
goal_type (_cur_goal ())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.cur_env
val cur_env: Prims.unit -> Tac env
val cur_env: Prims.unit -> Tac env
let cur_env () : Tac env = goal_env (_cur_goal ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 50, "end_line": 78, "start_col": 0, "start_line": 78 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.env
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.goal_env", "FStar.Stubs.Reflection.Types.env", "FStar.Stubs.Tactics.Types.goal", "FStar.Tactics.V2.Derived._cur_goal" ]
[]
false
true
false
false
false
let cur_env () : Tac env =
goal_env (_cur_goal ())
false
Spec.Ed25519.fst
Spec.Ed25519.mk_ed25519_comm_monoid
val mk_ed25519_comm_monoid:LE.comm_monoid aff_point_c
val mk_ed25519_comm_monoid:LE.comm_monoid aff_point_c
let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; }
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 45, "start_col": 0, "start_line": 39 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Exponentiation.Definition.comm_monoid Spec.Ed25519.aff_point_c
Prims.Tot
[ "total" ]
[]
[ "Lib.Exponentiation.Definition.Mkcomm_monoid", "Spec.Ed25519.aff_point_c", "Spec.Ed25519.PointOps.aff_point_at_infinity", "Spec.Ed25519.aff_point_add_c", "Spec.Ed25519.Lemmas.aff_point_at_infinity_lemma", "Spec.Ed25519.Lemmas.aff_point_add_assoc_lemma", "Spec.Ed25519.Lemmas.aff_point_add_comm_lemma" ]
[]
false
false
false
true
false
let mk_ed25519_comm_monoid:LE.comm_monoid aff_point_c =
{ LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma }
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.exact_with_ref
val exact_with_ref (t: term) : Tac unit
val exact_with_ref (t: term) : Tac unit
let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 51, "end_line": 114, "start_col": 0, "start_line": 113 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Tactics.V2.Derived.with_policy", "Prims.unit", "FStar.Stubs.Tactics.Types.SMT", "FStar.Stubs.Tactics.V2.Builtins.t_exact" ]
[]
false
true
false
false
false
let exact_with_ref (t: term) : Tac unit =
with_policy SMT (fun () -> t_exact true true t)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.cur_vars
val cur_vars: Prims.unit -> Tac (list binding)
val cur_vars: Prims.unit -> Tac (list binding)
let cur_vars () : Tac (list binding) = vars_of_env (cur_env ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 95, "start_col": 0, "start_line": 94 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Tactics.NamedView.binding)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Reflection.V2.Builtins.vars_of_env", "Prims.list", "FStar.Tactics.NamedView.binding", "FStar.Stubs.Reflection.Types.env", "FStar.Tactics.V2.Derived.cur_env" ]
[]
false
true
false
false
false
let cur_vars () : Tac (list binding) =
vars_of_env (cur_env ())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.trivial
val trivial: Prims.unit -> Tac unit
val trivial: Prims.unit -> Tac unit
let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 121, "start_col": 0, "start_line": 116 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.exact", "FStar.Reflection.V2.Formula.formula", "FStar.Tactics.Effect.raise", "FStar.Tactics.V2.Derived.Goal_not_trivial", "FStar.Reflection.V2.Formula.term_as_formula", "FStar.Stubs.Reflection.Types.typ", "FStar.Tactics.V2.Derived.cur_goal", "FStar.Stubs.Tacti...
[]
false
true
false
false
false
let trivial () : Tac unit =
norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_wpProof_Store_stack64
val va_wpProof_Store_stack64 : src:va_operand_reg_opr -> offset:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Store_stack64 src offset va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_stack64 src offset) ([va_Mod_stackTaint; va_Mod_stack]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Store_stack64 : src:va_operand_reg_opr -> offset:int -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Store_stack64 src offset va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_stack64 src offset) ([va_Mod_stackTaint; va_Mod_stack]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Store_stack64 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack64 (va_code_Store_stack64 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 166, "start_col": 0, "start_line": 159 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack128 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack128 (va_code_Store_stack128 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack128 [@ "opaque_to_smt"] let va_code_Load_stack128 dst offset = (Ins (S.LoadStack128 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack128 dst offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Load_stack128 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_stack128 dst offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_stack128 (va_code_Load_stack128 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack64 [@ "opaque_to_smt"] let va_code_Store_stack64 src offset = (Ins (S.StoreStack64 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack64 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack64 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack64) (va_code_Store_stack64 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack64 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack64 src Secret offset)) va_s0 in (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
src: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_stackTaint"...
[]
false
false
false
false
false
let va_wpProof_Store_stack64 src offset va_s0 va_k =
let va_sM, va_f0 = va_lemma_Store_stack64 (va_code_Store_stack64 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_wpProof_Dealloc_stack
val va_wpProof_Dealloc_stack : n:nat64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Dealloc_stack n va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Dealloc_stack n) ([va_Mod_stack; va_Mod_reg 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Dealloc_stack : n:nat64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Dealloc_stack n va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Dealloc_stack n) ([va_Mod_stack; va_Mod_reg 1]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 74, "start_col": 0, "start_line": 67 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Vale.PPC64LE.Memory.nat64 -> va_s0: Vale.PPC64LE.Decls.va_state -> va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Memory.nat64", "Vale.PPC64LE.Decls.va_state", "Prims.unit", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_stack", "Vale.PPC64LE.QuickCode.va_M...
[]
false
false
false
false
false
let va_wpProof_Dealloc_stack n va_s0 va_k =
let va_sM, va_f0 = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))) ); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.cur_witness
val cur_witness: Prims.unit -> Tac term
val cur_witness: Prims.unit -> Tac term
let cur_witness () : Tac term = goal_witness (_cur_goal ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 59, "end_line": 84, "start_col": 0, "start_line": 84 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.goal_witness", "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.Types.goal", "FStar.Tactics.V2.Derived._cur_goal" ]
[]
false
true
false
false
false
let cur_witness () : Tac term =
goal_witness (_cur_goal ())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.exact
val exact (t: term) : Tac unit
val exact (t: term) : Tac unit
let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 108, "start_col": 0, "start_line": 107 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Tactics.V2.Derived.with_policy", "Prims.unit", "FStar.Stubs.Tactics.Types.SMT", "FStar.Stubs.Tactics.V2.Builtins.t_exact" ]
[]
false
true
false
false
false
let exact (t: term) : Tac unit =
with_policy SMT (fun () -> t_exact true false t)
false
Spec.Ed25519.fst
Spec.Ed25519.sha512_modq
val sha512_modq (len: nat{len <= max_input_length_sha512}) (s: bytes{length s = len}) : n: nat{n < pow2 256}
val sha512_modq (len: nat{len <= max_input_length_sha512}) (s: bytes{length s = len}) : n: nat{n < pow2 256}
let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 79, "end_line": 30, "start_col": 0, "start_line": 29 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Prims.nat{len <= Spec.Ed25519.max_input_length_sha512} -> s: Lib.ByteSequence.bytes{Lib.Sequence.length s = len} -> n: Prims.nat{n < Prims.pow2 256}
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Spec.Ed25519.max_input_length_sha512", "Lib.ByteSequence.bytes", "Prims.op_Equality", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Modulus", "Lib.ByteSequence.nat_from_bytes_le", "Spec.Ag...
[]
false
false
false
false
false
let sha512_modq (len: nat{len <= max_input_length_sha512}) (s: bytes{length s = len}) : n: nat{n < pow2 256} =
nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.trefl_guard
val trefl_guard: Prims.unit -> Tac unit
val trefl_guard: Prims.unit -> Tac unit
let trefl_guard () : Tac unit = t_trefl true
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 200, "start_col": 0, "start_line": 199 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.t_trefl" ]
[]
false
true
false
false
false
let trefl_guard () : Tac unit =
t_trefl true
false
Spec.Ed25519.fst
Spec.Ed25519.point_at_inifinity_c
val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid
val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid
let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 19, "end_line": 57, "start_col": 0, "start_line": 55 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); }
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.Exponentiation.one_st Spec.Ed25519.ext_point_c Spec.Ed25519.mk_to_ed25519_comm_monoid
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Spec.Ed25519.PointOps.point_at_infinity", "Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma", "Spec.Ed25519.ext_point_c" ]
[]
false
false
false
true
false
let point_at_inifinity_c _ =
EL.to_aff_point_at_infinity_lemma (); point_at_infinity
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.qed
val qed: Prims.unit -> Tac unit
val qed: Prims.unit -> Tac unit
let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!"
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 148, "start_col": 0, "start_line": 145 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Stubs.Tactics.Types.goal", "FStar.Tactics.V2.Derived.fail", "FStar.Tactics.V2.Derived.goals" ]
[]
false
true
false
false
false
let qed () : Tac unit =
match goals () with | [] -> () | _ -> fail "qed: not done!"
false
Spec.Ed25519.fst
Spec.Ed25519.size_signature
val size_signature:size_nat
val size_signature:size_nat
let size_signature: size_nat = 64
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 19, "start_col": 0, "start_line": 19 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100"
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n <= Prims.pow2 32 - 1}
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
false
false
let size_signature:size_nat =
64
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.debug
val debug (m: string) : Tac unit
val debug (m: string) : Tac unit
let debug (m:string) : Tac unit = if debugging () then print m
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 154, "start_col": 0, "start_line": 153 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
m: Prims.string -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.string", "FStar.Stubs.Tactics.V2.Builtins.print", "Prims.unit", "Prims.bool", "FStar.Stubs.Tactics.V2.Builtins.debugging" ]
[]
false
true
false
false
false
let debug (m: string) : Tac unit =
if debugging () then print m
false
Spec.Ed25519.fst
Spec.Ed25519.q
val q:n: nat{n < pow2 256}
val q:n: nat{n < pow2 256}
let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493)
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 53, "end_line": 23, "start_col": 0, "start_line": 21 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat{n < Prims.pow2 256}
Prims.Tot
[ "total" ]
[]
[ "Prims.op_Addition", "Prims.pow2", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Subtraction" ]
[]
false
false
false
false
false
let q:n: nat{n < pow2 256} =
assert_norm (pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.later
val later: Prims.unit -> Tac unit
val later: Prims.unit -> Tac unit
let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals"
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 33, "end_line": 175, "start_col": 0, "start_line": 172 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.goal", "Prims.list", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "FStar.Tactics.V2.Derived.op_At", "Prims.Cons", "Prims.Nil", "FStar.Tactics.V2.Derived.fail", "FStar.Tactics.V2.Derived.goals" ]
[]
false
true
false
false
false
let later () : Tac unit =
match goals () with | g :: gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals"
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_lemma_Dealloc_stack
val va_lemma_Dealloc_stack : va_b0:va_code -> va_s0:va_state -> n:nat64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Dealloc_stack n) va_s0 /\ va_get_ok va_s0 /\ n `op_Modulus` 16 == 0 /\ va_get_reg 1 va_s0 >= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 65536 /\ va_get_reg 1 va_s0 + n <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 + n /\ va_get_stack va_sM == Vale.PPC64LE.Stack_i.free_stack64 (va_get_reg 1 va_sM - n) (va_get_reg 1 va_sM) (va_get_stack va_s0) /\ va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))))
val va_lemma_Dealloc_stack : va_b0:va_code -> va_s0:va_state -> n:nat64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Dealloc_stack n) va_s0 /\ va_get_ok va_s0 /\ n `op_Modulus` 16 == 0 /\ va_get_reg 1 va_s0 >= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 65536 /\ va_get_reg 1 va_s0 + n <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 + n /\ va_get_stack va_sM == Vale.PPC64LE.Stack_i.free_stack64 (va_get_reg 1 va_sM - n) (va_get_reg 1 va_sM) (va_get_stack va_s0) /\ va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))))
let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 63, "start_col": 0, "start_line": 58 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> n: Vale.PPC64LE.Memory.nat64 -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Memory.nat64", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Prims.nat", "Vale...
[]
false
false
false
false
false
let va_lemma_Dealloc_stack va_b0 va_s0 n =
va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.apply_lemma
val apply_lemma (t: term) : Tac unit
val apply_lemma (t: term) : Tac unit
let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 192, "start_col": 0, "start_line": 191 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.t_apply_lemma", "Prims.unit" ]
[]
false
true
false
false
false
let apply_lemma (t: term) : Tac unit =
t_apply_lemma false false t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.apply_noinst
val apply_noinst (t: term) : Tac unit
val apply_noinst (t: term) : Tac unit
let apply_noinst (t : term) : Tac unit = t_apply true true false t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 29, "end_line": 185, "start_col": 0, "start_line": 184 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.t_apply", "Prims.unit" ]
[]
false
true
false
false
false
let apply_noinst (t: term) : Tac unit =
t_apply true true false t
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_lemma_Store_stack128
val va_lemma_Store_stack128 : va_b0:va_code -> va_s0:va_state -> src:va_operand_vec_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_stack128 src offset) va_s0 /\ va_is_src_vec_opr src va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset128 offset /\ va_get_reg 1 va_s0 + offset <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 16)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_stack va_sM == Vale.PPC64LE.Stack_i.store_stack128 (va_get_reg 1 va_sM + offset) (va_eval_vec_opr va_s0 src) (va_get_stack va_s0) /\ va_get_stackTaint va_sM == Vale.PPC64LE.Stack_i.store_taint_stack128 (va_get_reg 1 va_sM + offset) Secret (va_get_stackTaint va_s0) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))))
val va_lemma_Store_stack128 : va_b0:va_code -> va_s0:va_state -> src:va_operand_vec_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_stack128 src offset) va_s0 /\ va_is_src_vec_opr src va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset128 offset /\ va_get_reg 1 va_s0 + offset <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 16)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_stack va_sM == Vale.PPC64LE.Stack_i.store_stack128 (va_get_reg 1 va_sM + offset) (va_eval_vec_opr va_s0 src) (va_get_stack va_s0) /\ va_get_stackTaint va_sM == Vale.PPC64LE.Stack_i.store_taint_stack128 (va_get_reg 1 va_sM + offset) Secret (va_get_stackTaint va_s0) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))))
let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 93, "start_col": 0, "start_line": 88 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> src: Vale.PPC64LE.Decls.va_operand_vec_opr -> offset: Prims.int -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_operand_vec_opr", "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.sta...
[]
false
false
false
false
false
let va_lemma_Store_stack128 va_b0 va_s0 src offset =
va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.apply
val apply (t: term) : Tac unit
val apply (t: term) : Tac unit
let apply (t : term) : Tac unit = t_apply true false false t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 182, "start_col": 0, "start_line": 181 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.t_apply", "Prims.unit" ]
[]
false
true
false
false
false
let apply (t: term) : Tac unit =
t_apply true false false t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.commute_applied_match
val commute_applied_match: Prims.unit -> Tac unit
val commute_applied_match: Prims.unit -> Tac unit
let commute_applied_match () : Tac unit = t_commute_applied_match ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 204, "start_col": 0, "start_line": 203 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.t_commute_applied_match" ]
[]
false
true
false
false
false
let commute_applied_match () : Tac unit =
t_commute_applied_match ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.apply_lemma_rw
val apply_lemma_rw (t: term) : Tac unit
val apply_lemma_rw (t: term) : Tac unit
let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 212, "start_col": 0, "start_line": 211 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.t_apply_lemma", "Prims.unit" ]
[]
false
true
false
false
false
let apply_lemma_rw (t: term) : Tac unit =
t_apply_lemma false true t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.apply_lemma_noinst
val apply_lemma_noinst (t: term) : Tac unit
val apply_lemma_noinst (t: term) : Tac unit
let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 209, "start_col": 0, "start_line": 208 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.t_apply_lemma", "Prims.unit" ]
[]
false
true
false
false
false
let apply_lemma_noinst (t: term) : Tac unit =
t_apply_lemma true false t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.t_pointwise
val t_pointwise (d: direction) (tau: (unit -> Tac unit)) : Tac unit
val t_pointwise (d: direction) (tau: (unit -> Tac unit)) : Tac unit
let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 24, "end_line": 239, "start_col": 0, "start_line": 232 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
d: FStar.Stubs.Tactics.Types.direction -> tau: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Stubs.Tactics.Types.direction", "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.ctrl_rewrite", "FStar.Tactics.NamedView.term", "FStar.Pervasives.Native.tuple2", "Prims.bool", "FStar.Stubs.Tactics.Types.ctrl_flag", "FStar.Pervasives.Native.Mktuple2", "FStar.Stubs.Tactics.Types.Continue" ]
[]
false
true
false
false
false
let t_pointwise (d: direction) (tau: (unit -> Tac unit)) : Tac unit =
let ctrl (t: term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.trefl
val trefl: Prims.unit -> Tac unit
val trefl: Prims.unit -> Tac unit
let trefl () : Tac unit = t_trefl false
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 196, "start_col": 0, "start_line": 195 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.t_trefl" ]
[]
false
true
false
false
false
let trefl () : Tac unit =
t_trefl false
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.fail
val fail (#a: Type) (m: string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps))
val fail (#a: Type) (m: string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps))
let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 64, "start_col": 0, "start_line": 62 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
m: Prims.string -> FStar.Tactics.Effect.TAC a
FStar.Tactics.Effect.TAC
[]
[]
[ "Prims.string", "FStar.Tactics.Effect.raise", "FStar.Stubs.Tactics.Common.TacticFailure", "FStar.Stubs.Tactics.Types.proofstate", "FStar.Stubs.Tactics.Result.__result", "FStar.Stubs.Tactics.Result.Failed" ]
[]
false
true
false
false
false
let fail (#a: Type) (m: string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) =
raise #a (TacticFailure m)
false
Spec.Ed25519.fst
Spec.Ed25519.max_input_length_sha512
val max_input_length_sha512 : Prims.pos
let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512)
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 109, "end_line": 25, "start_col": 0, "start_line": 25 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.pos
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.Native.__proj__Some__item__v", "Prims.pos", "Spec.Hash.Definitions.max_input_length", "Spec.Hash.Definitions.SHA2_512" ]
[]
false
false
false
true
false
let max_input_length_sha512 =
Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512)
false
Spec.Ed25519.fst
Spec.Ed25519.point_mul_g
val point_mul_g (a: lbytes 32) : ext_point_c
val point_mul_g (a: lbytes 32) : ext_point_c
let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 87, "start_col": 0, "start_line": 85 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.ByteSequence.lbytes 32 -> Spec.Ed25519.ext_point_c
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.Ed25519.point_mul", "Spec.Ed25519.PointOps.g", "Prims.unit", "Spec.Ed25519.Lemmas.g_is_on_curve", "Spec.Ed25519.ext_point_c" ]
[]
false
false
false
false
false
let point_mul_g (a: lbytes 32) : ext_point_c =
EL.g_is_on_curve (); point_mul a g
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.cur_module
val cur_module: Prims.unit -> Tac name
val cur_module: Prims.unit -> Tac name
let cur_module () : Tac name = moduleof (top_env ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 25, "end_line": 280, "start_col": 0, "start_line": 279 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.name
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Reflection.V2.Builtins.moduleof", "FStar.Stubs.Reflection.Types.name", "FStar.Stubs.Reflection.Types.env", "FStar.Stubs.Tactics.V2.Builtins.top_env" ]
[]
false
true
false
false
false
let cur_module () : Tac name =
moduleof (top_env ())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.exact_guard
val exact_guard (t: term) : Tac unit
val exact_guard (t: term) : Tac unit
let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 53, "end_line": 223, "start_col": 0, "start_line": 222 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Tactics.V2.Derived.with_policy", "Prims.unit", "FStar.Stubs.Tactics.Types.Goal", "FStar.Stubs.Tactics.V2.Builtins.t_exact" ]
[]
false
true
false
false
false
let exact_guard (t: term) : Tac unit =
with_policy Goal (fun () -> t_exact true false t)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.pointwise
val pointwise (tau: (unit -> Tac unit)) : Tac unit
val pointwise (tau: (unit -> Tac unit)) : Tac unit
let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 77, "end_line": 276, "start_col": 0, "start_line": 276 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
tau: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.t_pointwise", "FStar.Stubs.Tactics.Types.BottomUp" ]
[]
false
true
false
false
false
let pointwise (tau: (unit -> Tac unit)) : Tac unit =
t_pointwise BottomUp tau
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.pointwise'
val pointwise' (tau: (unit -> Tac unit)) : Tac unit
val pointwise' (tau: (unit -> Tac unit)) : Tac unit
let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 77, "end_line": 277, "start_col": 0, "start_line": 277 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
tau: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.t_pointwise", "FStar.Stubs.Tactics.Types.TopDown" ]
[]
false
true
false
false
false
let pointwise' (tau: (unit -> Tac unit)) : Tac unit =
t_pointwise TopDown tau
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_lemma_Alloc_stack
val va_lemma_Alloc_stack : va_b0:va_code -> va_s0:va_state -> n:nat64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Alloc_stack n) va_s0 /\ va_get_ok va_s0 /\ n `op_Modulus` 16 == 0 /\ va_get_reg 1 va_s0 <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 65536 <= va_get_reg 1 va_s0 - n)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 - n /\ va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))))
val va_lemma_Alloc_stack : va_b0:va_code -> va_s0:va_state -> n:nat64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Alloc_stack n) va_s0 /\ va_get_ok va_s0 /\ n `op_Modulus` 16 == 0 /\ va_get_reg 1 va_s0 <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 65536 <= va_get_reg 1 va_s0 - n)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 - n /\ va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))))
let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 34, "start_col": 0, "start_line": 29 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> n: Vale.PPC64LE.Memory.nat64 -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Memory.nat64", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.state", "Prims.nat", "Vale...
[]
false
false
false
false
false
let va_lemma_Alloc_stack va_b0 va_s0 n =
va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.apply_raw
val apply_raw (t: term) : Tac unit
val apply_raw (t: term) : Tac unit
let apply_raw (t : term) : Tac unit = t_apply false false false t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 31, "end_line": 218, "start_col": 0, "start_line": 217 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.t_apply", "Prims.unit" ]
[]
false
true
false
false
false
let apply_raw (t: term) : Tac unit =
t_apply false false false t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.topdown_rewrite
val topdown_rewrite (ctrl: (term -> Tac (bool * int))) (rw: (unit -> Tac unit)) : Tac unit
val topdown_rewrite (ctrl: (term -> Tac (bool * int))) (rw: (unit -> Tac unit)) : Tac unit
let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 33, "end_line": 274, "start_col": 0, "start_line": 261 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal.
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
ctrl: (_: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac (Prims.bool * Prims.int)) -> rw: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Pervasives.Native.tuple2", "Prims.bool", "Prims.int", "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.ctrl_rewrite", "FStar.Stubs.Tactics.Types.TopDown", "FStar.Stubs.Tactics.Types.ctrl_flag", "FStar.Pervasives.Native.Mktuple2", "FStar.Stubs.Tactics.Types.Cont...
[]
false
true
false
false
false
let topdown_rewrite (ctrl: (term -> Tac (bool * int))) (rw: (unit -> Tac unit)) : Tac unit =
let ctrl' (t: term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw
false
CQueue.LList.fst
CQueue.LList.cllist_rewrite
val cllist_rewrite (#a: Type0) (c: cllist_ptrvalue a) (x: dtuple2 (cllist_lvalue a) (vdep_payload ((emp `vrefine` (cllist0_refine c)) `vrewrite` (cllist0_rewrite c)) (cllist0 a))) : GTot (vllist a)
val cllist_rewrite (#a: Type0) (c: cllist_ptrvalue a) (x: dtuple2 (cllist_lvalue a) (vdep_payload ((emp `vrefine` (cllist0_refine c)) `vrewrite` (cllist0_rewrite c)) (cllist0 a))) : GTot (vllist a)
let cllist_rewrite (#a: Type0) (c: cllist_ptrvalue a) (x: dtuple2 (cllist_lvalue a) (vdep_payload (emp `vrefine` cllist0_refine c `vrewrite` cllist0_rewrite c) (cllist0 a))) : GTot (vllist a) = let p = dsnd #(cllist_lvalue a) #(vdep_payload (emp `vrefine` cllist0_refine c `vrewrite` cllist0_rewrite c) (cllist0 a)) x in { vllist_head = fst p; vllist_tail = snd p; }
{ "file_name": "share/steel/examples/steel/CQueue.LList.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 3, "end_line": 53, "start_col": 0, "start_line": 42 }
module CQueue.LList noeq type cllist_ptrvalue (a: Type0) = { head: ref (ccell_ptrvalue a); tail: ref (ref (ccell_ptrvalue a)); all_or_none_null: squash (is_null head == is_null tail); } let cllist_ptrvalue_null a = {head = null; tail = null; all_or_none_null = ()} let cllist_ptrvalue_is_null #a x = is_null x.head let cllist_head #a c = c.head let cllist_tail #a c = c.tail #push-options "--ide_id_info_off" let cllist0_refine (#a: Type0) (c: cllist_ptrvalue a) (_: t_of emp) : Tot prop = cllist_ptrvalue_is_null c == false // unfold let cllist0_rewrite (#a: Type0) (c: cllist_ptrvalue a) (_: t_of (emp `vrefine` cllist0_refine c)) : Tot (cllist_lvalue a) = c [@@ __steel_reduce__] let cllist0 (a: Type0) (c: cllist_lvalue a) : Tot vprop = (vptr (cllist_head c) `star` vptr (cllist_tail c))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "CQueue.LList.fst" }
[ { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "f...
{ "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" }
false
c: CQueue.LList.cllist_ptrvalue a -> x: Prims.dtuple2 (CQueue.LList.cllist_lvalue a) (Steel.Effect.Common.vdep_payload (Steel.Effect.Common.vrewrite (Steel.Effect.Common.vrefine Steel.Effect.Common.emp (CQueue.LList.cllist0_refine c)) (CQueue.LList.cllist0_rewrite c)) (CQueue.LList.cllist0 a)) -> Prims.GTot (CQueue.LList.vllist a)
Prims.GTot
[ "sometrivial" ]
[]
[ "CQueue.LList.cllist_ptrvalue", "Prims.dtuple2", "CQueue.LList.cllist_lvalue", "Steel.Effect.Common.vdep_payload", "Steel.Effect.Common.vrewrite", "Steel.Effect.Common.vrefine", "Steel.Effect.Common.emp", "CQueue.LList.cllist0_refine", "CQueue.LList.cllist0_rewrite", "CQueue.LList.cllist0", "CQu...
[]
false
false
false
false
false
let cllist_rewrite (#a: Type0) (c: cllist_ptrvalue a) (x: dtuple2 (cllist_lvalue a) (vdep_payload ((emp `vrefine` (cllist0_refine c)) `vrewrite` (cllist0_rewrite c)) (cllist0 a))) : GTot (vllist a) =
let p = dsnd #(cllist_lvalue a) #(vdep_payload ((emp `vrefine` (cllist0_refine c)) `vrewrite` (cllist0_rewrite c)) (cllist0 a)) x in { vllist_head = fst p; vllist_tail = snd p }
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.tmatch
val tmatch (t1 t2: term) : Tac bool
val tmatch (t1 t2: term) : Tac bool
let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 21, "end_line": 299, "start_col": 0, "start_line": 297 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t1: FStar.Tactics.NamedView.term -> t2: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.bool
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.match_env", "Prims.bool", "FStar.Stubs.Reflection.Types.env", "FStar.Tactics.V2.Derived.cur_env" ]
[]
false
true
false
false
false
let tmatch (t1 t2: term) : Tac bool =
let e = cur_env () in match_env e t1 t2
false
Spec.Ed25519.fst
Spec.Ed25519.point_mul_double_g
val point_mul_double_g (a1 a2: lbytes 32) (p: ext_point_c) : ext_point_c
val point_mul_double_g (a1 a2: lbytes 32) (p: ext_point_c) : ext_point_c
let point_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = EL.g_is_on_curve (); point_mul_double a1 g a2 p
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 92, "start_col": 0, "start_line": 90 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5 // [a]G let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a1: Lib.ByteSequence.lbytes 32 -> a2: Lib.ByteSequence.lbytes 32 -> p: Spec.Ed25519.ext_point_c -> Spec.Ed25519.ext_point_c
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.Ed25519.ext_point_c", "Spec.Ed25519.point_mul_double", "Spec.Ed25519.PointOps.g", "Prims.unit", "Spec.Ed25519.Lemmas.g_is_on_curve" ]
[]
false
false
false
false
false
let point_mul_double_g (a1 a2: lbytes 32) (p: ext_point_c) : ext_point_c =
EL.g_is_on_curve (); point_mul_double a1 g a2 p
false
Spec.Ed25519.fst
Spec.Ed25519.point_negate_mul_double_g
val point_negate_mul_double_g (a1 a2: lbytes 32) (p: ext_point_c) : ext_point_c
val point_negate_mul_double_g (a1 a2: lbytes 32) (p: ext_point_c) : ext_point_c
let point_negate_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = let p1 = point_negate p in EL.to_aff_point_negate p; point_mul_double_g a1 a2 p1
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 98, "start_col": 0, "start_line": 95 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5 // [a]G let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g // [a1]G + [a2]P let point_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = EL.g_is_on_curve (); point_mul_double a1 g a2 p
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a1: Lib.ByteSequence.lbytes 32 -> a2: Lib.ByteSequence.lbytes 32 -> p: Spec.Ed25519.ext_point_c -> Spec.Ed25519.ext_point_c
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.Ed25519.ext_point_c", "Spec.Ed25519.point_mul_double_g", "Prims.unit", "Spec.Ed25519.Lemmas.to_aff_point_negate", "Spec.Ed25519.PointOps.ext_point", "Spec.Ed25519.PointOps.point_negate" ]
[]
false
false
false
false
false
let point_negate_mul_double_g (a1 a2: lbytes 32) (p: ext_point_c) : ext_point_c =
let p1 = point_negate p in EL.to_aff_point_negate p; point_mul_double_g a1 a2 p1
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.dump1
val dump1 : m: Prims.string -> FStar.Tactics.Effect.Tac Prims.unit
let dump1 (m : string) = focus (fun () -> dump m)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 49, "end_line": 339, "start_col": 0, "start_line": 339 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
m: Prims.string -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.string", "FStar.Tactics.V2.Derived.focus", "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.dump" ]
[]
false
true
false
false
false
let dump1 (m: string) =
focus (fun () -> dump m)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.fresh_uvar
val fresh_uvar (o: option typ) : Tac term
val fresh_uvar (o: option typ) : Tac term
let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 287, "start_col": 0, "start_line": 285 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
o: FStar.Pervasives.Native.option FStar.Stubs.Reflection.Types.typ -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Pervasives.Native.option", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Tactics.V2.Builtins.uvar_env", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.Types.env", "FStar.Tactics.V2.Derived.cur_env", "FStar.Tactics.NamedView.term" ]
[]
false
true
false
false
false
let fresh_uvar (o: option typ) : Tac term =
let e = cur_env () in uvar_env e o
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.unify_guard
val unify_guard (t1 t2: term) : Tac bool
val unify_guard (t1 t2: term) : Tac bool
let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 27, "end_line": 295, "start_col": 0, "start_line": 293 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t1: FStar.Tactics.NamedView.term -> t2: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.bool
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.unify_guard_env", "Prims.bool", "FStar.Stubs.Reflection.Types.env", "FStar.Tactics.V2.Derived.cur_env" ]
[]
false
true
false
false
false
let unify_guard (t1 t2: term) : Tac bool =
let e = cur_env () in unify_guard_env e t1 t2
false
Spec.Ed25519.fst
Spec.Ed25519.point_mul
val point_mul (a: lbytes 32) (p: ext_point_c) : ext_point_c
val point_mul (a: lbytes 32) (p: ext_point_c) : ext_point_c
let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 78, "start_col": 0, "start_line": 77 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; }
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.ByteSequence.lbytes 32 -> p: Spec.Ed25519.ext_point_c -> Spec.Ed25519.ext_point_c
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.Ed25519.ext_point_c", "Spec.Exponentiation.exp_fw", "Spec.Ed25519.mk_ed25519_concrete_ops", "Lib.ByteSequence.nat_from_bytes_le", "Lib.IntTypes.SEC" ]
[]
false
false
false
false
false
let point_mul (a: lbytes 32) (p: ext_point_c) : ext_point_c =
SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.open_modules
val open_modules: Prims.unit -> Tac (list name)
val open_modules: Prims.unit -> Tac (list name)
let open_modules () : Tac (list name) = env_open_modules (top_env ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 33, "end_line": 283, "start_col": 0, "start_line": 282 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Stubs.Reflection.Types.name)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Reflection.V2.Builtins.env_open_modules", "Prims.list", "FStar.Stubs.Reflection.Types.name", "FStar.Stubs.Reflection.Types.env", "FStar.Stubs.Tactics.V2.Builtins.top_env" ]
[]
false
true
false
false
false
let open_modules () : Tac (list name) =
env_open_modules (top_env ())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.unify
val unify (t1 t2: term) : Tac bool
val unify (t1 t2: term) : Tac bool
let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 21, "end_line": 291, "start_col": 0, "start_line": 289 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t1: FStar.Tactics.NamedView.term -> t2: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.bool
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.unify_env", "Prims.bool", "FStar.Stubs.Reflection.Types.env", "FStar.Tactics.V2.Derived.cur_env" ]
[]
false
true
false
false
false
let unify (t1 t2: term) : Tac bool =
let e = cur_env () in unify_env e t1 t2
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived._cur_goal
val _cur_goal: Prims.unit -> Tac goal
val _cur_goal: Prims.unit -> Tac goal
let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 75, "start_col": 0, "start_line": 72 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Stubs.Tactics.Types.goal
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.fail", "FStar.Stubs.Tactics.Types.goal", "Prims.list", "FStar.Tactics.V2.Derived.goals" ]
[]
false
true
false
false
false
let _cur_goal () : Tac goal =
match goals () with | [] -> fail "no more goals" | g :: _ -> g
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.exact_n
val exact_n (n: int) (t: term) : Tac unit
val exact_n (n: int) (t: term) : Tac unit
let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 51, "end_line": 379, "start_col": 0, "start_line": 378 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
n: Prims.int -> t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.int", "FStar.Tactics.NamedView.term", "FStar.Tactics.V2.Derived.exact_args", "Prims.unit", "Prims.list", "FStar.Stubs.Reflection.V2.Data.aqualv", "FStar.Tactics.Util.repeatn", "FStar.Stubs.Reflection.V2.Data.Q_Explicit", "Prims.l_or", "Prims.b2t", "Prims.op_LessThan", "Prims.eq2", "FS...
[]
false
true
false
false
false
let exact_n (n: int) (t: term) : Tac unit =
exact_args (repeatn n (fun () -> Q_Explicit)) t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.seq
val seq (f g: (unit -> Tac unit)) : Tac unit
val seq (f g: (unit -> Tac unit)) : Tac unit
let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 37, "end_line": 365, "start_col": 0, "start_line": 364 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
f: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> g: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.focus", "FStar.Tactics.V2.Derived.iterAll" ]
[]
false
true
false
false
false
let seq (f g: (unit -> Tac unit)) : Tac unit =
focus (fun () -> f (); iterAll g)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.exact_args
val exact_args (qs: list aqualv) (t: term) : Tac unit
val exact_args (qs: list aqualv) (t: term) : Tac unit
let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) )
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 376, "start_col": 0, "start_line": 367 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
qs: Prims.list FStar.Stubs.Reflection.V2.Data.aqualv -> t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.list", "FStar.Stubs.Reflection.V2.Data.aqualv", "FStar.Tactics.NamedView.term", "FStar.Tactics.V2.Derived.focus", "Prims.unit", "FStar.Tactics.Util.iter", "FStar.Stubs.Reflection.Types.term", "FStar.Reflection.V2.Derived.is_uvar", "FStar.Stubs.Tactics.V2.Builtins.unshelve", "Prims.bool", ...
[]
false
true
false
false
false
let exact_args (qs: list aqualv) (t: term) : Tac unit =
focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv) (L.rev uvs))
false
Spec.Ed25519.fst
Spec.Ed25519.point_mul_double
val point_mul_double (a1: lbytes 32) (p1: ext_point_c) (a2: lbytes 32) (p2: ext_point_c) : ext_point_c
val point_mul_double (a1: lbytes 32) (p1: ext_point_c) (a2: lbytes 32) (p2: ext_point_c) : ext_point_c
let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 100, "end_line": 82, "start_col": 0, "start_line": 81 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a1: Lib.ByteSequence.lbytes 32 -> p1: Spec.Ed25519.ext_point_c -> a2: Lib.ByteSequence.lbytes 32 -> p2: Spec.Ed25519.ext_point_c -> Spec.Ed25519.ext_point_c
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.Ed25519.ext_point_c", "Spec.Exponentiation.exp_double_fw", "Spec.Ed25519.mk_ed25519_concrete_ops", "Lib.ByteSequence.nat_from_bytes_le", "Lib.IntTypes.SEC" ]
[]
false
false
false
false
false
let point_mul_double (a1: lbytes 32) (p1: ext_point_c) (a2: lbytes 32) (p2: ext_point_c) : ext_point_c =
SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5
false
Spec.Ed25519.fst
Spec.Ed25519.sign
val sign: secret:lbytes 32 -> msg:bytes{length msg <= max_size_t} -> lbytes 64
val sign: secret:lbytes 32 -> msg:bytes{length msg <= max_size_t} -> lbytes 64
let sign secret msg = let pub, s, prefix = expand_keys secret in sign_expanded pub s prefix msg
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 136, "start_col": 0, "start_line": 134 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5 // [a]G let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g // [a1]G + [a2]P let point_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = EL.g_is_on_curve (); point_mul_double a1 g a2 p // [a1]G - [a2]P let point_negate_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = let p1 = point_negate p in EL.to_aff_point_negate p; point_mul_double_g a1 a2 p1 /// Ed25519 API let secret_expand (secret:lbytes 32) : (lbytes 32 & lbytes 32) = let h = Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 secret in let h_low : lbytes 32 = slice h 0 32 in let h_high : lbytes 32 = slice h 32 64 in let h_low = h_low.[ 0] <- h_low.[0] &. u8 0xf8 in let h_low = h_low.[31] <- (h_low.[31] &. u8 127) |. u8 64 in h_low, h_high let secret_to_public (secret:lbytes 32) : lbytes 32 = let a, dummy = secret_expand secret in point_compress (point_mul_g a) let expand_keys (secret:lbytes 32) : (lbytes 32 & lbytes 32 & lbytes 32) = let s, prefix = secret_expand secret in let pub = point_compress (point_mul_g s) in pub, s, prefix val sign_expanded (pub s prefix:lbytes 32) (msg:bytes{length msg <= max_size_t}) : lbytes 64 let sign_expanded pub s prefix msg = let len = length msg in let r = sha512_modq (32 + len) (Seq.append prefix msg) in let r' = point_mul_g (nat_to_bytes_le 32 r) in let rs = point_compress r' in let h = sha512_modq (64 + len) (Seq.append (concat rs pub) msg) in let s = (r + (h * nat_from_bytes_le s) % q) % q in concat #_ #32 #32 rs (nat_to_bytes_le 32 s)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
secret: Lib.ByteSequence.lbytes 32 -> msg: Lib.ByteSequence.bytes{Lib.Sequence.length msg <= Lib.IntTypes.max_size_t} -> Lib.ByteSequence.lbytes 64
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.max_size_t", "Spec.Ed25519.sign_expanded", "FStar.Pervasives.Native.tuple3", "Lib.Sequence.lseq", "...
[]
false
false
false
false
false
let sign secret msg =
let pub, s, prefix = expand_keys secret in sign_expanded pub s prefix msg
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.ngoals
val ngoals: Prims.unit -> Tac int
val ngoals: Prims.unit -> Tac int
let ngoals () : Tac int = List.Tot.Base.length (goals ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 57, "end_line": 382, "start_col": 0, "start_line": 382 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.int
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.List.Tot.Base.length", "FStar.Stubs.Tactics.Types.goal", "Prims.int", "Prims.list", "FStar.Tactics.V2.Derived.goals" ]
[]
false
true
false
false
false
let ngoals () : Tac int =
List.Tot.Base.length (goals ())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.dismiss
val dismiss: Prims.unit -> Tac unit
val dismiss: Prims.unit -> Tac unit
let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 27, "end_line": 135, "start_col": 0, "start_line": 132 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.fail", "FStar.Stubs.Tactics.Types.goal", "Prims.list", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "FStar.Tactics.V2.Derived.goals" ]
[]
false
true
false
false
false
let dismiss () : Tac unit =
match goals () with | [] -> fail "dismiss: no more goals" | _ :: gs -> set_goals gs
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_lemma_Store_stack64
val va_lemma_Store_stack64 : va_b0:va_code -> va_s0:va_state -> src:va_operand_reg_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_stack64 src offset) va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ va_get_reg 1 va_s0 + offset <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 8)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_stack va_sM == Vale.PPC64LE.Stack_i.store_stack64 (va_get_reg 1 va_sM + offset) (va_eval_reg_opr va_s0 src) (va_get_stack va_s0) /\ va_get_stackTaint va_sM == Vale.PPC64LE.Stack_i.store_taint_stack64 (va_get_reg 1 va_sM + offset) Secret (va_get_stackTaint va_s0) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))))
val va_lemma_Store_stack64 : va_b0:va_code -> va_s0:va_state -> src:va_operand_reg_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_stack64 src offset) va_s0 /\ va_is_src_reg_opr src va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ va_get_reg 1 va_s0 + offset <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) - 8)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_get_stack va_sM == Vale.PPC64LE.Stack_i.store_stack64 (va_get_reg 1 va_sM + offset) (va_eval_reg_opr va_s0 src) (va_get_stack va_s0) /\ va_get_stackTaint va_sM == Vale.PPC64LE.Stack_i.store_taint_stack64 (va_get_reg 1 va_sM + offset) Secret (va_get_stackTaint va_s0) /\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))))
let va_lemma_Store_stack64 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack64) (va_code_Store_stack64 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack64 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack64 src Secret offset)) va_s0 in (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 155, "start_col": 0, "start_line": 150 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack128 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack128 (va_code_Store_stack128 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack128 [@ "opaque_to_smt"] let va_code_Load_stack128 dst offset = (Ins (S.LoadStack128 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack128 dst offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Load_stack128 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_stack128 dst offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_stack128 (va_code_Load_stack128 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack64 [@ "opaque_to_smt"] let va_code_Store_stack64 src offset = (Ins (S.StoreStack64 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack64 src offset = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> src: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Machine_s.sta...
[]
false
false
false
false
false
let va_lemma_Store_stack64 va_b0 va_s0 src offset =
va_reveal_opaque (`%va_code_Store_stack64) (va_code_Store_stack64 src offset); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.StoreStack64 src Secret offset)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.StoreStack64 src Secret offset)) va_s0 in (va_sM, va_fM)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.iterAllSMT
val iterAllSMT (t: (unit -> Tac unit)) : Tac unit
val iterAllSMT (t: (unit -> Tac unit)) : Tac unit
let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs')
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 359, "start_col": 0, "start_line": 352 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Stubs.Tactics.Types.goal", "FStar.Stubs.Tactics.V2.Builtins.set_smt_goals", "FStar.Tactics.V2.Derived.op_At", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.Mktuple2", "FStar.Tactics.V2.Derived.smt_goals", ...
[]
false
true
false
false
false
let iterAllSMT (t: (unit -> Tac unit)) : Tac unit =
let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs' @ sgs')
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.trytac
val trytac (t: (unit -> Tac 'a)) : Tac (option 'a)
val trytac (t: (unit -> Tac 'a)) : Tac (option 'a)
let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 15, "end_line": 454, "start_col": 0, "start_line": 451 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: (_: Prims.unit -> FStar.Tactics.Effect.Tac 'a) -> FStar.Tactics.Effect.Tac (FStar.Pervasives.Native.option 'a)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.try_with", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.Some", "Prims.exn", "FStar.Pervasives.Native.None" ]
[]
false
true
false
false
false
let trytac (t: (unit -> Tac 'a)) : Tac (option 'a) =
try Some (t ()) with | _ -> None
false
Spec.Ed25519.fst
Spec.Ed25519.secret_to_public
val secret_to_public (secret: lbytes 32) : lbytes 32
val secret_to_public (secret: lbytes 32) : lbytes 32
let secret_to_public (secret:lbytes 32) : lbytes 32 = let a, dummy = secret_expand secret in point_compress (point_mul_g a)
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 113, "start_col": 0, "start_line": 111 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5 // [a]G let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g // [a1]G + [a2]P let point_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = EL.g_is_on_curve (); point_mul_double a1 g a2 p // [a1]G - [a2]P let point_negate_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = let p1 = point_negate p in EL.to_aff_point_negate p; point_mul_double_g a1 a2 p1 /// Ed25519 API let secret_expand (secret:lbytes 32) : (lbytes 32 & lbytes 32) = let h = Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 secret in let h_low : lbytes 32 = slice h 0 32 in let h_high : lbytes 32 = slice h 32 64 in let h_low = h_low.[ 0] <- h_low.[0] &. u8 0xf8 in let h_low = h_low.[31] <- (h_low.[31] &. u8 127) |. u8 64 in h_low, h_high
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
secret: Lib.ByteSequence.lbytes 32 -> Lib.ByteSequence.lbytes 32
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.Ed25519.PointOps.point_compress", "Spec.Ed25519.point_mul_g", "FStar.Pervasives.Native.tuple2", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Ed25519.secret_expand" ]
[]
false
false
false
false
false
let secret_to_public (secret: lbytes 32) : lbytes 32 =
let a, dummy = secret_expand secret in point_compress (point_mul_g a)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.cur_goal_safe
val cur_goal_safe: Prims.unit -> TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0))
val cur_goal_safe: Prims.unit -> TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0))
let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 92, "start_col": 0, "start_line": 89 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.TacH FStar.Stubs.Tactics.Types.goal
FStar.Tactics.Effect.TacH
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.goal", "Prims.list", "FStar.Stubs.Tactics.Types.goals_of", "FStar.Stubs.Tactics.Types.proofstate", "FStar.Tactics.Effect.get", "Prims.l_not", "Prims.eq2", "Prims.Nil", "FStar.Stubs.Tactics.Result.__result", "Prims.l_Exists", "FStar.Stubs.Tactics.Result....
[]
false
true
false
false
false
let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) =
match goals_of (get ()) with | g :: _ -> g
false
Spec.Ed25519.fst
Spec.Ed25519.expand_keys
val expand_keys (secret: lbytes 32) : (lbytes 32 & lbytes 32 & lbytes 32)
val expand_keys (secret: lbytes 32) : (lbytes 32 & lbytes 32 & lbytes 32)
let expand_keys (secret:lbytes 32) : (lbytes 32 & lbytes 32 & lbytes 32) = let s, prefix = secret_expand secret in let pub = point_compress (point_mul_g s) in pub, s, prefix
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 119, "start_col": 0, "start_line": 116 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5 // [a]G let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g // [a1]G + [a2]P let point_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = EL.g_is_on_curve (); point_mul_double a1 g a2 p // [a1]G - [a2]P let point_negate_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = let p1 = point_negate p in EL.to_aff_point_negate p; point_mul_double_g a1 a2 p1 /// Ed25519 API let secret_expand (secret:lbytes 32) : (lbytes 32 & lbytes 32) = let h = Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 secret in let h_low : lbytes 32 = slice h 0 32 in let h_high : lbytes 32 = slice h 32 64 in let h_low = h_low.[ 0] <- h_low.[0] &. u8 0xf8 in let h_low = h_low.[31] <- (h_low.[31] &. u8 127) |. u8 64 in h_low, h_high let secret_to_public (secret:lbytes 32) : lbytes 32 = let a, dummy = secret_expand secret in point_compress (point_mul_g a)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
secret: Lib.ByteSequence.lbytes 32 -> (Lib.ByteSequence.lbytes 32 * Lib.ByteSequence.lbytes 32) * Lib.ByteSequence.lbytes 32
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "FStar.Pervasives.Native.Mktuple3", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Ed25519.PointOps.point_compress", "Spec.Ed25519.point_mul_g", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Spec.Ed25519.s...
[]
false
false
false
false
false
let expand_keys (secret: lbytes 32) : (lbytes 32 & lbytes 32 & lbytes 32) =
let s, prefix = secret_expand secret in let pub = point_compress (point_mul_g s) in pub, s, prefix
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.discard
val discard: tau: (unit -> Tac 'a) -> unit -> Tac unit
val discard: tau: (unit -> Tac 'a) -> unit -> Tac unit
let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 34, "end_line": 500, "start_col": 0, "start_line": 499 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs'
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
tau: (_: Prims.unit -> FStar.Tactics.Effect.Tac 'a) -> _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit" ]
[]
false
true
false
false
false
let discard (tau: (unit -> Tac 'a)) : unit -> Tac unit =
fun () -> let _ = tau () in ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.norm_term
val norm_term (s: list norm_step) (t: term) : Tac term
val norm_term (s: list norm_step) (t: term) : Tac term
let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 23, "end_line": 484, "start_col": 0, "start_line": 479 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
s: Prims.list FStar.Pervasives.norm_step -> t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.list", "FStar.Pervasives.norm_step", "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.norm_term_env", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.Types.env", "FStar.Tactics.V2.Derived.try_with", "Prims.unit", "FStar.Tactics.V2.Derived.cur_env", "Prims.exn", ...
[]
false
true
false
false
false
let norm_term (s: list norm_step) (t: term) : Tac term =
let e = try cur_env () with | _ -> top_env () in norm_term_env e s t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.fail_silently
val fail_silently (#a: Type) (m: string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps))
val fail_silently (#a: Type) (m: string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps))
let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 69, "start_col": 0, "start_line": 66 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
m: Prims.string -> FStar.Tactics.Effect.TAC a
FStar.Tactics.Effect.TAC
[]
[]
[ "Prims.string", "FStar.Tactics.Effect.raise", "FStar.Stubs.Tactics.Common.TacticFailure", "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.set_urgency", "FStar.Stubs.Tactics.Types.proofstate", "FStar.Stubs.Tactics.Result.__result", "Prims.l_Forall", "FStar.Stubs.Tactics.Result.Failed", "Prims.logica...
[]
false
true
false
false
false
let fail_silently (#a: Type) (m: string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) =
set_urgency 0; raise #a (TacticFailure m)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.repeatseq
val repeatseq (#a: Type) (t: (unit -> Tac a)) : Tac unit
val repeatseq (#a: Type) (t: (unit -> Tac a)) : Tac unit
let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 88, "end_line": 504, "start_col": 0, "start_line": 503 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: (_: Prims.unit -> FStar.Tactics.Effect.Tac a) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Pervasives.Native.option", "FStar.Tactics.V2.Derived.trytac", "FStar.Tactics.V2.Derived.seq", "FStar.Tactics.V2.Derived.discard", "FStar.Tactics.V2.Derived.repeatseq" ]
[ "recursion" ]
false
true
false
false
false
let rec repeatseq (#a: Type) (t: (unit -> Tac a)) : Tac unit =
let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.ngoals_smt
val ngoals_smt: Prims.unit -> Tac int
val ngoals_smt: Prims.unit -> Tac int
let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 65, "end_line": 385, "start_col": 0, "start_line": 385 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.int
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.List.Tot.Base.length", "FStar.Stubs.Tactics.Types.goal", "Prims.int", "Prims.list", "FStar.Tactics.V2.Derived.smt_goals" ]
[]
false
true
false
false
false
let ngoals_smt () : Tac int =
List.Tot.Base.length (smt_goals ())
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_lemma_Load_stack128
val va_lemma_Load_stack128 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_stack128 dst offset) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset128 offset /\ va_get_reg 1 va_s0 + offset + 16 <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_src_stack128 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_taint_stack128 (va_get_reg 1 va_s0 + offset) Secret (va_get_stackTaint va_s0))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.PPC64LE.Stack_i.load_stack128 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))))
val va_lemma_Load_stack128 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_stack128 dst offset) va_s0 /\ va_is_dst_vec_opr dst va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset128 offset /\ va_get_reg 1 va_s0 + offset + 16 <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_src_stack128 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_taint_stack128 (va_get_reg 1 va_s0 + offset) Secret (va_get_stackTaint va_s0))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_vec_opr va_sM dst == Vale.PPC64LE.Stack_i.load_stack128 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))))
let va_lemma_Load_stack128 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 126, "start_col": 0, "start_line": 119 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack128 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack128 (va_code_Store_stack128 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack128 [@ "opaque_to_smt"] let va_code_Load_stack128 dst offset = (Ins (S.LoadStack128 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack128 dst offset = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> dst: Vale.PPC64LE.Decls.va_operand_vec_opr -> offset: Prims.int -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_operand_vec_opr", "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Prims.unit", "Vale.PPC64LE.Stack_i.lemma_valid_taint_stack12...
[]
false
false
false
false
false
let va_lemma_Load_stack128 va_b0 va_s0 dst offset =
va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM)
false
Vale.PPC64LE.InsStack.fst
Vale.PPC64LE.InsStack.va_lemma_Load_stack64
val va_lemma_Load_stack64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_stack64 dst offset) va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ va_get_reg 1 va_s0 + offset + 8 <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_src_stack64 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_taint_stack64 (va_get_reg 1 va_s0 + offset) Secret (va_get_stackTaint va_s0))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Stack_i.load_stack64 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))))
val va_lemma_Load_stack64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr -> offset:int -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Load_stack64 dst offset) va_s0 /\ va_is_dst_reg_opr dst va_s0 /\ va_get_ok va_s0 /\ Vale.PPC64LE.Machine_s.valid_maddr_offset64 offset /\ va_get_reg 1 va_s0 + offset + 8 <= Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_src_stack64 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ Vale.PPC64LE.Stack_i.valid_taint_stack64 (va_get_reg 1 va_s0 + offset) Secret (va_get_stackTaint va_s0))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ va_eval_reg_opr va_sM dst == Vale.PPC64LE.Stack_i.load_stack64 (va_get_reg 1 va_s0 + offset) (va_get_stack va_s0) /\ va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0))))
let va_lemma_Load_stack64 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack64) (va_code_Load_stack64 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack64 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack64 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack64 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM)
{ "file_name": "obj/Vale.PPC64LE.InsStack.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 187, "start_col": 0, "start_line": 180 }
module Vale.PPC64LE.InsStack open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.Stack_i open Vale.PPC64LE.State open Vale.PPC64LE.StateLemmas open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsVector open Vale.PPC64LE.Stack_Sems module S = Vale.PPC64LE.Semantics_s module P = Vale.PPC64LE.Print_s friend Vale.PPC64LE.Decls friend Vale.PPC64LE.Stack_i friend Vale.PPC64LE.Stack_Sems #reset-options "--initial_fuel 2 --max_fuel 4 --max_ifuel 2 --z3rlimit 200" //-- Alloc_stack [@ "opaque_to_smt"] let va_code_Alloc_stack n = (Ins (S.Alloc n)) [@ "opaque_to_smt"] let va_codegen_success_Alloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Alloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Alloc_stack) (va_code_Alloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Alloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Alloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Alloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Alloc_stack (va_code_Alloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Dealloc_stack [@ "opaque_to_smt"] let va_code_Dealloc_stack n = (Ins (S.Dealloc n)) [@ "opaque_to_smt"] let va_codegen_success_Dealloc_stack n = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Dealloc_stack va_b0 va_s0 n = va_reveal_opaque (`%va_code_Dealloc_stack) (va_code_Dealloc_stack n); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.Dealloc n)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.Dealloc n)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Dealloc_stack n va_s0 va_k = let (va_sM, va_f0) = va_lemma_Dealloc_stack (va_code_Dealloc_stack n) va_s0 n in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg 1 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg 1]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack128 [@ "opaque_to_smt"] let va_code_Store_stack128 src offset = (Ins (S.StoreStack128 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack128 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack128 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack128) (va_code_Store_stack128 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack128 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack128 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack128 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack128 (va_code_Store_stack128 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack128 [@ "opaque_to_smt"] let va_code_Load_stack128 dst offset = (Ins (S.LoadStack128 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack128 dst offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Load_stack128 va_b0 va_s0 dst offset = va_reveal_opaque (`%va_code_Load_stack128) (va_code_Load_stack128 dst offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.LoadStack128 dst Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.LoadStack128 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack128 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Load_stack128 dst offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Load_stack128 (va_code_Load_stack128 dst offset) va_s0 dst offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0))); va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Store_stack64 [@ "opaque_to_smt"] let va_code_Store_stack64 src offset = (Ins (S.StoreStack64 src Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Store_stack64 src offset = (va_ttrue ()) [@"opaque_to_smt"] let va_lemma_Store_stack64 va_b0 va_s0 src offset = va_reveal_opaque (`%va_code_Store_stack64) (va_code_Store_stack64 src offset); let (va_old_s:va_state) = va_s0 in va_ins_lemma (Ins (S.StoreStack64 src Secret offset)) va_s0; let (va_sM, va_fM) = va_eval_ins (Ins (S.StoreStack64 src Secret offset)) va_s0 in (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Store_stack64 src offset va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_stack64 (va_code_Store_stack64 src offset) va_s0 src offset in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Load_stack64 [@ "opaque_to_smt"] let va_code_Load_stack64 dst offset = (Ins (S.LoadStack64 dst Secret offset)) [@ "opaque_to_smt"] let va_codegen_success_Load_stack64 dst offset = (va_ttrue ())
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.StateLemmas.fsti.checked", "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_Sems.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Stack_i.fst.checked", "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Print_s.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fst.checked", "Vale.PPC64LE.Decls.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.PPC64LE.InsStack.fst" }
[ { "abbrev": true, "full_module": "Vale.PPC64LE.Print_s", "short_module": "P" }, { "abbrev": true, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": "S" }, { "abbrev": false, "full_module": "Vale.PPC64LE.Stack_Sems", "short_module": null }, { "abbrev": fal...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 4, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.PPC64LE.Decls.va_code -> va_s0: Vale.PPC64LE.Decls.va_state -> dst: Vale.PPC64LE.Decls.va_operand_reg_opr -> offset: Prims.int -> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_operand_reg_opr", "Prims.int", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Lemmas.fuel", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Prims.unit", "Vale.PPC64LE.Stack_i.lemma_valid_taint_stack64...
[]
false
false
false
false
false
let va_lemma_Load_stack64 va_b0 va_s0 dst offset =
va_reveal_opaque (`%va_code_Load_stack64) (va_code_Load_stack64 dst offset); let va_old_s:va_state = va_s0 in va_ins_lemma (Ins (S.LoadStack64 dst Secret offset)) va_s0; let va_sM, va_fM = va_eval_ins (Ins (S.LoadStack64 dst Secret offset)) va_s0 in Vale.PPC64LE.Stack_i.lemma_valid_taint_stack64 (va_get_reg 1 va_old_s + offset) Secret (va_get_stackTaint va_old_s); (va_sM, va_fM)
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.or_else
val or_else (#a: Type) (t1 t2: (unit -> Tac a)) : Tac a
val or_else (#a: Type) (t1 t2: (unit -> Tac a)) : Tac a
let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 21, "end_line": 458, "start_col": 0, "start_line": 456 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t1: (_: Prims.unit -> FStar.Tactics.Effect.Tac a) -> t2: (_: Prims.unit -> FStar.Tactics.Effect.Tac a) -> FStar.Tactics.Effect.Tac a
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.try_with", "Prims.exn" ]
[]
false
true
false
false
false
let or_else (#a: Type) (t1 t2: (unit -> Tac a)) : Tac a =
try t1 () with | _ -> t2 ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.smt
val smt: Prims.unit -> Tac unit
val smt: Prims.unit -> Tac unit
let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 11, "end_line": 167, "start_col": 0, "start_line": 160 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Stubs.Tactics.Types.goal", "FStar.Tactics.V2.Derived.fail", "FStar.Stubs.Tactics.V2.Builtins.set_smt_goals", "Prims.Cons", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.Mktuple2", "FStar.Tactics.V2.Derived...
[]
false
true
false
false
false
let smt () : Tac unit =
match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g :: gs, gs' -> set_goals gs; set_smt_goals (g :: gs')
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.first
val first (ts: list (unit -> Tac 'a)) : Tac 'a
val first (ts: list (unit -> Tac 'a)) : Tac 'a
let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 65, "end_line": 466, "start_col": 0, "start_line": 465 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
ts: Prims.list (_: Prims.unit -> FStar.Tactics.Effect.Tac 'a) -> FStar.Tactics.Effect.Tac 'a
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.list", "Prims.unit", "FStar.List.Tot.Base.fold_right", "FStar.Tactics.V2.Derived.op_Less_Bar_Greater", "FStar.Tactics.V2.Derived.fail" ]
[]
false
true
false
false
false
let first (ts: list (unit -> Tac 'a)) : Tac 'a =
L.fold_right ( <|> ) ts (fun () -> fail "no tactics to try") ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.admit_all
val admit_all: Prims.unit -> Tac unit
val admit_all: Prims.unit -> Tac unit
let admit_all () : Tac unit = let _ = repeat tadmit in ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 513, "start_col": 0, "start_line": 511 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Tactics.V2.Derived.repeat", "FStar.Tactics.V2.Derived.tadmit" ]
[]
false
true
false
false
false
let admit_all () : Tac unit =
let _ = repeat tadmit in ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.repeat'
val repeat' (f: (unit -> Tac 'a)) : Tac unit
val repeat' (f: (unit -> Tac 'a)) : Tac unit
let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 477, "start_col": 0, "start_line": 476 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
f: (_: Prims.unit -> FStar.Tactics.Effect.Tac 'a) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Tactics.V2.Derived.repeat" ]
[]
false
true
false
false
false
let repeat' (f: (unit -> Tac 'a)) : Tac unit =
let _ = repeat f in ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.join_all_smt_goals
val join_all_smt_goals : _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs'
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 497, "start_col": 0, "start_line": 490 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Stubs.Tactics.Types.goal", "FStar.Stubs.Tactics.V2.Builtins.set_smt_goals", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "FStar.Tactics.V2.Derived.goals", "FStar.Tactics.V2.Derived.repeat'", "FStar.Stubs.Tactics.V2.Builtins.join", "Prims.Nil", "FStar.Pervasives.N...
[]
false
true
false
false
false
let join_all_smt_goals () =
let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in set_goals gs; set_smt_goals sgs'
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.skip_guard
val skip_guard: Prims.unit -> Tac unit
val skip_guard: Prims.unit -> Tac unit
let skip_guard () : Tac unit = if is_guard () then smt () else fail ""
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 522, "start_col": 0, "start_line": 519 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in () (** [is_guard] returns whether the current goal arose from a typechecking guard *) let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ())
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.smt", "Prims.bool", "FStar.Tactics.V2.Derived.fail", "FStar.Tactics.V2.Derived.is_guard" ]
[]
false
true
false
false
false
let skip_guard () : Tac unit =
if is_guard () then smt () else fail ""
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.tadmit
val tadmit : _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
let tadmit () = tadmit_t (`())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 506, "start_col": 0, "start_line": 506 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.tadmit_t" ]
[]
false
true
false
false
false
let tadmit () =
tadmit_t (`())
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.simpl
val simpl: Prims.unit -> Tac unit
val simpl: Prims.unit -> Tac unit
let simpl () : Tac unit = norm [simplify; primops]
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 52, "end_line": 528, "start_col": 0, "start_line": 528 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in () (** [is_guard] returns whether the current goal arose from a typechecking guard *) let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ()) let skip_guard () : Tac unit = if is_guard () then smt () else fail "" let guards_to_smt () : Tac unit = let _ = repeat skip_guard in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.simplify", "FStar.Pervasives.primops", "Prims.Nil" ]
[]
false
true
false
false
false
let simpl () : Tac unit =
norm [simplify; primops]
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.repeat1
val repeat1 (#a: Type) (t: (unit -> Tac a)) : Tac (list a)
val repeat1 (#a: Type) (t: (unit -> Tac a)) : Tac (list a)
let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 474, "start_col": 0, "start_line": 473 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
t: (_: Prims.unit -> FStar.Tactics.Effect.Tac a) -> FStar.Tactics.Effect.Tac (Prims.list a)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.Cons", "Prims.list", "FStar.Tactics.V2.Derived.repeat" ]
[]
false
true
false
false
false
let repeat1 (#a: Type) (t: (unit -> Tac a)) : Tac (list a) =
t () :: repeat t
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.guards_to_smt
val guards_to_smt: Prims.unit -> Tac unit
val guards_to_smt: Prims.unit -> Tac unit
let guards_to_smt () : Tac unit = let _ = repeat skip_guard in ()
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 526, "start_col": 0, "start_line": 524 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in () (** [is_guard] returns whether the current goal arose from a typechecking guard *) let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ()) let skip_guard () : Tac unit = if is_guard () then smt () else fail ""
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.list", "FStar.Tactics.V2.Derived.repeat", "FStar.Tactics.V2.Derived.skip_guard" ]
[]
false
true
false
false
false
let guards_to_smt () : Tac unit =
let _ = repeat skip_guard in ()
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.pose_as
val pose_as (s: string) (t: term) : Tac binding
val pose_as (s: string) (t: term) : Tac binding
let pose_as (s:string) (t:term) : Tac binding = let b = pose t in rename_to b s
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 17, "end_line": 559, "start_col": 0, "start_line": 557 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in () (** [is_guard] returns whether the current goal arose from a typechecking guard *) let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ()) let skip_guard () : Tac unit = if is_guard () then smt () else fail "" let guards_to_smt () : Tac unit = let _ = repeat skip_guard in () let simpl () : Tac unit = norm [simplify; primops] let whnf () : Tac unit = norm [weak; hnf; primops; delta] let compute () : Tac unit = norm [primops; iota; delta; zeta] let intros () : Tac (list binding) = repeat intro let intros' () : Tac unit = let _ = intros () in () let destruct tm : Tac unit = let _ = t_destruct tm in () let destruct_intros tm : Tac unit = seq (fun () -> let _ = t_destruct tm in ()) intros' private val __cut : (a:Type) -> (b:Type) -> (a -> b) -> a -> b private let __cut a b f x = f x let tcut (t:term) : Tac binding = let g = cur_goal () in let tt = mk_e_app (`__cut) [t; g] in apply tt; intro () let pose (t:term) : Tac binding = apply (`__cut); flip (); exact t; intro () let intro_as (s:string) : Tac binding = let b = intro () in rename_to b s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
s: Prims.string -> t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.binding
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.string", "FStar.Tactics.NamedView.term", "FStar.Stubs.Tactics.V2.Builtins.rename_to", "FStar.Stubs.Reflection.V2.Data.binding", "FStar.Tactics.NamedView.binding", "FStar.Tactics.V2.Derived.pose" ]
[]
false
true
false
false
false
let pose_as (s: string) (t: term) : Tac binding =
let b = pose t in rename_to b s
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.whnf
val whnf: Prims.unit -> Tac unit
val whnf: Prims.unit -> Tac unit
let whnf () : Tac unit = norm [weak; hnf; primops; delta]
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 60, "end_line": 529, "start_col": 0, "start_line": 529 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in () (** [is_guard] returns whether the current goal arose from a typechecking guard *) let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ()) let skip_guard () : Tac unit = if is_guard () then smt () else fail "" let guards_to_smt () : Tac unit = let _ = repeat skip_guard in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.weak", "FStar.Pervasives.hnf", "FStar.Pervasives.primops", "FStar.Pervasives.delta", "Prims.Nil" ]
[]
false
true
false
false
false
let whnf () : Tac unit =
norm [weak; hnf; primops; delta]
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.flip
val flip: Prims.unit -> Tac unit
val flip: Prims.unit -> Tac unit
let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs)
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 42, "end_line": 142, "start_col": 0, "start_line": 138 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V2.Derived.fail", "FStar.Stubs.Tactics.Types.goal", "Prims.list", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "Prims.Cons", "FStar.Tactics.V2.Derived.goals" ]
[]
false
true
false
false
false
let flip () : Tac unit =
let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1 :: g2 :: gs -> set_goals (g2 :: g1 :: gs)
false
Spec.Ed25519.fst
Spec.Ed25519.verify
val verify: public:lbytes 32 -> msg:bytes{length msg <= max_size_t} -> signature:lbytes 64 -> bool
val verify: public:lbytes 32 -> msg:bytes{length msg <= max_size_t} -> signature:lbytes 64 -> bool
let verify public msg signature = let len = length msg in let a' = point_decompress public in match a' with | None -> false | Some a' -> ( let rs = slice signature 0 32 in let r' = point_decompress rs in match r' with | None -> false | Some r' -> ( let sb = slice signature 32 64 in if nat_from_bytes_le sb >= q then false else ( let h = sha512_modq (64 + len) (Seq.append (concat rs public) msg) in let hb = nat_to_bytes_le 32 h in EL.point_decompress_lemma public; let exp_d = point_negate_mul_double_g sb hb a' in point_equal exp_d r' ) ) )
{ "file_name": "specs/Spec.Ed25519.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 162, "start_col": 0, "start_line": 140 }
module Spec.Ed25519 open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Curve25519 module LE = Lib.Exponentiation module SE = Spec.Exponentiation module EL = Spec.Ed25519.Lemmas include Spec.Ed25519.PointOps #reset-options "--fuel 0 --ifuel 0 --z3rlimit 100" inline_for_extraction let size_signature: size_nat = 64 let q: n:nat{n < pow2 256} = assert_norm(pow2 252 + 27742317777372353535851937790883648493 < pow2 255 - 19); (pow2 252 + 27742317777372353535851937790883648493) // Group order let max_input_length_sha512 = Some?.v (Spec.Hash.Definitions.max_input_length Spec.Hash.Definitions.SHA2_512) let _: squash(max_input_length_sha512 > pow2 32 + 64) = assert_norm (max_input_length_sha512 > pow2 32 + 64) let sha512_modq (len:nat{len <= max_input_length_sha512}) (s:bytes{length s = len}) : n:nat{n < pow2 256} = nat_from_bytes_le (Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 s) % q /// Point Multiplication let aff_point_c = p:aff_point{is_on_curve p} let aff_point_add_c (p:aff_point_c) (q:aff_point_c) : aff_point_c = EL.aff_point_add_lemma p q; aff_point_add p q let mk_ed25519_comm_monoid: LE.comm_monoid aff_point_c = { LE.one = aff_point_at_infinity; LE.mul = aff_point_add_c; LE.lemma_one = EL.aff_point_at_infinity_lemma; LE.lemma_mul_assoc = EL.aff_point_add_assoc_lemma; LE.lemma_mul_comm = EL.aff_point_add_comm_lemma; } let ext_point_c = p:ext_point{point_inv p} let mk_to_ed25519_comm_monoid : SE.to_comm_monoid ext_point_c = { SE.a_spec = aff_point_c; SE.comm_monoid = mk_ed25519_comm_monoid; SE.refl = (fun (x:ext_point_c) -> to_aff_point x); } val point_at_inifinity_c: SE.one_st ext_point_c mk_to_ed25519_comm_monoid let point_at_inifinity_c _ = EL.to_aff_point_at_infinity_lemma (); point_at_infinity val point_add_c: SE.mul_st ext_point_c mk_to_ed25519_comm_monoid let point_add_c p q = EL.to_aff_point_add_lemma p q; point_add p q val point_double_c: SE.sqr_st ext_point_c mk_to_ed25519_comm_monoid let point_double_c p = EL.to_aff_point_double_lemma p; point_double p let mk_ed25519_concrete_ops : SE.concrete_ops ext_point_c = { SE.to = mk_to_ed25519_comm_monoid; SE.one = point_at_inifinity_c; SE.mul = point_add_c; SE.sqr = point_double_c; } // [a]P let point_mul (a:lbytes 32) (p:ext_point_c) : ext_point_c = SE.exp_fw mk_ed25519_concrete_ops p 256 (nat_from_bytes_le a) 4 // [a1]P1 + [a2]P2 let point_mul_double (a1:lbytes 32) (p1:ext_point_c) (a2:lbytes 32) (p2:ext_point_c) : ext_point_c = SE.exp_double_fw mk_ed25519_concrete_ops p1 256 (nat_from_bytes_le a1) p2 (nat_from_bytes_le a2) 5 // [a]G let point_mul_g (a:lbytes 32) : ext_point_c = EL.g_is_on_curve (); point_mul a g // [a1]G + [a2]P let point_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = EL.g_is_on_curve (); point_mul_double a1 g a2 p // [a1]G - [a2]P let point_negate_mul_double_g (a1:lbytes 32) (a2:lbytes 32) (p:ext_point_c) : ext_point_c = let p1 = point_negate p in EL.to_aff_point_negate p; point_mul_double_g a1 a2 p1 /// Ed25519 API let secret_expand (secret:lbytes 32) : (lbytes 32 & lbytes 32) = let h = Spec.Agile.Hash.hash Spec.Hash.Definitions.SHA2_512 secret in let h_low : lbytes 32 = slice h 0 32 in let h_high : lbytes 32 = slice h 32 64 in let h_low = h_low.[ 0] <- h_low.[0] &. u8 0xf8 in let h_low = h_low.[31] <- (h_low.[31] &. u8 127) |. u8 64 in h_low, h_high let secret_to_public (secret:lbytes 32) : lbytes 32 = let a, dummy = secret_expand secret in point_compress (point_mul_g a) let expand_keys (secret:lbytes 32) : (lbytes 32 & lbytes 32 & lbytes 32) = let s, prefix = secret_expand secret in let pub = point_compress (point_mul_g s) in pub, s, prefix val sign_expanded (pub s prefix:lbytes 32) (msg:bytes{length msg <= max_size_t}) : lbytes 64 let sign_expanded pub s prefix msg = let len = length msg in let r = sha512_modq (32 + len) (Seq.append prefix msg) in let r' = point_mul_g (nat_to_bytes_le 32 r) in let rs = point_compress r' in let h = sha512_modq (64 + len) (Seq.append (concat rs pub) msg) in let s = (r + (h * nat_from_bytes_le s) % q) % q in concat #_ #32 #32 rs (nat_to_bytes_le 32 s) val sign: secret:lbytes 32 -> msg:bytes{length msg <= max_size_t} -> lbytes 64 let sign secret msg = let pub, s, prefix = expand_keys secret in sign_expanded pub s prefix msg
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Exponentiation.fsti.checked", "Spec.Ed25519.PointOps.fst.checked", "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Curve25519.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Ed25519.fst" }
[ { "abbrev": false, "full_module": "Spec.Ed25519.PointOps", "short_module": null }, { "abbrev": true, "full_module": "Spec.Ed25519.Lemmas", "short_module": "EL" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, ...
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
public: Lib.ByteSequence.lbytes 32 -> msg: Lib.ByteSequence.bytes{Lib.Sequence.length msg <= Lib.IntTypes.max_size_t} -> signature: Lib.ByteSequence.lbytes 64 -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.max_size_t", "Spec.Ed25519.PointOps.ext_point", "Prims.op_GreaterThanOrEqual", "Lib.ByteSequence.nat_...
[]
false
false
false
false
false
let verify public msg signature =
let len = length msg in let a' = point_decompress public in match a' with | None -> false | Some a' -> (let rs = slice signature 0 32 in let r' = point_decompress rs in match r' with | None -> false | Some r' -> (let sb = slice signature 32 64 in if nat_from_bytes_le sb >= q then false else (let h = sha512_modq (64 + len) (Seq.append (concat rs public) msg) in let hb = nat_to_bytes_le 32 h in EL.point_decompress_lemma public; let exp_d = point_negate_mul_double_g sb hb a' in point_equal exp_d r')))
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.compute
val compute: Prims.unit -> Tac unit
val compute: Prims.unit -> Tac unit
let compute () : Tac unit = norm [primops; iota; delta; zeta]
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 61, "end_line": 530, "start_col": 0, "start_line": 530 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in () (** [is_guard] returns whether the current goal arose from a typechecking guard *) let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ()) let skip_guard () : Tac unit = if is_guard () then smt () else fail "" let guards_to_smt () : Tac unit = let _ = repeat skip_guard in () let simpl () : Tac unit = norm [simplify; primops]
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.primops", "FStar.Pervasives.iota", "FStar.Pervasives.delta", "FStar.Pervasives.zeta", "Prims.Nil" ]
[]
false
true
false
false
false
let compute () : Tac unit =
norm [primops; iota; delta; zeta]
false
FStar.Tactics.V2.Derived.fst
FStar.Tactics.V2.Derived.is_guard
val is_guard: Prims.unit -> Tac bool
val is_guard: Prims.unit -> Tac bool
let is_guard () : Tac bool = Stubs.Tactics.Types.is_guard (_cur_goal ())
{ "file_name": "ulib/FStar.Tactics.V2.Derived.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 47, "end_line": 517, "start_col": 0, "start_line": 516 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.V2.Derived open FStar.Reflection.V2 open FStar.Reflection.V2.Formula open FStar.Tactics.Effect open FStar.Stubs.Tactics.Types open FStar.Stubs.Tactics.Result open FStar.Stubs.Tactics.V2.Builtins open FStar.Tactics.Util open FStar.Tactics.V2.SyntaxHelpers open FStar.VConfig open FStar.Tactics.NamedView open FStar.Tactics.V2.SyntaxCoercions module L = FStar.List.Tot.Base module V = FStar.Tactics.Visit private let (@) = L.op_At let name_of_bv (bv : bv) : Tac string = unseal ((inspect_bv bv).ppname) let bv_to_string (bv : bv) : Tac string = (* Could also print type...? *) name_of_bv bv let name_of_binder (b : binder) : Tac string = unseal b.ppname let binder_to_string (b : binder) : Tac string = // TODO: print aqual, attributes..? or no? name_of_binder b ^ "@@" ^ string_of_int b.uniq ^ "::(" ^ term_to_string b.sort ^ ")" let binding_to_string (b : binding) : Tac string = unseal b.ppname let type_of_var (x : namedv) : Tac typ = unseal ((inspect_namedv x).sort) let type_of_binding (x : binding) : Tot typ = x.sort exception Goal_not_trivial let goals () : Tac (list goal) = goals_of (get ()) let smt_goals () : Tac (list goal) = smt_goals_of (get ()) let fail (#a:Type) (m:string) : TAC a (fun ps post -> post (Failed (TacticFailure m) ps)) = raise #a (TacticFailure m) let fail_silently (#a:Type) (m:string) : TAC a (fun _ post -> forall ps. post (Failed (TacticFailure m) ps)) = set_urgency 0; raise #a (TacticFailure m) (** Return the current *goal*, not its type. (Ignores SMT goals) *) let _cur_goal () : Tac goal = match goals () with | [] -> fail "no more goals" | g::_ -> g (** [cur_env] returns the current goal's environment *) let cur_env () : Tac env = goal_env (_cur_goal ()) (** [cur_goal] returns the current goal's type *) let cur_goal () : Tac typ = goal_type (_cur_goal ()) (** [cur_witness] returns the current goal's witness *) let cur_witness () : Tac term = goal_witness (_cur_goal ()) (** [cur_goal_safe] will always return the current goal, without failing. It must be statically verified that there indeed is a goal in order to call it. *) let cur_goal_safe () : TacH goal (requires (fun ps -> ~(goals_of ps == []))) (ensures (fun ps0 r -> exists g. r == Success g ps0)) = match goals_of (get ()) with | g :: _ -> g let cur_vars () : Tac (list binding) = vars_of_env (cur_env ()) (** Set the guard policy only locally, without affecting calling code *) let with_policy pol (f : unit -> Tac 'a) : Tac 'a = let old_pol = get_guard_policy () in set_guard_policy pol; let r = f () in set_guard_policy old_pol; r (** [exact e] will solve a goal [Gamma |- w : t] if [e] has type exactly [t] in [Gamma]. *) let exact (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true false t) (** [exact_with_ref e] will solve a goal [Gamma |- w : t] if [e] has type [t'] where [t'] is a subtype of [t] in [Gamma]. This is a more flexible variant of [exact]. *) let exact_with_ref (t : term) : Tac unit = with_policy SMT (fun () -> t_exact true true t) let trivial () : Tac unit = norm [iota; zeta; reify_; delta; primops; simplify; unmeta]; let g = cur_goal () in match term_as_formula g with | True_ -> exact (`()) | _ -> raise Goal_not_trivial (* Another hook to just run a tactic without goals, just by reusing `with_tactic` *) let run_tactic (t:unit -> Tac unit) : Pure unit (requires (set_range_of (with_tactic (fun () -> trivial (); t ()) (squash True)) (range_of t))) (ensures (fun _ -> True)) = () (** Ignore the current goal. If left unproven, this will fail after the tactic finishes. *) let dismiss () : Tac unit = match goals () with | [] -> fail "dismiss: no more goals" | _::gs -> set_goals gs (** Flip the order of the first two goals. *) let flip () : Tac unit = let gs = goals () in match goals () with | [] | [_] -> fail "flip: less than two goals" | g1::g2::gs -> set_goals (g2::g1::gs) (** Succeed if there are no more goals left, and fail otherwise. *) let qed () : Tac unit = match goals () with | [] -> () | _ -> fail "qed: not done!" (** [debug str] is similar to [print str], but will only print the message if the [--debug] option was given for the current module AND [--debug_level Tac] is on. *) let debug (m:string) : Tac unit = if debugging () then print m (** [smt] will mark the current goal for being solved through the SMT. This does not immediately run the SMT: it just dumps the goal in the SMT bin. Note, if you dump a proof-relevant goal there, the engine will later raise an error. *) let smt () : Tac unit = match goals (), smt_goals () with | [], _ -> fail "smt: no active goals" | g::gs, gs' -> begin set_goals gs; set_smt_goals (g :: gs') end let idtac () : Tac unit = () (** Push the current goal to the back. *) let later () : Tac unit = match goals () with | g::gs -> set_goals (gs @ [g]) | _ -> fail "later: no goals" (** [apply f] will attempt to produce a solution to the goal by an application of [f] to any amount of arguments (which need to be solved as further goals). The amount of arguments introduced is the least such that [f a_i] unifies with the goal's type. *) let apply (t : term) : Tac unit = t_apply true false false t let apply_noinst (t : term) : Tac unit = t_apply true true false t (** [apply_lemma l] will solve a goal of type [squash phi] when [l] is a Lemma ensuring [phi]. The arguments to [l] and its requires clause are introduced as new goals. As a small optimization, [unit] arguments are discharged by the engine. Just a thin wrapper around [t_apply_lemma]. *) let apply_lemma (t : term) : Tac unit = t_apply_lemma false false t (** See docs for [t_trefl] *) let trefl () : Tac unit = t_trefl false (** See docs for [t_trefl] *) let trefl_guard () : Tac unit = t_trefl true (** See docs for [t_commute_applied_match] *) let commute_applied_match () : Tac unit = t_commute_applied_match () (** Similar to [apply_lemma], but will not instantiate uvars in the goal while applying. *) let apply_lemma_noinst (t : term) : Tac unit = t_apply_lemma true false t let apply_lemma_rw (t : term) : Tac unit = t_apply_lemma false true t (** [apply_raw f] is like [apply], but will ask for all arguments regardless of whether they appear free in further goals. See the explanation in [t_apply]. *) let apply_raw (t : term) : Tac unit = t_apply false false false t (** Like [exact], but allows for the term [e] to have a type [t] only under some guard [g], adding the guard as a goal. *) let exact_guard (t : term) : Tac unit = with_policy Goal (fun () -> t_exact true false t) (** (TODO: explain better) When running [pointwise tau] For every subterm [t'] of the goal's type [t], the engine will build a goal [Gamma |= t' == ?u] and run [tau] on it. When the tactic proves the goal, the engine will rewrite [t'] for [?u] in the original goal type. This is done for every subterm, bottom-up. This allows to recurse over an unknown goal type. By inspecting the goal, the [tau] can then decide what to do (to not do anything, use [trefl]). *) let t_pointwise (d:direction) (tau : unit -> Tac unit) : Tac unit = let ctrl (t:term) : Tac (bool & ctrl_flag) = true, Continue in let rw () : Tac unit = tau () in ctrl_rewrite d ctrl rw (** [topdown_rewrite ctrl rw] is used to rewrite those sub-terms [t] of the goal on which [fst (ctrl t)] returns true. On each such sub-term, [rw] is presented with an equality of goal of the form [Gamma |= t == ?u]. When [rw] proves the goal, the engine will rewrite [t] for [?u] in the original goal type. The goal formula is traversed top-down and the traversal can be controlled by [snd (ctrl t)]: When [snd (ctrl t) = 0], the traversal continues down through the position in the goal term. When [snd (ctrl t) = 1], the traversal continues to the next sub-tree of the goal. When [snd (ctrl t) = 2], no more rewrites are performed in the goal. *) let topdown_rewrite (ctrl : term -> Tac (bool * int)) (rw:unit -> Tac unit) : Tac unit = let ctrl' (t:term) : Tac (bool & ctrl_flag) = let b, i = ctrl t in let f = match i with | 0 -> Continue | 1 -> Skip | 2 -> Abort | _ -> fail "topdown_rewrite: bad value from ctrl" in b, f in ctrl_rewrite TopDown ctrl' rw let pointwise (tau : unit -> Tac unit) : Tac unit = t_pointwise BottomUp tau let pointwise' (tau : unit -> Tac unit) : Tac unit = t_pointwise TopDown tau let cur_module () : Tac name = moduleof (top_env ()) let open_modules () : Tac (list name) = env_open_modules (top_env ()) let fresh_uvar (o : option typ) : Tac term = let e = cur_env () in uvar_env e o let unify (t1 t2 : term) : Tac bool = let e = cur_env () in unify_env e t1 t2 let unify_guard (t1 t2 : term) : Tac bool = let e = cur_env () in unify_guard_env e t1 t2 let tmatch (t1 t2 : term) : Tac bool = let e = cur_env () in match_env e t1 t2 (** [divide n t1 t2] will split the current set of goals into the [n] first ones, and the rest. It then runs [t1] on the first set, and [t2] on the second, returning both results (and concatenating remaining goals). *) let divide (n:int) (l : unit -> Tac 'a) (r : unit -> Tac 'b) : Tac ('a * 'b) = if n < 0 then fail "divide: negative n"; let gs, sgs = goals (), smt_goals () in let gs1, gs2 = List.Tot.Base.splitAt n gs in set_goals gs1; set_smt_goals []; let x = l () in let gsl, sgsl = goals (), smt_goals () in set_goals gs2; set_smt_goals []; let y = r () in let gsr, sgsr = goals (), smt_goals () in set_goals (gsl @ gsr); set_smt_goals (sgs @ sgsl @ sgsr); (x, y) let rec iseq (ts : list (unit -> Tac unit)) : Tac unit = match ts with | t::ts -> let _ = divide 1 t (fun () -> iseq ts) in () | [] -> () (** [focus t] runs [t ()] on the current active goal, hiding all others and restoring them at the end. *) let focus (t : unit -> Tac 'a) : Tac 'a = match goals () with | [] -> fail "focus: no goals" | g::gs -> let sgs = smt_goals () in set_goals [g]; set_smt_goals []; let x = t () in set_goals (goals () @ gs); set_smt_goals (smt_goals () @ sgs); x (** Similar to [dump], but only dumping the current goal. *) let dump1 (m : string) = focus (fun () -> dump m) let rec mapAll (t : unit -> Tac 'a) : Tac (list 'a) = match goals () with | [] -> [] | _::_ -> let (h, t) = divide 1 t (fun () -> mapAll t) in h::t let rec iterAll (t : unit -> Tac unit) : Tac unit = (* Could use mapAll, but why even build that list *) match goals () with | [] -> () | _::_ -> let _ = divide 1 t (fun () -> iterAll t) in () let iterAllSMT (t : unit -> Tac unit) : Tac unit = let gs, sgs = goals (), smt_goals () in set_goals sgs; set_smt_goals []; iterAll t; let gs', sgs' = goals (), smt_goals () in set_goals gs; set_smt_goals (gs'@sgs') (** Runs tactic [t1] on the current goal, and then tactic [t2] on *each* subgoal produced by [t1]. Each invocation of [t2] runs on a proofstate with a single goal (they're "focused"). *) let seq (f : unit -> Tac unit) (g : unit -> Tac unit) : Tac unit = focus (fun () -> f (); iterAll g) let exact_args (qs : list aqualv) (t : term) : Tac unit = focus (fun () -> let n = List.Tot.Base.length qs in let uvs = repeatn n (fun () -> fresh_uvar None) in let t' = mk_app t (zip uvs qs) in exact t'; iter (fun uv -> if is_uvar uv then unshelve uv else ()) (L.rev uvs) ) let exact_n (n : int) (t : term) : Tac unit = exact_args (repeatn n (fun () -> Q_Explicit)) t (** [ngoals ()] returns the number of goals *) let ngoals () : Tac int = List.Tot.Base.length (goals ()) (** [ngoals_smt ()] returns the number of SMT goals *) let ngoals_smt () : Tac int = List.Tot.Base.length (smt_goals ()) (* sigh GGG fix names!! *) let fresh_namedv_named (s:string) : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal s; sort = seal (pack Tv_Unknown); uniq = n; }) (* Create a fresh bound variable (bv), using a generic name. See also [fresh_namedv_named]. *) let fresh_namedv () : Tac namedv = let n = fresh () in pack_namedv ({ ppname = seal ("x" ^ string_of_int n); sort = seal (pack Tv_Unknown); uniq = n; }) let fresh_binder_named (s : string) (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal s; sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_binder (t : typ) : Tac simple_binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Explicit; attrs = [] ; } let fresh_implicit_binder (t : typ) : Tac binder = let n = fresh () in { ppname = seal ("x" ^ string_of_int n); sort = t; uniq = n; qual = Q_Implicit; attrs = [] ; } let guard (b : bool) : TacH unit (requires (fun _ -> True)) (ensures (fun ps r -> if b then Success? r /\ Success?.ps r == ps else Failed? r)) (* ^ the proofstate on failure is not exactly equal (has the psc set) *) = if not b then fail "guard failed" else () let try_with (f : unit -> Tac 'a) (h : exn -> Tac 'a) : Tac 'a = match catch f with | Inl e -> h e | Inr x -> x let trytac (t : unit -> Tac 'a) : Tac (option 'a) = try Some (t ()) with | _ -> None let or_else (#a:Type) (t1 : unit -> Tac a) (t2 : unit -> Tac a) : Tac a = try t1 () with | _ -> t2 () val (<|>) : (unit -> Tac 'a) -> (unit -> Tac 'a) -> (unit -> Tac 'a) let (<|>) t1 t2 = fun () -> or_else t1 t2 let first (ts : list (unit -> Tac 'a)) : Tac 'a = L.fold_right (<|>) ts (fun () -> fail "no tactics to try") () let rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) = match catch t with | Inl _ -> [] | Inr x -> x :: repeat t let repeat1 (#a:Type) (t : unit -> Tac a) : Tac (list a) = t () :: repeat t let repeat' (f : unit -> Tac 'a) : Tac unit = let _ = repeat f in () let norm_term (s : list norm_step) (t : term) : Tac term = let e = try cur_env () with | _ -> top_env () in norm_term_env e s t (** Join all of the SMT goals into one. This helps when all of them are expected to be similar, and therefore easier to prove at once by the SMT solver. TODO: would be nice to try to join them in a more meaningful way, as the order can matter. *) let join_all_smt_goals () = let gs, sgs = goals (), smt_goals () in set_smt_goals []; set_goals sgs; repeat' join; let sgs' = goals () in // should be a single one set_goals gs; set_smt_goals sgs' let discard (tau : unit -> Tac 'a) : unit -> Tac unit = fun () -> let _ = tau () in () // TODO: do we want some value out of this? let rec repeatseq (#a:Type) (t : unit -> Tac a) : Tac unit = let _ = trytac (fun () -> (discard t) `seq` (discard (fun () -> repeatseq t))) in () let tadmit () = tadmit_t (`()) let admit1 () : Tac unit = tadmit () let admit_all () : Tac unit = let _ = repeat tadmit in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.VConfig.fsti.checked", "FStar.Tactics.Visit.fst.checked", "FStar.Tactics.V2.SyntaxHelpers.fst.checked", "FStar.Tactics.V2.SyntaxCoercions.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.NamedView.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Tactics.Result.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Reflection.V2.Formula.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Range.fsti.checked", "FStar.PropositionalExtensionality.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.Base.fst.checked" ], "interface_file": false, "source_file": "FStar.Tactics.V2.Derived.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics.Visit", "short_module": "V" }, { "abbrev": true, "full_module": "FStar.List.Tot.Base", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.Tactics.V2.SyntaxCoercions", "short_module": null }, { "abbrev": ...
{ "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" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.bool
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.Types.is_guard", "Prims.bool", "FStar.Stubs.Tactics.Types.goal", "FStar.Tactics.V2.Derived._cur_goal" ]
[]
false
true
false
false
false
let is_guard () : Tac bool =
Stubs.Tactics.Types.is_guard (_cur_goal ())
false