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
sequencelengths
0
2
mutual_with
sequencelengths
0
11
ideal_premises
sequencelengths
0
236
proof_features
sequencelengths
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
Vale.AES.PPC64LE.GCTR.fst
Vale.AES.PPC64LE.GCTR.va_lemma_Gctr_blocks128
val va_lemma_Gctr_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial alg (va_get_reg 6 va_s0) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ l_and (l_and (va_get_reg 3 va_sM == va_get_reg 3 va_s0) (va_get_reg 7 va_sM == va_get_reg 7 va_s0)) (va_get_reg 6 va_sM == va_get_reg 6 va_s0)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 26 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))
val va_lemma_Gctr_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial alg (va_get_reg 6 va_s0) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ l_and (l_and (va_get_reg 3 va_sM == va_get_reg 3 va_s0) (va_get_reg 7 va_sM == va_get_reg 7 va_s0)) (va_get_reg 6 va_sM == va_get_reg 6 va_s0)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 26 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 6 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))
let va_lemma_Gctr_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 26; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 6; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128 va_mods alg in_b out_b key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 585 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 618 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 621 column 147 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial alg (va_get_reg 6 va_s0) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 622 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 623 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 625 column 76 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (l_and (l_and (va_get_reg 3 va_sM == va_get_reg 3 va_s0) (va_get_reg 7 va_sM == va_get_reg 7 va_s0)) (va_get_reg 6 va_sM == va_get_reg 6 va_s0)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 26; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 6; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "file_name": "obj/Vale.AES.PPC64LE.GCTR.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 3030, "start_col": 0, "start_line": 2994 }
module Vale.AES.PPC64LE.GCTR open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.HeapImpl open FStar.Seq open Vale.AES.AES_BE_s open Vale.AES.PPC64LE.AES open Vale.AES.GCTR_BE_s open Vale.AES.GCTR_BE open Vale.AES.GCM_helpers_BE open Vale.Poly1305.Math open Vale.Def.Words.Two_s open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.InsStack open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.Types_helpers #reset-options "--z3rlimit 30" open Vale.Lib.Basic #reset-options "--z3rlimit 20" //-- Gctr_register [@ "opaque_to_smt" va_qattr] let va_code_Gctr_register alg = (va_Block (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CNil ())))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_register alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_register (va_mods:va_mods_t) (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_register alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE_s.inc32 (va_get_vec 7 va_s) 0 == va_get_vec 7 va_s) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 100 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 101 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock alg (va_get_vec 7 va_s) key round_keys keys_b) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 102 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (va_get_vec 7 va_s)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 102 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 0 va_s == Vale.AES.AES_BE_s.aes_encrypt_word alg key (va_get_vec 7 va_s)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun (va_s:va_state) _ -> let (va_arg15:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg14:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg13:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let (va_arg12:Vale.Def.Types_s.quad32) = va_get_vec 7 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 107 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.gctr_encrypt_one_block va_arg12 va_arg13 va_arg14 va_arg15) (va_QEmpty (())))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_register va_b0 va_s0 alg key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_Gctr_register va_mods alg key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_register alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 96 column 142 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE #Vale.Def.Words_s.nat32 (FStar.Seq.Base.create #quad32 1 (va_get_vec 1 va_sM))) == Vale.AES.GCTR_BE_s.gctr_encrypt (va_get_vec 7 va_sM) (Vale.Arch.Types.be_quad32_to_bytes (va_get_vec 1 va_s0)) alg key) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 1 va_sM == Vale.AES.GCTR_BE_s.gctr_encrypt_block (va_get_vec 7 va_sM) (va_get_vec 1 va_s0) alg key 0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Gctr_register alg key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_register (va_code_Gctr_register alg) va_s0 alg key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Gctr_blocks128_body_1way val va_code_Gctr_blocks128_body_1way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_body_1way alg = (va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret) (va_CNil ())))))))) val va_codegen_success_Gctr_blocks128_body_1way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_body_1way alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_body_1way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_body_1way alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 152 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 6 va_s + count))) (fun _ -> let (ctr_enc:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 6 va_s + count) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 6 va_s + count))) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 154 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 155 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock alg (va_get_vec 7 va_s) key round_keys keys_b) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 157 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret in_b (va_get_reg 6 va_s + count)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 158 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 159 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret out_b (va_get_reg 6 va_s + count)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 160 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 6 va_s + count) (va_get_mem_heaplet 1 va_s)) == ctr_enc) (let (va_arg24:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg23:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg22:Vale.Def.Types_s.quad32) = old_icb in let (va_arg21:Prims.nat) = va_get_reg 6 va_s + count in let (va_arg20:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg19:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) out_b) in let (va_arg18:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 162 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.lemma_eq_reverse_bytes_quad32_seq va_arg18 va_arg19 va_arg20 va_arg21 va_arg22 va_arg23 va_arg24) (va_QEmpty (()))))))))))) val va_lemma_Gctr_blocks128_body_1way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> count:nat -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_body_1way alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= count /\ count < va_get_reg 26 va_s0 /\ va_get_reg 9 va_s0 == count `op_Multiply` 16 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0 + count) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + count) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0 + count) /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_body_1way va_b0 va_s0 alg in_b out_b count old_icb key round_keys keys_b plain_quads = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_body_1way va_mods alg in_b out_b count old_icb key round_keys keys_b plain_quads in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_body_1way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 110 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 148 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 149 column 132 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 150 column 126 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_body_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= count /\ count < va_get_reg 26 va_s0 /\ va_get_reg 9 va_s0 == count `op_Multiply` 16 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0 + count) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + count) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0 + count) /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_body_1way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> count:nat -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq 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_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_body_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_body_1way (va_code_Gctr_blocks128_body_1way alg) va_s0 alg in_b out_b count old_icb key round_keys keys_b plain_quads in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; 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_Gctr_blocks128_body_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_body_1way alg)) = (va_QProc (va_code_Gctr_blocks128_body_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem]) (va_wp_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads) (va_wpProof_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads)) //-- //-- Mod_cr0 val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Mod_cr0 () = (va_Block (va_CNil ())) val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Mod_cr0 () = (va_ttrue ()) [@ "opaque_to_smt" va_qattr] let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (()))) val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Mod_cr0 ()) va_s0 /\ va_get_ok 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_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_Mod_cr0 va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in let va_qc = va_qcode_Mod_cr0 va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 165 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Mod_cr0 va_s0 va_k = let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) = (va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0) //-- //-- Gctr_blocks128_1way_body0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way_body0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way_body0 alg = (va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Gctr_blocks128_body_1way alg) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_CNil ()))))))) val va_codegen_success_Gctr_blocks128_1way_body0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way_body0 alg = (va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and (va_codegen_success_Gctr_blocks128_body_1way alg) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way_body0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_body0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (old_icb:quad32) = va_in_old_icb in let (old_plain:(seq quad32)) = va_in_old_plain in let (out_b:buffer128) = va_in_out_b in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 257 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Mod_cr0 ()) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 259 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_body_1way alg in_b out_b (va_get_reg 8 va_s) old_icb key round_keys keys_b old_plain) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 261 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 262 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 263 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_QEmpty (())))))))) val va_lemma_Gctr_blocks128_1way_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way_body0 alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way_body0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_1way_body0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way_body0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 229 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 230 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 231 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 235 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 236 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 237 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 238 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 239 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 240 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 241 column 143 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 242 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 245 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 248 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 252 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 253 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 254 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))) in va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way_body0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq 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_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way_body0 (va_code_Gctr_blocks128_1way_body0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_1way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_body0 alg)) = (va_QProc (va_code_Gctr_blocks128_1way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys) (va_wpProof_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_1way_while0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way_while0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way_while0 alg = (va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 26)) (va_Block (va_CCons (va_code_Gctr_blocks128_1way_body0 alg) (va_CNil ())))) (va_CNil ()))) val va_codegen_success_Gctr_blocks128_1way_while0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way_while0 alg = (va_pbool_and (va_codegen_success_Gctr_blocks128_1way_body0 alg) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way_while0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_while0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (old_icb:quad32) = va_in_old_icb in let (old_plain:(seq quad32)) = va_in_old_plain in let (out_b:buffer128) = va_in_out_b in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_qWhile va_mods (Cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 26)) (fun va_g -> qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way_body0 va_old alg in_b key keys_b old_icb old_plain out_b round_keys) (va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_get_ok va_s /\ (0 <= va_get_reg 8 va_s /\ va_get_reg 8 va_s <= va_get_reg 26 va_s) /\ va_get_reg 9 va_s == 16 `op_Multiply` va_get_reg 8 va_s /\ va_get_vec 7 va_s == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s + va_get_reg 8 va_s) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 3 va_s) in_b (va_get_reg 6 va_s) (va_get_reg 26 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) out_b (va_get_reg 6 va_s) (va_get_reg 26 va_s) (va_get_mem_layout va_s) Secret /\ va_get_reg 3 va_s + 16 `op_Multiply` va_get_reg 26 va_s < pow2_64 /\ va_get_reg 7 va_s + 16 `op_Multiply` va_get_reg 26 va_s < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b /\ (va_get_reg 8 va_s =!= va_get_reg 26 va_s ==> Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) (va_get_reg 6 va_s + va_get_reg 8 va_s) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ va_get_reg 6 va_s + va_get_reg 26 va_s < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s) (va_get_mem_heaplet 0 va_s) (va_get_mem_layout va_s) /\ va_get_vec 3 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s + va_get_reg 8 va_s) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b)) key old_icb /\ (va_get_reg 6 va_s + va_get_reg 26 va_s == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) out_b)) (fun (va_s:va_state) va_g -> va_get_reg 26 va_s - va_get_reg 8 va_s) (())) (fun (va_s:va_state) va_g -> let va_g = () in va_QEmpty (())))) val va_lemma_Gctr_blocks128_1way_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way_while0 alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ ~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way_while0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_1way_while0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way_while0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 229 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 230 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 231 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 235 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 236 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 237 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 238 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 239 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 240 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 241 column 143 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 242 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 245 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 248 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 252 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 253 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))) in va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ ~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way_while0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq 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_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way_while0 (va_code_Gctr_blocks128_1way_while0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_1way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_while0 alg)) = (va_QProc (va_code_Gctr_blocks128_1way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys) (va_wpProof_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_1way #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way alg = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 3) 1) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 4) 0) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_CCons (va_code_Gctr_blocks128_1way_while0 alg) (va_CNil ())))))))) val va_codegen_success_Gctr_blocks128_1way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way alg = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 3) 1) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 0) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_pbool_and (va_codegen_success_Gctr_blocks128_1way_while0 alg) (va_ttrue ()))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_1way 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 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 3) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 220 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 4) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 221 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 223 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 226 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way_while0 va_old_s alg in_b key keys_b old_icb old_plain out_b round_keys) (va_QEmpty (()))))))))) val va_lemma_Gctr_blocks128_1way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> old_plain:(seq quad32) -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way alg) va_s0 /\ va_get_ok va_s0 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM) /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 7 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way va_b0 va_s0 alg in_b out_b old_icb old_plain key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_1way va_mods alg in_b out_b old_icb old_plain key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 212 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 215 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 216 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 217 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(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 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb) /\ (forall (va_x_mem:vale_heap) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v7:quad32) (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 (va_upd_vec 7 va_x_v7 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_mem va_x_mem va_s0)))))))))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM) /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> old_plain:(seq quad32) -> key:(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_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way (va_code_Gctr_blocks128_1way alg) va_s0 alg in_b out_b old_icb old_plain key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 7 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; 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_Gctr_blocks128_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_1way alg)) = (va_QProc (va_code_Gctr_blocks128_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_mem]) (va_wp_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b) (va_wpProof_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b)) #pop-options //-- //-- Store_3blocks128_1 val va_code_Store_3blocks128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Store_3blocks128_1 () = (va_Block (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret) (va_CNil ()))))) val va_codegen_success_Store_3blocks128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Store_3blocks128_1 () = (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Store_3blocks128_1 (va_mods:va_mods_t) (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_1 ())) = (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 287 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret out_b (va_get_reg 8 va_s)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 288 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret out_b (va_get_reg 8 va_s + 1)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 289 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret out_b (va_get_reg 8 va_s + 2)) (va_QEmpty (())))))) val va_lemma_Store_3blocks128_1 : va_b0:va_code -> va_s0:va_state -> out_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_3blocks128_1 ()) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_Store_3blocks128_1 va_b0 va_s0 out_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Store_3blocks128_1 va_mods out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Store_3blocks128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 267 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 282 column 76 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 283 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 284 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Store_3blocks128_1 (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16) /\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Store_3blocks128_1 : out_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_Store_3blocks128_1 out_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_3blocks128_1 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Store_3blocks128_1 out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_3blocks128_1 (va_code_Store_3blocks128_1 ()) va_s0 out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; 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_Store_3blocks128_1 (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_1 ())) = (va_QProc (va_code_Store_3blocks128_1 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Store_3blocks128_1 out_b) (va_wpProof_Store_3blocks128_1 out_b)) //-- //-- Store_3blocks128_2 val va_code_Store_3blocks128_2 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Store_3blocks128_2 () = (va_Block (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret) (va_CNil ()))))) val va_codegen_success_Store_3blocks128_2 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Store_3blocks128_2 () = (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Store_3blocks128_2 (va_mods:va_mods_t) (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_2 ())) = (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 313 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret out_b (va_get_reg 8 va_s + 3)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 314 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret out_b (va_get_reg 8 va_s + 4)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 315 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret out_b (va_get_reg 8 va_s + 5)) (va_QEmpty (())))))) val va_lemma_Store_3blocks128_2 : va_b0:va_code -> va_s0:va_state -> out_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_3blocks128_2 ()) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_Store_3blocks128_2 va_b0 va_s0 out_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Store_3blocks128_2 va_mods out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Store_3blocks128_2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 80 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 310 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Store_3blocks128_2 (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16) /\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Store_3blocks128_2 : out_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_Store_3blocks128_2 out_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_3blocks128_2 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Store_3blocks128_2 out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_3blocks128_2 (va_code_Store_3blocks128_2 ()) va_s0 out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; 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_Store_3blocks128_2 (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_2 ())) = (va_QProc (va_code_Store_3blocks128_2 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Store_3blocks128_2 out_b) (va_wpProof_Store_3blocks128_2 out_b)) //-- //-- Gctr_blocks128_6way_body val va_code_Gctr_blocks128_6way_body : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_body alg = (va_Block (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_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (va_CCons (va_code_AESEncryptBlock_6way alg) (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_CCons (va_code_Store_3blocks128_1 ()) (va_CCons (va_code_Store_3blocks128_2 ()) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_CNil ()))))))))))))))))))))))))))))))))) val va_codegen_success_Gctr_blocks128_6way_body : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_body alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (va_pbool_and (va_codegen_success_AESEncryptBlock_6way alg) (va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Store_3blocks128_1 ()) (va_pbool_and (va_codegen_success_Store_3blocks128_2 ()) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_ttrue ())))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_body (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 383 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s))) (fun _ -> let (ctr_enc_0:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 384 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 1))) (fun _ -> let (ctr_enc_1:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 1) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 1))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 385 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 2))) (fun _ -> let (ctr_enc_2:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 2) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 2))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 386 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 3))) (fun _ -> let (ctr_enc_3:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 3) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 3))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 387 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 4))) (fun _ -> let (ctr_enc_4:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 4) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 4))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 388 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 5))) (fun _ -> let (ctr_enc_5:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 5) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 5))) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 390 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 391 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 392 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 393 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 394 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 395 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 397 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock_6way alg (va_get_vec 7 va_s) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 1) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 2) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 3) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 4) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 5) key round_keys keys_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 399 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret in_b (va_get_reg 8 va_s)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 400 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret in_b (va_get_reg 8 va_s + 1)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 401 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret in_b (va_get_reg 8 va_s + 2)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 402 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret in_b (va_get_reg 8 va_s + 3)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 403 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret in_b (va_get_reg 8 va_s + 4)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 404 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret in_b (va_get_reg 8 va_s + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 407 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store_3blocks128_1 out_b) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store_3blocks128_2 out_b) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 415 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s) (va_get_mem_heaplet 1 va_s)) == ctr_enc_0) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 1) (va_get_mem_heaplet 1 va_s)) == ctr_enc_1) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 417 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 2) (va_get_mem_heaplet 1 va_s)) == ctr_enc_2) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 418 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 3) (va_get_mem_heaplet 1 va_s)) == ctr_enc_3) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 419 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 4) (va_get_mem_heaplet 1 va_s)) == ctr_enc_4) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 420 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 5) (va_get_mem_heaplet 1 va_s)) == ctr_enc_5) (let (va_arg64:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg63:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg62:Vale.Def.Types_s.quad32) = old_icb in let (va_arg61:Prims.nat) = va_get_reg 8 va_s in let (va_arg60:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg59:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) out_b) in let (va_arg58:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 422 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.lemma_eq_reverse_bytes_quad32_seq va_arg58 va_arg59 va_arg60 va_arg61 va_arg62 va_arg63 va_arg64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 424 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 425 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 426 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 427 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))))) val va_lemma_Gctr_blocks128_6way_body : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way_body va_b0 va_s0 alg in_b out_b old_icb key round_keys keys_b plain_quads = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_6way_body va_mods alg in_b out_b old_icb key round_keys keys_b plain_quads in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_body alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 374 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 375 column 114 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 376 column 108 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 378 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 379 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 380 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 381 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way_body (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way_body : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq 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_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way_body alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way_body (va_code_Gctr_blocks128_6way_body alg) va_s0 alg in_b out_b old_icb key round_keys keys_b plain_quads in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; 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_Gctr_blocks128_6way_body (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body alg)) = (va_QProc (va_code_Gctr_blocks128_6way_body alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_mem]) (va_wp_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads) (va_wpProof_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads)) //-- //-- Gctr_blocks128_6way_body0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_6way_body0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_body0 alg = (va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Gctr_blocks128_6way_body alg) (va_CNil ())))) val va_codegen_success_Gctr_blocks128_6way_body0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_body0 alg = (va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and (va_codegen_success_Gctr_blocks128_6way_body alg) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_body0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (out_b:buffer128) = va_in_out_b in let (plain_quads:(seq quad32)) = va_in_plain_quads in let (round_keys:(seq quad32)) = va_in_round_keys in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 548 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Mod_cr0 ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 550 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way_body alg in_b out_b (va_get_vec 7 va_old) key round_keys keys_b plain_quads) (va_QEmpty (()))))) val va_lemma_Gctr_blocks128_6way_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body0 alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 =!= va_get_reg 6 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 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ precedes_wrap (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way_body0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_6way_body0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_body0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 506 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 507 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 508 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 512 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 513 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 514 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 515 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 516 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 517 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 518 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 519 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 522 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 526 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 527 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 528 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 529 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 530 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 27 va_sM == 1 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 533 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 28 va_sM == 2 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 534 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 29 va_sM == 3 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 30 va_sM == 4 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 536 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 31 va_sM == 5 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 539 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 540 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 541 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 543 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 544 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 545 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (precedes_wrap (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 =!= va_get_reg 6 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ precedes_wrap (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way_body0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq 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_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way_body0 (va_code_Gctr_blocks128_6way_body0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_6way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body0 alg)) = (va_QProc (va_code_Gctr_blocks128_6way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys) (va_wpProof_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_6way_while0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_6way_while0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_while0 alg = (va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 6)) (va_Block (va_CCons (va_code_Gctr_blocks128_6way_body0 alg) (va_CNil ())))) (va_CNil ()))) val va_codegen_success_Gctr_blocks128_6way_while0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_while0 alg = (va_pbool_and (va_codegen_success_Gctr_blocks128_6way_body0 alg) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_while0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_while0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (out_b:buffer128) = va_in_out_b in let (plain_quads:(seq quad32)) = va_in_plain_quads in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_qWhile va_mods (Cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 6)) (fun va_g -> qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way_body0 va_old alg in_b key keys_b out_b plain_quads round_keys) (va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_get_ok va_s /\ (va_get_reg 6 va_s - va_get_reg 8 va_s) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s /\ va_get_reg 8 va_s <= va_get_reg 6 va_s) /\ va_get_vec 7 va_s == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 3 va_s) in_b (va_get_reg 8 va_s) (va_get_reg 6 va_s - va_get_reg 8 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) out_b (va_get_reg 8 va_s) (va_get_reg 6 va_s - va_get_reg 8 va_s) (va_get_mem_layout va_s) Secret /\ va_get_reg 3 va_s + 16 `op_Multiply` (va_get_reg 6 va_s - va_get_reg 8 va_s) < pow2_64 /\ va_get_reg 7 va_s + 16 `op_Multiply` (va_get_reg 6 va_s - va_get_reg 8 va_s) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) (va_get_reg 8 va_s) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_reg 6 va_s < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s) (va_get_mem_heaplet 0 va_s) (va_get_mem_layout va_s) /\ va_get_vec 8 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b)) key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) out_b) /\ va_get_reg 3 va_s == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s /\ va_get_reg 7 va_s == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s) (fun (va_s:va_state) va_g -> va_get_reg 6 va_s - va_get_reg 8 va_s) (())) (fun (va_s:va_state) va_g -> let va_g = () in va_QEmpty (())))) val va_lemma_Gctr_blocks128_6way_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_while0 alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 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 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ ~(va_get_reg 8 va_sM =!= va_get_reg 6 va_sM) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way_while0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_6way_while0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_while0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 506 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 507 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 508 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 512 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 513 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 514 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 515 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 516 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 517 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 518 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 519 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 522 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 526 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 527 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 528 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 529 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 530 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 27 va_sM == 1 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 533 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 28 va_sM == 2 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 534 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 29 va_sM == 3 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 30 va_sM == 4 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 536 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 31 va_sM == 5 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 539 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 540 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 541 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 543 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 544 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (~(va_get_reg 8 va_sM =!= va_get_reg 6 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ ~(va_get_reg 8 va_sM =!= va_get_reg 6 va_sM) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way_while0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq 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_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way_while0 (va_code_Gctr_blocks128_6way_while0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_6way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_while0 alg)) = (va_QProc (va_code_Gctr_blocks128_6way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys) (va_wpProof_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_6way #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_6way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way alg = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 1) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 9) 2) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 10) 3) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 11) 4) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 12) 5) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 13) 6) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 14) 0) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 9) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 10) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 11) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 13) 4) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 27) (1 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 28) (2 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 29) (3 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 30) (4 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 31) (5 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_CCons (va_code_Gctr_blocks128_6way_while0 alg) (va_CNil ())))))))))))))))))))))) val va_codegen_success_Gctr_blocks128_6way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way alg = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 1) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 9) 2) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 10) 3) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 11) 4) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 12) 5) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 13) 6) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 14) 0) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 9) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 10) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 11) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 13) 4) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 27) (1 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 28) (2 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 29) (3 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 30) (4 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 31) (5 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_pbool_and (va_codegen_success_Gctr_blocks128_6way_while0 alg) (va_ttrue ()))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_6way 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 479 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 8) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 480 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 9) 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 10) 3) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 11) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 483 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 12) 5) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 484 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 13) 6) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 14) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 8) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 9) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 10) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 11) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 490 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 491 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 13) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 493 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 27) (1 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 494 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 28) (2 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 495 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 29) (3 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 496 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 30) (4 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 497 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 31) (5 `op_Multiply` 16)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 499 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 8) 0) (fun (va_s:va_state) _ -> let (plain_quads:(seq quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 503 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way_while0 va_old_s alg in_b key keys_b out_b plain_quads round_keys) (va_QEmpty (()))))))))))))))))))))))) val va_lemma_Gctr_blocks128_6way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 `op_Modulus` 6 == 0 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 <= Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way va_b0 va_s0 alg in_b out_b key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_6way va_mods alg in_b out_b key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 467 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 469 column 151 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 472 column 146 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 473 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 474 column 67 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 476 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 477 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(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 /\ (va_get_reg 6 va_s0 `op_Modulus` 6 == 0 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 <= Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_r10:nat64) (va_x_r27:nat64) (va_x_r28:nat64) (va_x_r29:nat64) (va_x_r30:nat64) (va_x_r31:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_v11:quad32) (va_x_v12:quad32) (va_x_v13:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13 (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 31 va_x_r31 (va_upd_reg 30 va_x_r30 (va_upd_reg 29 va_x_r29 (va_upd_reg 28 va_x_r28 (va_upd_reg 27 va_x_r27 (va_upd_reg 10 va_x_r10 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_mem va_x_mem va_s0))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(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_Gctr_blocks128_6way alg in_b out_b key round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way alg in_b out_b key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way (va_code_Gctr_blocks128_6way alg) va_s0 alg in_b out_b key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; 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_Gctr_blocks128_6way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_6way alg)) = (va_QProc (va_code_Gctr_blocks128_6way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_mem]) (va_wp_Gctr_blocks128_6way alg in_b out_b key round_keys keys_b) (va_wpProof_Gctr_blocks128_6way alg in_b out_b key round_keys keys_b)) #pop-options //-- //-- mod_6 val va_code_mod_6 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_mod_6 () = (va_Block (va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 26) 21845) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) 21845) (va_CCons (va_code_Sl64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 26) 32) (va_CCons (va_code_Add (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (-1)) (va_CCons (va_code_Sub (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 26)) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) 1) (va_CCons (va_code_MulHigh64U (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_CCons (va_code_Sr64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 10) 2) (va_CCons (va_code_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 10)) (va_CCons (va_code_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10)) (va_CCons (va_code_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26)) (va_CCons (va_code_SubWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_CNil ()))))))))))))))) val va_codegen_success_mod_6 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_mod_6 () = (va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 26) 21845) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) 21845) (va_pbool_and (va_codegen_success_Sl64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 26) 32) (va_pbool_and (va_codegen_success_Add (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (-1)) (va_pbool_and (va_codegen_success_Sub (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 26)) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) 1) (va_pbool_and (va_codegen_success_MulHigh64U (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_pbool_and (va_codegen_success_Sr64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 10) 2) (va_pbool_and (va_codegen_success_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26)) (va_pbool_and (va_codegen_success_SubWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_ttrue ())))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_mod_6 (va_mods:va_mods_t) : (va_quickCode unit (va_code_mod_6 ())) = (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 565 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImmShl64 (va_op_reg_opr_reg 26) 21845) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 566 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 21845 16) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 567 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) 21845) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 568 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sl64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 26) 32) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 569 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 1431655765 32) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 570 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Add (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 571 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 10) (-1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 572 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sub (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 26)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 573 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) 1) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 574 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 26 va_s == 12297829382473034411) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 575 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_MulHigh64U (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (fun (va_s:va_state) _ -> let (va_arg23:Vale.Def.Types_s.nat64) = va_get_reg 10 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 576 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishr_64 va_arg23 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 577 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sr64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 10) 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 578 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 579 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 580 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 26)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 581 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_SubWrap (va_op_reg_opr_reg 26) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (fun (va_s:va_state) _ -> va_QLemma va_range1 "***** PRECONDITION NOT MET AT line 582 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (p:prop) -> normalize p) (va_get_reg 6 va_s `op_Modulus` 6 == va_get_reg 6 va_s - 6 `op_Multiply` (va_get_reg 6 va_s `op_Multiply` 12297829382473034411 `op_Division` pow2_64 `op_Division` 4))) (fun _ -> (fun (p:prop) -> p) (va_get_reg 6 va_s `op_Modulus` 6 == va_get_reg 6 va_s - 6 `op_Multiply` (va_get_reg 6 va_s `op_Multiply` 12297829382473034411 `op_Division` pow2_64 `op_Division` 4))) (fun (_:unit) -> assert_normalize (va_get_reg 6 va_s `op_Modulus` 6 == va_get_reg 6 va_s - 6 `op_Multiply` (va_get_reg 6 va_s `op_Multiply` 12297829382473034411 `op_Division` pow2_64 `op_Division` 4))) (va_QEmpty (()))))))))))))))))))))) val va_lemma_mod_6 : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_mod_6 ()) va_s0 /\ va_get_ok 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 26 va_sM == va_get_reg 6 va_sM `op_Modulus` 6 /\ va_state_eq va_sM (va_update_reg 10 va_sM (va_update_reg 26 va_sM (va_update_ok va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_mod_6 va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_reg 10; va_Mod_reg 26; va_Mod_ok] in let va_qc = va_qcode_mod_6 va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_mod_6 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 554 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 563 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 26 va_sM == va_get_reg 6 va_sM `op_Modulus` 6)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_reg 10; va_Mod_reg 26; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_mod_6 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (forall (va_x_r26:nat64) (va_x_r10:nat64) . let va_sM = va_upd_reg 10 va_x_r10 (va_upd_reg 26 va_x_r26 va_s0) in va_get_ok va_sM /\ va_get_reg 26 va_sM == va_get_reg 6 va_sM `op_Modulus` 6 ==> va_k va_sM (()))) val va_wpProof_mod_6 : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_mod_6 va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_mod_6 ()) ([va_Mod_reg 10; va_Mod_reg 26]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_mod_6 va_s0 va_k = let (va_sM, va_f0) = va_lemma_mod_6 (va_code_mod_6 ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_reg 10 va_sM (va_update_reg 26 va_sM (va_update_ok va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_reg 10; va_Mod_reg 26]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_mod_6 () : (va_quickCode unit (va_code_mod_6 ())) = (va_QProc (va_code_mod_6 ()) ([va_Mod_reg 10; va_Mod_reg 26]) va_wp_mod_6 va_wpProof_mod_6) //-- //-- Gctr_blocks128 #push-options "--z3rlimit 30" [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128 alg = (va_Block (va_CCons (va_code_mod_6 ()) (va_CCons (va_code_Sub (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_CCons (va_code_Gctr_blocks128_6way alg) (va_CCons (va_code_Gctr_blocks128_1way alg) (va_CCons (va_code_Sl64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 6) 4) (va_CCons (va_code_Sub (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Sub (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Add (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_CNil ())))))))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128 alg = (va_pbool_and (va_codegen_success_mod_6 ()) (va_pbool_and (va_codegen_success_Sub (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_pbool_and (va_codegen_success_Gctr_blocks128_6way alg) (va_pbool_and (va_codegen_success_Gctr_blocks128_1way alg) (va_pbool_and (va_codegen_success_Sl64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 6) 4) (va_pbool_and (va_codegen_success_Sub (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Sub (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Add (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_ttrue ()))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128 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 627 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_mod_6 ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 628 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sub (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 629 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way alg in_b out_b key round_keys keys_b) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 630 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way alg in_b out_b (va_get_vec 7 va_old_s) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in_b)) key round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 631 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.gctr_partial_reveal ()) (let (va_arg17:Vale.Def.Types_s.nat64) = va_get_reg 6 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 632 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.Types_helpers.lemma_ishl_64 va_arg17 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 633 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sl64Imm (va_op_reg_opr_reg 10) (va_op_reg_opr_reg 6) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 634 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sub (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 635 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Sub (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 636 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Add (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 26)) (va_QEmpty (())))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsStack.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Poly1305.Math.fsti.checked", "Vale.Lib.Basic.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.AES.fsti.checked", "Vale.AES.GCTR_BE_s.fst.checked", "Vale.AES.GCTR_BE.fsti.checked", "Vale.AES.GCM_helpers_BE.fsti.checked", "Vale.AES.AES_common_s.fst.checked", "Vale.AES.AES_BE_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GCTR.fst" }
[ { "abbrev": false, "full_module": "Vale.Lib.Basic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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": 30, "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 -> alg: Vale.AES.AES_common_s.algorithm -> in_b: Vale.PPC64LE.Memory.buffer128 -> out_b: Vale.PPC64LE.Memory.buffer128 -> key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 -> keys_b: Vale.PPC64LE.Memory.buffer128 -> 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.AES.AES_common_s.algorithm", "Vale.PPC64LE.Memory.buffer128", "FStar.Seq.Base.seq", "Vale.PPC64LE.Memory.nat32", "Vale.PPC64LE.Memory.quad32", "Vale.PPC64LE.QuickCodes.fuel", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet", "Vale.PPC64LE.QuickCode.va_Mod_cr0", "Vale.PPC64LE.QuickCode.va_Mod_vec", "Vale.PPC64LE.QuickCode.va_Mod_reg", "Vale.PPC64LE.QuickCode.va_Mod_ok", "Vale.PPC64LE.QuickCode.va_Mod_mem", "Prims.Nil", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.list", "Vale.PPC64LE.QuickCode.__proj__QProc__item__mods", "Vale.AES.PPC64LE.GCTR.va_code_Gctr_blocks128", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm", "Prims.l_and", "Vale.PPC64LE.QuickCodes.label", "Vale.PPC64LE.QuickCodes.va_range1", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Decls.modifies_buffer128", "Vale.PPC64LE.Decls.va_get_mem_heaplet", "Vale.AES.GCTR_BE.gctr_partial", "Vale.PPC64LE.Decls.va_get_reg", "Vale.Arch.Types.reverse_bytes_quad32_seq", "Vale.PPC64LE.Decls.s128", "Vale.PPC64LE.Decls.va_get_vec", "Vale.Def.Types_s.quad32", "Vale.AES.GCTR_BE.inc32lite", "Prims.l_imp", "Prims.int", "Vale.PPC64LE.Machine_s.quad32", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.QuickCode.quickCode", "Vale.AES.PPC64LE.GCTR.va_qcode_Gctr_blocks128" ]
[]
false
false
false
false
false
let va_lemma_Gctr_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b =
let va_mods:va_mods_t = [ va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 26; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 6; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem ] in let va_qc = va_qcode_Gctr_blocks128 va_mods alg in_b out_b key round_keys keys_b in let va_sM, va_fM, va_g = va_wp_sound_code_norm (va_code_Gctr_blocks128 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 585 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 618 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 621 column 147 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial alg (va_get_reg 6 va_s0) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 622 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 623 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 625 column 76 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (l_and (l_and (va_get_reg 3 va_sM == va_get_reg 3 va_s0) (va_get_reg 7 va_sM == va_get_reg 7 va_s0)) (va_get_reg 6 va_sM == va_get_reg 6 va_s0)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 26; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 6; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem ]) va_sM va_s0; (va_sM, va_fM)
false
Vale.AES.GF128.fst
Vale.AES.GF128.lemma_Mul128
val lemma_Mul128 (a b:poly) : Lemma (requires degree a < 128 /\ degree b < 128) (ensures ( let aL = mask a 64 in let bL = mask b 64 in let aH = shift a (-64) in let bH = shift b (-64) in a *. b == aL *. bL +. shift (aL *. bH +. aH *. bL) 64 +. shift (aH *. bH) 128 ))
val lemma_Mul128 (a b:poly) : Lemma (requires degree a < 128 /\ degree b < 128) (ensures ( let aL = mask a 64 in let bL = mask b 64 in let aH = shift a (-64) in let bH = shift b (-64) in a *. b == aL *. bL +. shift (aL *. bH +. aH *. bL) 64 +. shift (aH *. bH) 128 ))
let lemma_Mul128 a b = let aL = mask a 64 in let bL = mask b 64 in let aH = shift a (-64) in let bH = shift b (-64) in calc (==) { a *. b; == { lemma_bitwise_all (); lemma_equal a (aL +. shift aH 64); lemma_equal b (bL +. shift bH 64) } (aL +. shift aH 64) *. (bL +. shift bH 64); == {lemma_mul_distribute_left aL (shift aH 64) (bL +. shift bH 64)} aL *. (bL +. shift bH 64) +. shift aH 64 *. (bL +. shift bH 64); == {lemma_mul_distribute_right aL bL (shift bH 64)} aL *. bL +. aL *. shift bH 64 +. shift aH 64 *. (bL +. shift bH 64); == {lemma_mul_distribute_right (shift aH 64) bL (shift bH 64)} aL *. bL +. aL *. shift bH 64 +. (shift aH 64 *. bL +. shift aH 64 *. shift bH 64); == {lemma_add_all ()} aL *. bL +. (aL *. shift bH 64 +. shift aH 64 *. bL) +. shift aH 64 *. shift bH 64; == {lemma_shift_is_mul aH 64; lemma_shift_is_mul bH 64} aL *. bL +. (aL *. (bH *. monomial 64) +. aH *. monomial 64 *. bL) +. aH *. monomial 64 *. (bH *. monomial 64); == {lemma_mul_all ()} aL *. bL +. (aL *. bH *. monomial 64 +. aH *. bL *. monomial 64) +. aH *. bH *. (monomial 64 *. monomial 64); == {lemma_mul_monomials 64 64} aL *. bL +. (aL *. bH *. monomial 64 +. aH *. bL *. monomial 64) +. aH *. bH *. monomial 128; == {lemma_mul_distribute_left (aL *. bH) (aH *. bL) (monomial 64)} aL *. bL +. (aL *. bH +. aH *. bL) *. monomial 64 +. aH *. bH *. monomial 128; == {lemma_shift_is_mul (aL *. bH +. aH *. bL) 64; lemma_shift_is_mul (aH *. bH) 128} aL *. bL +. shift (aL *. bH +. aH *. bL) 64 +. shift (aH *. bH) 128; }
{ "file_name": "vale/code/crypto/aes/Vale.AES.GF128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 804, "start_col": 0, "start_line": 773 }
module Vale.AES.GF128 open FStar.Mul open Vale.Arch.TypesNative open Vale.Math.Poly2.Bits #reset-options "--z3rlimit 20" let lemma_shift_left_1 a = reveal_to_quad32 a; reveal_to_quad32 (shift a 1); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_reverse_define_all (); quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal (to_quad32 (shift a 1)) (quad32_shift_left_1 (to_quad32 a)); () let lemma_shift_2_left_1 lo hi = let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let (qlo', qhi') = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in reveal_to_quad32 lo; reveal_to_quad32 hi; reveal_to_quad32 (a' %. n); reveal_to_quad32 (a' /. n); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_add_define_all (); lemma_reverse_define_all (); lemma_div_mod a' n; lemma_shift_is_mul hi 128; lemma_shift_define hi 128; lemma_shift_is_mul (a' /. n) 128; let lemma_lo () : Lemma (qlo' == to_quad32 (a' %. n)) = lemma_shift_define (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qlo' (to_quad32 (a' %. n)) in let lemma_hi () : Lemma (qhi' == to_quad32 (a' /. n)) = lemma_shift_define_forward (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qhi' (to_quad32 (a' /. n)) in lemma_lo (); lemma_hi (); () #reset-options let lemma_reverse_reverse a n = lemma_reverse_define_all (); lemma_index_all (); lemma_equal a (reverse (reverse a n) n) let lemma_gf128_degree () = lemma_add_define_all (); lemma_monomial_define 128; lemma_degree_is gf128_modulus_low_terms 7; lemma_degree_is (monomial 128) 128; lemma_degree_is gf128_modulus 128; () let lemma_gf128_constant_rev q = let n0:nat32 = 0 in let n1:nat32 = 0 in let n2:nat32 = 0 in let n3:nat32 = 0xe1000000 in calc (==) { Mkfour n0 n1 n2 n3; == {lemma_quad32_of_nat32s n0 n1 n2 n3} to_quad32 (poly128_of_nat32s n0 n1 n2 n3); == { lemma_bitwise_all (); lemma_to_nat 32 (reverse gf128_modulus_low_terms 31) 0xe1000000; lemma_equal (poly128_of_nat32s n0 n1 n2 n3) (reverse gf128_modulus_low_terms 127) } to_quad32 (reverse gf128_modulus_low_terms 127); }; Vale.Arch.Types.lemma_quad32_xor () let lemma_quad32_double_hi_rev a = let ra = reverse a 127 in lemma_split_define ra 64; lemma_split_define_forward a 64; lemma_index_all (); lemma_add_define_all (); lemma_reverse_define_all (); lemma_equal (a /. monomial 64) (reverse ra 63); lemma_quad32_double a let lemma_gf128_mul a b c d n = let m = monomial n in let ab = a *. m +. b in let cd = c *. m +. d in let ac = a *. c in let ad = a *. d in let bc = b *. c in let bd = b *. d in let adh = ad /. m in let bch = bc /. m in let adl = ad %. m in let bcl = bc %. m in // ab *. cd // (a *. m +. b) *. (c *. m +. d) lemma_mul_distribute_right (a *. m +. b) (c *. m) d; lemma_mul_distribute_left (a *. m) b (c *. m); lemma_mul_distribute_left (a *. m) b d; // ((a *. m) *. (c *. m) +. b *. (c *. m)) +. ((a *. m) *. d +. b *. d); lemma_mul_associate b c m; lemma_mul_associate a m d; lemma_mul_commute m d; lemma_mul_associate a d m; lemma_mul_associate a m (c *. m); lemma_mul_associate m c m; lemma_mul_commute c m; lemma_mul_associate c m m; lemma_mul_associate a c (m *. m); // (ac *. (m *. m) +. bc *. m) +. (ad *. m +. bd) lemma_div_mod ad m; lemma_div_mod bc m; // (ac *. (m *. m) +. (bch *. m +. bcl) *. m) +. ((adh *. m +. adl) *. m +. bd) lemma_mul_distribute_left (bch *. m) bcl m; lemma_mul_distribute_left (adh *. m) adl m; // (ac *. (m *. m) +. (bch *. m *. m +. bcl *. m)) +. ((adh *. m *. m +. adl *. m) +. bd) lemma_mul_associate bch m m; lemma_mul_associate adh m m; // (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd) assert (ab *. cd == (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd)); lemma_add_define_all (); lemma_equal (ab *. cd) ((ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd)); // (ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd) lemma_mul_distribute_left ac bch (m *. m); lemma_mul_distribute_left (ac +. bch) adh (m *. m); // (ac +. bch +. adh) *. (m *. m) +. (bcl *. m +. adl *. m +. bd) lemma_mul_monomials n n; lemma_shift_is_mul (ac +. bch +. adh) (n + n); // shift (ac +. bch +. adh) (n + n) +. (bcl *. m +. adl *. m +. bd) () let lemma_gf128_reduce a b g n h = let ab = a *. b in let d = ab /. n in let m = ab %. n in let dh = d *. h in let d' = dh /. n in let m' = dh %. n in lemma_div_mod ab n; lemma_div_mod dh n; // ab == d *. n +. m // dh == d' *. n +. m' // ab % g // (d *. n +. m) % g lemma_add_define_all (); lemma_zero_define (); lemma_equal n (g +. h); // (d *. (g +. h) +. m) % g lemma_mul_distribute_right d g h; // (d *. g +. dh +. m) % g // (d *. g +. (d' *. n +. m') + m) % g // (d *. g +. (d' *. (g +. h) +. m') + m) % g lemma_mul_distribute_right d' g h; // (d *. g +. (d' *. g +. d' *. h +. m') + m) % g lemma_equal ab ((d *. g +. d' *. g) +. (d' *. h +. m' +. m)); lemma_mul_distribute_left d d' g; // ((d +. d') *. g +. (d' *. h +. m' +. m)) % g lemma_mod_distribute ((d +. d') *. g) (d' *. h +. m' +. m) g; lemma_div_mod_exact (d +. d') g; lemma_equal (ab %. g) ((d' *. h +. m' +. m) %. g); // (d' *. h +. m' +. m) % g lemma_mod_small (d' *. h +. m' +. m) g; // d' *. h +. m' +. m () #reset-options "--max_ifuel 0" let lemma_gf128_reduce_rev a b h n = let m = monomial n in let g = m +. h in lemma_gf128_reduce a b g m h; let r x = reverse x (n - 1) in let rr x = reverse x (2 * n - 1) in let ab = a *. b in let d = (a *. b) /. m in let dh = d *. h in let rab = rr (a *. b) in let rd = rab %. m in let rdh = rr (r rd *. h) in let rdhL = rdh %. m in let rdhLh = r (r rdhL *. h) in lemma_add_define_all (); lemma_reverse_define_all (); lemma_index_all (); lemma_split_define ab n; lemma_split_define_forward rab n; lemma_equal (r rd) d; lemma_split_define ab n; lemma_split_define_forward rab n; lemma_equal (rab /. m) (r (ab %. m)); lemma_split_define dh n; lemma_split_define_forward rdh n; lemma_equal (rdh /. m) (r (dh %. m)); lemma_equal (r rdhL) (dh /. m); lemma_equal rdhLh (r ((dh /. m) *. h)); lemma_equal (r ((a *. b) %. g)) (r ((dh /. m) *. h) +. r (dh %. m) +. r ((a *. b) %. m)); () val lemma_odd_reverse_shift_right (a:poly) (n:pos) : Lemma (requires degree a < n /\ a.[0]) (ensures shift (reverse a (n - 1)) 1 == monomial n +. reverse (shift a (-1)) (n - 1)) let lemma_odd_reverse_shift_right a n = lemma_bitwise_all (); lemma_equal (shift (reverse a (n - 1)) 1) (monomial n +. reverse (shift a (-1)) (n - 1)) val lemma_mul_odd_reverse_shift_right (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (a *. h) (n + n - 1) == reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1 )) let lemma_mul_odd_reverse_shift_right a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in calc (==) { reverse (a *. h) nn1; == {lemma_mul_reverse_shift_1 a h n1} shift (reverse a n1 *. reverse h n1) 1; == {lemma_shift_is_mul_left (reverse a n1 *. reverse h n1) 1} monomial 1 *. (reverse a n1 *. reverse h n1); == {lemma_mul_all ()} reverse a n1 *. (monomial 1 *. reverse h n1); == {lemma_shift_is_mul_left (reverse h n1) 1} reverse a n1 *. shift (reverse h n1) 1; == {lemma_odd_reverse_shift_right h n} reverse a n1 *. (m +. reverse (shift h (-1)) n1); == {lemma_mul_distribute_right (reverse a n1) m (reverse (shift h (-1)) n1)} reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1; } val lemma_mul_odd_reverse_shift_right_hi (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse ((a *. h) /. m) n1 == (reverse a n1 *. reverse (shift h (-1)) n1) %. m )) let lemma_mul_odd_reverse_shift_right_hi a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc (==) { reverse (ah /. m) n1; == {lemma_shift_is_div ah n} reverse (shift ah (-n)) n1; == {lemma_bitwise_all (); lemma_equal (reverse (shift ah (-n)) n1) (mask (reverse ah nn1) n)} mask (reverse ah nn1) n; == {lemma_mask_is_mod (reverse ah nn1) n} reverse ah nn1 %. m; == {lemma_mul_odd_reverse_shift_right a h n} (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_mod_distribute (reverse a n1 *. m) (reverse a n1 *. reverse (shift h (-1)) n1) m} (reverse a n1 *. m) %. m +. (reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_div_mod_exact (reverse a n1) m} zero +. (reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_add_all ()} (reverse a n1 *. reverse (shift h (-1)) n1) %. m; } val lemma_mul_odd_reverse_shift_right_lo_shift (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (((a *. h) %. m) *. m) (n + n - 1) == reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m )) let lemma_mul_odd_reverse_shift_right_lo_shift a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc (==) { reverse ((ah %. m) *. m) nn1; == {lemma_shift_is_mul (ah %. m) n; lemma_mask_is_mod ah n} reverse (shift (mask ah n) n) nn1; == { lemma_bitwise_all (); lemma_equal (reverse (shift (mask ah n) n) nn1) (shift (reverse ah nn1) (-n)) } shift (reverse ah nn1) (-n); == {lemma_mul_odd_reverse_shift_right a h n} shift (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1) (-n); == {lemma_shift_is_mul (reverse a n1) n} shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (-1)) n1) (-n); == { lemma_bitwise_all (); lemma_equal (shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (-1)) n1) (-n)) (reverse a n1 +. shift (reverse a n1 *. reverse (shift h (-1)) n1) (-n)) } reverse a n1 +. shift (reverse a n1 *. reverse (shift h (-1)) n1) (-n); == {lemma_shift_is_div (reverse a n1 *. reverse (shift h (-1)) n1) n} reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m; } val lemma_reduce_rev_hi (x3 x2 h:poly) (n:pos) : Lemma (requires degree x3 < n /\ degree x2 < n /\ degree (monomial (n + n) +. h) == n + n /\ degree h < n /\ h.[0] ) (ensures ( let nn = n + n in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) (n - 1) in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 (n - 1) in let y1 = reverse x2 (n - 1) in reverse (x32 %. g) (nn - 1) == (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n) )) let lemma_reduce_rev_hi x3 x2 h n = let n1 = n - 1 in let nn = n + n in let nn1 = n + n - 1 in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) n1 in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 n1 in let y1 = reverse x2 n1 in let x3h = x3 *. h in let x3hl = x3h %. m in let x3hh = x3h /. m in lemma_index_i h 0; calc (==) { ((x3 *. m +. x2) *. mm) %. (mm +. h); == {lemma_mod_reduce (x3 *. m +. x2) mm h} ((x3 *. m +. x2) *. h) %. (mm +. h); == {lemma_mul_distribute_left (x3 *. m) x2 h} (x3 *. m *. h +. x2 *. h) %. (mm +. h); == {lemma_mod_distribute (x3 *. m *. h) (x2 *. h) (mm +. h)} (x3 *. m *. h) %. (mm +. h) +. (x2 *. h) %. (mm +. h); == {lemma_mod_small (x2 *. h) (mm +. h)} (x3 *. m *. h) %. (mm +. h) +. x2 *. h; == {lemma_mul_all ()} (x3h *. m) %. (mm +. h) +. x2 *. h; == {lemma_div_mod x3h m} ((x3hh *. m +. x3hl) *. m) %. (mm +. h) +. x2 *. h; == {lemma_mul_distribute_left (x3hh *. m) x3hl m} (x3hh *. m *. m +. x3hl *. m) %. (mm +. h) +. x2 *. h; == {lemma_mod_distribute (x3hh *. m *. m) (x3hl *. m) (mm +. h)} (x3hh *. m *. m) %. (mm +. h) +. (x3hl *. m) %. (mm +. h) +. x2 *. h; == {lemma_mod_small (x3hl *. m) (mm +. h)} (x3hh *. m *. m) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mul_associate x3hh m m} (x3hh *. (m *. m)) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mul_monomials n n} (x3hh *. mm) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mod_reduce x3hh mm h} (x3hh *. h) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mod_small (x3hh *. h) (mm +. h)} x3hh *. h +. (x3hl *. m) +. x2 *. h; == {lemma_add_all ()} x3hh *. h +. x2 *. h +. (x3hl *. m); == {lemma_mul_distribute_left x3hh x2 h} (x3hh +. x2) *. h +. x3hl *. m; }; calc (==) { reverse (x32 %. g) nn1; == { // use the calc result from above (could put nested calc here, but it's slower) } reverse ((x3hh +. x2) *. h +. x3hl *. m) nn1; == {lemma_add_reverse ((x3hh +. x2) *. h) (x3hl *. m) nn1} reverse ((x3hh +. x2) *. h) nn1 +. reverse (x3hl *. m) nn1; == {lemma_mul_odd_reverse_shift_right_lo_shift x3 h n} reverse ((x3hh +. x2) *. h) nn1 +. (y0 +. (y0 *. c) /. m); == {lemma_mul_odd_reverse_shift_right (x3hh +. x2) h n} reverse (x3hh +. x2) n1 *. m +. reverse (x3hh +. x2) n1 *. c +. (y0 +. (y0 *. c) /. m); == {lemma_add_reverse x3hh x2 n1} (reverse x3hh n1 +. y1) *. m +. (reverse x3hh n1 +. y1) *. c +. (y0 +. (y0 *. c) /. m); == {lemma_mul_distribute_left (reverse x3hh n1) y1 c} (reverse x3hh n1 +. y1) *. m +. (reverse x3hh n1 *. c +. y1 *. c) +. (y0 +. (y0 *. c) /. m); == {lemma_mul_odd_reverse_shift_right_hi x3 h n} ((y0 *. c) %. m +. y1) *. m +. (((y0 *. c) %. m) *. c +. y1 *. c) +. (y0 +. (y0 *. c) /. m); == {lemma_mul_distribute_left ((y0 *. c) %. m) y1 c} ((y0 *. c) %. m +. y1) *. m +. ((y0 *. c) %. m +. y1) *. c +. (y0 +. (y0 *. c) /. m); == { lemma_shift_is_div (y0 *. c) n; lemma_mask_is_mod (y0 *. c) n; lemma_shift_is_mul ((y0 *. c) %. m +. y1) n } shift (mask (y0 *. c) n +. y1) n +. (mask (y0 *. c) n +. y1) *. c +. (y0 +. shift (y0 *. c) (-n)); == {lemma_add_all ()} (y1 +. mask (y0 *. c) n) *. c +. (shift (mask (y0 *. c) n +. y1) n +. (y0 +. shift (y0 *. c) (-n))); == { lemma_bitwise_all (); lemma_equal (shift (mask (y0 *. c) n +. y1) n +. (y0 +. shift (y0 *. c) (-n))) (shift y1 n +. y0 +. swap (y0 *. c) n) } (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n); } #reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0" let lemma_swap_right (a b:poly) (n:nat) : Lemma (requires n == 64 /\ degree a < n + n /\ degree b < n + n) (ensures swap (swap a n +. b) n == a +. swap b n) = lemma_bitwise_all (); lemma_equal (swap (swap a n +. b) n) (a +. swap b n) #reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0" let lemma_reduce_rev_bits (a0 a1 a2 c:poly) (n:pos) : Lemma (requires n == 64 /\ // verification times out unless n is known degree a0 < n + n /\ degree a1 < n + n /\ degree a2 < n + n /\ degree c < n ) (ensures ( let n1 = n - 1 in let nn = n + n in let nnn = nn + n in let rev a = reverse a (nn - 1) in let y_10 = a0 +. shift (mask a1 n) n in let y_0 = mask y_10 n in let y_10c = swap y_10 n +. y_0 *. c in let a = a0 +. shift a1 n +. shift a2 nn in let x = reverse a (nn + nn - 1) in let x0 = mask x n in let x1 = mask (shift x (-n)) n in let x2 = mask (shift x (-nn)) n in let x3 = shift x (-nnn) in let y0 = reverse x3 n1 in let y1 = reverse x2 n1 in (rev (x0 +. shift x1 n) +. ((y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n))) == (swap y_10c n +. (a2 +. shift a1 (-n)) +. mask y_10c n *. c) )) = let n1 = n - 1 in let nn = n + n in let nnn = nn + n in let rev a = reverse a (nn - 1) in let y_10 = a0 +. shift (mask a1 n) n in let y_0 = mask y_10 n in let y_10c = swap y_10 n +. y_0 *. c in let a = a0 +. shift a1 n +. shift a2 nn in let x = reverse a (nn + nn - 1) in let x0 = mask x n in let x1 = mask (shift x (-n)) n in let x2 = mask (shift x (-nn)) n in let x3 = shift x (-nnn) in let y0 = reverse x3 n1 in let y1 = reverse x2 n1 in calc (==) { y0; == {lemma_bitwise_all (); lemma_equal y0 y_0} y_0; }; calc (==) { shift y1 n +. y0; == {lemma_bitwise_all (); lemma_equal (shift y1 n +. y0) y_10} y_10; }; calc (==) { (shift y1 n +. y0 +. swap (y0 *. c) n); == {lemma_swap_right (shift y1 n +. y0) (y0 *. c) 64} swap (swap y_10 n +. y_0 *. c) n; }; calc (==) { rev (x0 +. shift x1 n); == {lemma_bitwise_all (); lemma_equal (rev (x0 +. shift x1 n)) (a2 +. shift a1 (-n))} a2 +. shift a1 (-n); }; calc (==) { y1 +. mask (y0 *. c) n; == {lemma_bitwise_all (); lemma_equal (y1 +. mask (y0 *. c) n) (mask y_10c n)} mask y_10c n; }; calc (==) { (rev (x0 +. shift x1 n) +. ((y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n))); == {lemma_add_all ()} (shift y1 n +. y0 +. swap (y0 *. c) n) +. rev (x0 +. shift x1 n) +. (y1 +. mask (y0 *. c) n) *. c; } #reset-options "--z3rlimit 20 --max_fuel 0 --max_ifuel 0" let lemma_reduce_rev a0 a1 a2 h n = (* <-----256 bits------> | a2 | + | a1 | + | a0 | ----------------------- = | y3 | y2 | y1 | y0 | | | y_10 | *) let n1 = n - 1 in let nn = n + n in let nnn = nn + n in let rev a = reverse a (nn - 1) in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) (n - 1) in let y_10 = a0 +. shift (mask a1 n) n in let y_0 = mask y_10 n in let y_10c = swap y_10 n +. y_0 *. c in let a = a0 +. shift a1 n +. shift a2 nn in let x = reverse a (nn + nn - 1) in let x0 = mask x n in let x1 = mask (shift x (-n)) n in let x2 = mask (shift x (-nn)) n in let x3 = shift x (-nnn) in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 n1 in let y1 = reverse x2 n1 in calc (==) { x %. g; == { lemma_bitwise_all (); lemma_equal x ((x0 +. shift x1 n) +. shift (x2 +. shift x3 n) nn) } ((x0 +. shift x1 n) +. shift (x2 +. shift x3 n) nn) %. g; == {lemma_mod_distribute (x0 +. shift x1 n) (shift (x2 +. shift x3 n) nn) g} (x0 +. shift x1 n) %. g +. shift (x2 +. shift x3 n) nn %. g; == {lemma_mod_small (x0 +. shift x1 n) g} x0 +. shift x1 n +. shift (x2 +. shift x3 n) nn %. g; }; calc (==) { rev (x %. g); == { lemma_bitwise_all (); lemma_equal (rev (x %. g)) (rev (x0 +. shift x1 n) +. rev (shift (x2 +. shift x3 n) nn %. g)) } rev (x0 +. shift x1 n) +. rev (shift (x2 +. shift x3 n) nn %. g); == {lemma_add_commute x2 (shift x3 n); lemma_shift_is_mul (x2 +. shift x3 n) nn; lemma_shift_is_mul x3 n} rev (x0 +. shift x1 n) +. rev (x32 %. g); == {lemma_reduce_rev_hi x3 x2 h n} rev (x0 +. shift x1 n) +. ((y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n)); == {lemma_reduce_rev_bits a0 a1 a2 c n} swap y_10c n +. (a2 +. shift a1 (-n)) +. mask y_10c n *. c; } let lemma_gf128_low_shift () = let n0:nat32 = 0 in let n1:nat32 = 0 in let n2:nat32 = 0 in let n3:nat32 = 0xc2000000 in let r3 = gf128_low_shift in calc (==) { shift (of_quad32 (Mkfour n0 n1 n2 n3)) (-64); == { calc (==) { Mkfour n0 n1 n2 n3; == {lemma_quad32_of_nat32s n0 n1 n2 n3} to_quad32 (poly128_of_nat32s n0 n1 n2 n3); == { lemma_bitwise_all (); lemma_to_nat 32 (reverse r3 31) n3; lemma_equal (poly128_of_nat32s n0 n1 n2 n3) (reverse r3 127) } to_quad32 (reverse r3 127); } } shift (of_quad32 (to_quad32 (reverse r3 127))) (-64); == {lemma_of_to_quad32 (reverse r3 127)} shift (reverse r3 127) (-64); == { lemma_bitwise_all (); lemma_equal (shift (reverse r3 127) (-64)) (reverse r3 63) } reverse r3 63; } let lemma_gf128_high_bit () = let n0:nat32 = 0 in let n1:nat32 = 0 in let n2:nat32 = 0 in let n3:nat32 = 0x80000000 in let a = monomial 127 in let a3 = monomial 31 in calc (==) { of_quad32 (Mkfour n0 n1 n2 n3); == {lemma_quad32_of_nat32s n0 n1 n2 n3} of_quad32 (to_quad32 (poly128_of_nat32s n0 n1 n2 n3)); == { lemma_bitwise_all (); lemma_to_nat 32 a3 n3; lemma_equal (poly128_of_nat32s n0 n1 n2 n3) a } of_quad32 (to_quad32 a); == {lemma_of_to_quad32 a} a; } let lemma_gf128_low_shift_1 () = let n0:nat32 = 1 in let n1:nat32 = 0 in let n2:nat32 = 0 in let n3:nat32 = 0xc2000000 in let a = reverse (shift (monomial 128 +. gf128_modulus_low_terms) (-1)) 127 in let a0 = one in let a3 = reverse gf128_low_shift 31 in calc (==) { of_quad32 (Mkfour n0 n1 n2 n3); == {lemma_quad32_of_nat32s n0 n1 n2 n3} of_quad32 (to_quad32 (poly128_of_nat32s n0 n1 n2 n3)); == { lemma_bitwise_all (); lemma_to_nat 32 a0 n0; lemma_to_nat 32 a3 n3; lemma_equal (poly128_of_nat32s n0 n1 n2 n3) a } of_quad32 (to_quad32 a); == {lemma_of_to_quad32 a} a; } let lemma_gf128_mul_rev_commute a b = lemma_mul_all () let lemma_gf128_mul_rev_associate a b c = let rev x = reverse x 127 in let ra = rev a in let rb = rev b in let rc = rev c in let g = gf128_modulus in lemma_gf128_degree (); calc (==) { a *~ (b *~ c); == {} rev (ra *. (rb *. rc %. g) %. g); == {lemma_mod_mul_mod_right ra (rb *. rc) g} rev (ra *. (rb *. rc) %. g); == {lemma_mul_associate ra rb rc} rev ((ra *. rb) *. rc %. g); == {lemma_mod_mul_mod (ra *. rb) g rc} rev ((ra *. rb %. g) *. rc %. g); == {} (a *~ b) *~ c; } let lemma_gf128_mul_rev_distribute_left a b c = let rev x = reverse x 127 in let ra = rev a in let rb = rev b in let rc = rev c in let g = gf128_modulus in lemma_gf128_degree (); calc (==) { (a +. b) *~ c; == {} rev (rev (a +. b) *. rc %. g); == {lemma_add_reverse a b 127} rev ((ra +. rb) *. rc %. g); == {lemma_mul_distribute_left ra rb rc} rev ((ra *. rc +. rb *. rc) %. g); == {lemma_mod_distribute (ra *. rc) (rb *. rc) g} rev (ra *. rc %. g +. rb *. rc %. g); == {lemma_add_reverse (ra *. rc %. g) (rb *. rc %. g) 127} rev (ra *. rc %. g) +. rev (rb *. rc %. g); == {} (a *~ c) +. (b *~ c); } let lemma_gf128_mul_rev_distribute_right a b c = calc (==) { a *~ (b +. c); == {lemma_gf128_mul_rev_commute a (b +. c)} (b +. c) *~ a; == {lemma_gf128_mul_rev_distribute_left b c a} b *~ a +. c *~ a; == {lemma_gf128_mul_rev_commute a b; lemma_gf128_mul_rev_commute a c} a *~ b +. a *~ c; } let lemma_add_mod_rev n a1 a2 b = let rev x = reverse x (n - 1) in let rev' x = reverse x (n + n - 1) in calc (==) { // mod_rev n (a1 +. a2) b; rev (rev' (a1 +. a2) %. b); == {lemma_add_reverse a1 a2 (n + n - 1)} rev ((rev' a1 +. rev' a2) %. b); == {lemma_mod_distribute (rev' a1) (rev' a2) b} rev (rev' a1 %. b +. rev' a2 %. b); == {lemma_add_reverse (rev' a1 %. b) (rev' a2 %. b) (n - 1)} rev (rev' a1 %. b) +. rev (rev' a2 %. b); // mod_rev n a1 b +. mod_rev n a2 b } let lemma_shift_key_1 n f h = let g = monomial n +. f in lemma_monomial_add_degree n f; let rev x = reverse x (n - 1) in let h1 = shift h 1 in let offset = reverse (shift g (-1)) (n - 1) in if h1.[n] then calc (==) { shift (rev (mask h1 n +. offset)) 1 %. g; == { lemma_bitwise_all (); lemma_equal (shift (rev (mask h1 n +. offset)) 1) (rev h +. g) } (rev h +. g) %. g; == {lemma_mod_distribute (rev h) g g; lemma_mod_cancel g; lemma_add_all ()} rev h %. g; } else calc (==) { shift (rev (mask h1 n +. zero)) 1 %. g; == { lemma_bitwise_all (); lemma_equal (shift (rev (mask h1 n +. zero)) 1) (rev h) } rev h %. g; } let lemma_test_high_bit a = calc (==) { of_nat ((to_quad32 (monomial 127)).hi3); == {lemma_quad32_extract_nat32s (monomial 127)} shift (monomial 127) (-96); }; calc (==) { of_nat (to_quad32 (poly_and a (monomial 127))).hi3; == {lemma_quad32_extract_nat32s (poly_and a (monomial 127))} shift (poly_and a (monomial 127)) (-96); }; if (shift (monomial 127) (-96) = shift (poly_and a (monomial 127)) (-96)) then ( of_nat32_eq (to_quad32 (poly_and a (monomial 127))).hi3 ((to_quad32 (monomial 127)).hi3); lemma_bitwise_all (); assert ((shift (monomial 127) (-96)).[31]); assert ((shift (poly_and a (monomial 127)) (-96)).[31]); assert (a.[127]); () ); if a.[127] then ( lemma_bitwise_all (); lemma_equal (shift (monomial 127) (-96)) (shift (poly_and a (monomial 127)) (-96)); () )
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.GF128.fst" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> FStar.Pervasives.Lemma (requires Vale.Math.Poly2_s.degree a < 128 /\ Vale.Math.Poly2_s.degree b < 128) (ensures (let aL = Vale.Math.Poly2.mask a 64 in let bL = Vale.Math.Poly2.mask b 64 in let aH = Vale.Math.Poly2_s.shift a (- 64) in let bH = Vale.Math.Poly2_s.shift b (- 64) in a *. b == aL *. bL +. Vale.Math.Poly2_s.shift (aL *. bH +. aH *. bL) 64 +. Vale.Math.Poly2_s.shift (aH *. bH) 128))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Math.Poly2_s.poly", "FStar.Calc.calc_finish", "Prims.eq2", "Vale.Math.Poly2.op_Star_Dot", "Vale.Math.Poly2.op_Plus_Dot", "Vale.Math.Poly2_s.shift", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "Vale.Math.Poly2_s.monomial", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Vale.Math.Poly2.lemma_equal", "Vale.Math.Poly2.Lemmas.lemma_bitwise_all", "Prims.squash", "Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left", "Vale.Math.Poly2.Lemmas.lemma_mul_distribute_right", "Vale.Math.Poly2.Lemmas.lemma_add_all", "Vale.Math.Poly2.lemma_shift_is_mul", "Vale.Math.Poly2.Lemmas.lemma_mul_all", "Vale.Math.Poly2.Lemmas.lemma_mul_monomials", "Prims.op_Minus", "Vale.Math.Poly2.mask" ]
[]
false
false
true
false
false
let lemma_Mul128 a b =
let aL = mask a 64 in let bL = mask b 64 in let aH = shift a (- 64) in let bH = shift b (- 64) in calc ( == ) { a *. b; ( == ) { (lemma_bitwise_all (); lemma_equal a (aL +. shift aH 64); lemma_equal b (bL +. shift bH 64)) } (aL +. shift aH 64) *. (bL +. shift bH 64); ( == ) { lemma_mul_distribute_left aL (shift aH 64) (bL +. shift bH 64) } aL *. (bL +. shift bH 64) +. shift aH 64 *. (bL +. shift bH 64); ( == ) { lemma_mul_distribute_right aL bL (shift bH 64) } aL *. bL +. aL *. shift bH 64 +. shift aH 64 *. (bL +. shift bH 64); ( == ) { lemma_mul_distribute_right (shift aH 64) bL (shift bH 64) } aL *. bL +. aL *. shift bH 64 +. (shift aH 64 *. bL +. shift aH 64 *. shift bH 64); ( == ) { lemma_add_all () } aL *. bL +. (aL *. shift bH 64 +. shift aH 64 *. bL) +. shift aH 64 *. shift bH 64; ( == ) { (lemma_shift_is_mul aH 64; lemma_shift_is_mul bH 64) } aL *. bL +. (aL *. (bH *. monomial 64) +. aH *. monomial 64 *. bL) +. aH *. monomial 64 *. (bH *. monomial 64); ( == ) { lemma_mul_all () } aL *. bL +. (aL *. bH *. monomial 64 +. aH *. bL *. monomial 64) +. aH *. bH *. (monomial 64 *. monomial 64); ( == ) { lemma_mul_monomials 64 64 } aL *. bL +. (aL *. bH *. monomial 64 +. aH *. bL *. monomial 64) +. aH *. bH *. monomial 128; ( == ) { lemma_mul_distribute_left (aL *. bH) (aH *. bL) (monomial 64) } aL *. bL +. (aL *. bH +. aH *. bL) *. monomial 64 +. aH *. bH *. monomial 128; ( == ) { (lemma_shift_is_mul (aL *. bH +. aH *. bL) 64; lemma_shift_is_mul (aH *. bH) 128) } aL *. bL +. shift (aL *. bH +. aH *. bL) 64 +. shift (aH *. bH) 128; }
false
Hacl.Bignum32.fst
Hacl.Bignum32.mont_ctx_free
val mont_ctx_free: MA.bn_field_free_st t_limbs
val mont_ctx_free: MA.bn_field_free_st t_limbs
let mont_ctx_free k = MA.bn_field_free k
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 20, "end_line": 61, "start_col": 0, "start_line": 60 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.MontArithmetic.bn_field_free_st Hacl.Bignum32.t_limbs
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.MontArithmetic.pbn_mont_ctx", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.MontArithmetic.bn_field_free", "Prims.unit" ]
[]
false
false
false
true
false
let mont_ctx_free k =
MA.bn_field_free k
false
Vale.AES.GF128.fst
Vale.AES.GF128.lemma_mul_odd_reverse_shift_right_lo_shift
val lemma_mul_odd_reverse_shift_right_lo_shift (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (((a *. h) %. m) *. m) (n + n - 1) == reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m ))
val lemma_mul_odd_reverse_shift_right_lo_shift (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (((a *. h) %. m) *. m) (n + n - 1) == reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m ))
let lemma_mul_odd_reverse_shift_right_lo_shift a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc (==) { reverse ((ah %. m) *. m) nn1; == {lemma_shift_is_mul (ah %. m) n; lemma_mask_is_mod ah n} reverse (shift (mask ah n) n) nn1; == { lemma_bitwise_all (); lemma_equal (reverse (shift (mask ah n) n) nn1) (shift (reverse ah nn1) (-n)) } shift (reverse ah nn1) (-n); == {lemma_mul_odd_reverse_shift_right a h n} shift (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1) (-n); == {lemma_shift_is_mul (reverse a n1) n} shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (-1)) n1) (-n); == { lemma_bitwise_all (); lemma_equal (shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (-1)) n1) (-n)) (reverse a n1 +. shift (reverse a n1 *. reverse (shift h (-1)) n1) (-n)) } reverse a n1 +. shift (reverse a n1 *. reverse (shift h (-1)) n1) (-n); == {lemma_shift_is_div (reverse a n1 *. reverse (shift h (-1)) n1) n} reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m; }
{ "file_name": "vale/code/crypto/aes/Vale.AES.GF128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 324, "start_col": 0, "start_line": 298 }
module Vale.AES.GF128 open FStar.Mul open Vale.Arch.TypesNative open Vale.Math.Poly2.Bits #reset-options "--z3rlimit 20" let lemma_shift_left_1 a = reveal_to_quad32 a; reveal_to_quad32 (shift a 1); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_reverse_define_all (); quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal (to_quad32 (shift a 1)) (quad32_shift_left_1 (to_quad32 a)); () let lemma_shift_2_left_1 lo hi = let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let (qlo', qhi') = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in reveal_to_quad32 lo; reveal_to_quad32 hi; reveal_to_quad32 (a' %. n); reveal_to_quad32 (a' /. n); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_add_define_all (); lemma_reverse_define_all (); lemma_div_mod a' n; lemma_shift_is_mul hi 128; lemma_shift_define hi 128; lemma_shift_is_mul (a' /. n) 128; let lemma_lo () : Lemma (qlo' == to_quad32 (a' %. n)) = lemma_shift_define (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qlo' (to_quad32 (a' %. n)) in let lemma_hi () : Lemma (qhi' == to_quad32 (a' /. n)) = lemma_shift_define_forward (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qhi' (to_quad32 (a' /. n)) in lemma_lo (); lemma_hi (); () #reset-options let lemma_reverse_reverse a n = lemma_reverse_define_all (); lemma_index_all (); lemma_equal a (reverse (reverse a n) n) let lemma_gf128_degree () = lemma_add_define_all (); lemma_monomial_define 128; lemma_degree_is gf128_modulus_low_terms 7; lemma_degree_is (monomial 128) 128; lemma_degree_is gf128_modulus 128; () let lemma_gf128_constant_rev q = let n0:nat32 = 0 in let n1:nat32 = 0 in let n2:nat32 = 0 in let n3:nat32 = 0xe1000000 in calc (==) { Mkfour n0 n1 n2 n3; == {lemma_quad32_of_nat32s n0 n1 n2 n3} to_quad32 (poly128_of_nat32s n0 n1 n2 n3); == { lemma_bitwise_all (); lemma_to_nat 32 (reverse gf128_modulus_low_terms 31) 0xe1000000; lemma_equal (poly128_of_nat32s n0 n1 n2 n3) (reverse gf128_modulus_low_terms 127) } to_quad32 (reverse gf128_modulus_low_terms 127); }; Vale.Arch.Types.lemma_quad32_xor () let lemma_quad32_double_hi_rev a = let ra = reverse a 127 in lemma_split_define ra 64; lemma_split_define_forward a 64; lemma_index_all (); lemma_add_define_all (); lemma_reverse_define_all (); lemma_equal (a /. monomial 64) (reverse ra 63); lemma_quad32_double a let lemma_gf128_mul a b c d n = let m = monomial n in let ab = a *. m +. b in let cd = c *. m +. d in let ac = a *. c in let ad = a *. d in let bc = b *. c in let bd = b *. d in let adh = ad /. m in let bch = bc /. m in let adl = ad %. m in let bcl = bc %. m in // ab *. cd // (a *. m +. b) *. (c *. m +. d) lemma_mul_distribute_right (a *. m +. b) (c *. m) d; lemma_mul_distribute_left (a *. m) b (c *. m); lemma_mul_distribute_left (a *. m) b d; // ((a *. m) *. (c *. m) +. b *. (c *. m)) +. ((a *. m) *. d +. b *. d); lemma_mul_associate b c m; lemma_mul_associate a m d; lemma_mul_commute m d; lemma_mul_associate a d m; lemma_mul_associate a m (c *. m); lemma_mul_associate m c m; lemma_mul_commute c m; lemma_mul_associate c m m; lemma_mul_associate a c (m *. m); // (ac *. (m *. m) +. bc *. m) +. (ad *. m +. bd) lemma_div_mod ad m; lemma_div_mod bc m; // (ac *. (m *. m) +. (bch *. m +. bcl) *. m) +. ((adh *. m +. adl) *. m +. bd) lemma_mul_distribute_left (bch *. m) bcl m; lemma_mul_distribute_left (adh *. m) adl m; // (ac *. (m *. m) +. (bch *. m *. m +. bcl *. m)) +. ((adh *. m *. m +. adl *. m) +. bd) lemma_mul_associate bch m m; lemma_mul_associate adh m m; // (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd) assert (ab *. cd == (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd)); lemma_add_define_all (); lemma_equal (ab *. cd) ((ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd)); // (ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd) lemma_mul_distribute_left ac bch (m *. m); lemma_mul_distribute_left (ac +. bch) adh (m *. m); // (ac +. bch +. adh) *. (m *. m) +. (bcl *. m +. adl *. m +. bd) lemma_mul_monomials n n; lemma_shift_is_mul (ac +. bch +. adh) (n + n); // shift (ac +. bch +. adh) (n + n) +. (bcl *. m +. adl *. m +. bd) () let lemma_gf128_reduce a b g n h = let ab = a *. b in let d = ab /. n in let m = ab %. n in let dh = d *. h in let d' = dh /. n in let m' = dh %. n in lemma_div_mod ab n; lemma_div_mod dh n; // ab == d *. n +. m // dh == d' *. n +. m' // ab % g // (d *. n +. m) % g lemma_add_define_all (); lemma_zero_define (); lemma_equal n (g +. h); // (d *. (g +. h) +. m) % g lemma_mul_distribute_right d g h; // (d *. g +. dh +. m) % g // (d *. g +. (d' *. n +. m') + m) % g // (d *. g +. (d' *. (g +. h) +. m') + m) % g lemma_mul_distribute_right d' g h; // (d *. g +. (d' *. g +. d' *. h +. m') + m) % g lemma_equal ab ((d *. g +. d' *. g) +. (d' *. h +. m' +. m)); lemma_mul_distribute_left d d' g; // ((d +. d') *. g +. (d' *. h +. m' +. m)) % g lemma_mod_distribute ((d +. d') *. g) (d' *. h +. m' +. m) g; lemma_div_mod_exact (d +. d') g; lemma_equal (ab %. g) ((d' *. h +. m' +. m) %. g); // (d' *. h +. m' +. m) % g lemma_mod_small (d' *. h +. m' +. m) g; // d' *. h +. m' +. m () #reset-options "--max_ifuel 0" let lemma_gf128_reduce_rev a b h n = let m = monomial n in let g = m +. h in lemma_gf128_reduce a b g m h; let r x = reverse x (n - 1) in let rr x = reverse x (2 * n - 1) in let ab = a *. b in let d = (a *. b) /. m in let dh = d *. h in let rab = rr (a *. b) in let rd = rab %. m in let rdh = rr (r rd *. h) in let rdhL = rdh %. m in let rdhLh = r (r rdhL *. h) in lemma_add_define_all (); lemma_reverse_define_all (); lemma_index_all (); lemma_split_define ab n; lemma_split_define_forward rab n; lemma_equal (r rd) d; lemma_split_define ab n; lemma_split_define_forward rab n; lemma_equal (rab /. m) (r (ab %. m)); lemma_split_define dh n; lemma_split_define_forward rdh n; lemma_equal (rdh /. m) (r (dh %. m)); lemma_equal (r rdhL) (dh /. m); lemma_equal rdhLh (r ((dh /. m) *. h)); lemma_equal (r ((a *. b) %. g)) (r ((dh /. m) *. h) +. r (dh %. m) +. r ((a *. b) %. m)); () val lemma_odd_reverse_shift_right (a:poly) (n:pos) : Lemma (requires degree a < n /\ a.[0]) (ensures shift (reverse a (n - 1)) 1 == monomial n +. reverse (shift a (-1)) (n - 1)) let lemma_odd_reverse_shift_right a n = lemma_bitwise_all (); lemma_equal (shift (reverse a (n - 1)) 1) (monomial n +. reverse (shift a (-1)) (n - 1)) val lemma_mul_odd_reverse_shift_right (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (a *. h) (n + n - 1) == reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1 )) let lemma_mul_odd_reverse_shift_right a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in calc (==) { reverse (a *. h) nn1; == {lemma_mul_reverse_shift_1 a h n1} shift (reverse a n1 *. reverse h n1) 1; == {lemma_shift_is_mul_left (reverse a n1 *. reverse h n1) 1} monomial 1 *. (reverse a n1 *. reverse h n1); == {lemma_mul_all ()} reverse a n1 *. (monomial 1 *. reverse h n1); == {lemma_shift_is_mul_left (reverse h n1) 1} reverse a n1 *. shift (reverse h n1) 1; == {lemma_odd_reverse_shift_right h n} reverse a n1 *. (m +. reverse (shift h (-1)) n1); == {lemma_mul_distribute_right (reverse a n1) m (reverse (shift h (-1)) n1)} reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1; } val lemma_mul_odd_reverse_shift_right_hi (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse ((a *. h) /. m) n1 == (reverse a n1 *. reverse (shift h (-1)) n1) %. m )) let lemma_mul_odd_reverse_shift_right_hi a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc (==) { reverse (ah /. m) n1; == {lemma_shift_is_div ah n} reverse (shift ah (-n)) n1; == {lemma_bitwise_all (); lemma_equal (reverse (shift ah (-n)) n1) (mask (reverse ah nn1) n)} mask (reverse ah nn1) n; == {lemma_mask_is_mod (reverse ah nn1) n} reverse ah nn1 %. m; == {lemma_mul_odd_reverse_shift_right a h n} (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_mod_distribute (reverse a n1 *. m) (reverse a n1 *. reverse (shift h (-1)) n1) m} (reverse a n1 *. m) %. m +. (reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_div_mod_exact (reverse a n1) m} zero +. (reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_add_all ()} (reverse a n1 *. reverse (shift h (-1)) n1) %. m; } val lemma_mul_odd_reverse_shift_right_lo_shift (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (((a *. h) %. m) *. m) (n + n - 1) == reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m ))
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.GF128.fst" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2_s.poly -> h: Vale.Math.Poly2_s.poly -> n: Prims.pos -> FStar.Pervasives.Lemma (requires Vale.Math.Poly2_s.degree h < n /\ Vale.Math.Poly2_s.degree a < n /\ h.[ 0 ]) (ensures (let n1 = n - 1 in let m = Vale.Math.Poly2_s.monomial n in Vale.Math.Poly2_s.reverse (a *. h %. m *. m) (n + n - 1) == Vale.Math.Poly2_s.reverse a n1 +. Vale.Math.Poly2_s.reverse a n1 *. Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift h (- 1)) n1 /. m))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Math.Poly2_s.poly", "Prims.pos", "FStar.Calc.calc_finish", "Prims.eq2", "Vale.Math.Poly2_s.reverse", "Vale.Math.Poly2.op_Star_Dot", "Vale.Math.Poly2.op_Percent_Dot", "Vale.Math.Poly2.op_Plus_Dot", "Vale.Math.Poly2.op_Slash_Dot", "Vale.Math.Poly2_s.shift", "Prims.op_Minus", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "Vale.Math.Poly2.mask", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Vale.Math.Poly2.Lemmas.lemma_mask_is_mod", "Vale.Math.Poly2.lemma_shift_is_mul", "Prims.squash", "Vale.Math.Poly2.lemma_equal", "Vale.Math.Poly2.Lemmas.lemma_bitwise_all", "Vale.AES.GF128.lemma_mul_odd_reverse_shift_right", "Vale.Math.Poly2.Lemmas.lemma_shift_is_div", "Vale.Math.Poly2_s.monomial", "Prims.int", "Prims.op_Subtraction", "Prims.op_Addition" ]
[]
false
false
true
false
false
let lemma_mul_odd_reverse_shift_right_lo_shift a h n =
let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc ( == ) { reverse ((ah %. m) *. m) nn1; ( == ) { (lemma_shift_is_mul (ah %. m) n; lemma_mask_is_mod ah n) } reverse (shift (mask ah n) n) nn1; ( == ) { (lemma_bitwise_all (); lemma_equal (reverse (shift (mask ah n) n) nn1) (shift (reverse ah nn1) (- n))) } shift (reverse ah nn1) (- n); ( == ) { lemma_mul_odd_reverse_shift_right a h n } shift (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (- 1)) n1) (- n); ( == ) { lemma_shift_is_mul (reverse a n1) n } shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (- 1)) n1) (- n); ( == ) { (lemma_bitwise_all (); lemma_equal (shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (- 1)) n1) (- n)) (reverse a n1 +. shift (reverse a n1 *. reverse (shift h (- 1)) n1) (- n))) } reverse a n1 +. shift (reverse a n1 *. reverse (shift h (- 1)) n1) (- n); ( == ) { lemma_shift_is_div (reverse a n1 *. reverse (shift h (- 1)) n1) n } reverse a n1 +. (reverse a n1 *. reverse (shift h (- 1)) n1) /. m; }
false
Hacl.Bignum32.fst
Hacl.Bignum32.lt_mask
val lt_mask: len:_ -> BN.bn_lt_mask_st t_limbs len
val lt_mask: len:_ -> BN.bn_lt_mask_st t_limbs len
let lt_mask len a b = BN.bn_lt_mask len a b
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 93, "start_col": 0, "start_line": 92 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res let new_bn_from_bytes_be r len b = BS.new_bn_from_bytes_be r len b let new_bn_from_bytes_le r len b = BS.new_bn_from_bytes_le r len b let bn_to_bytes_be len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_be false len b res let bn_to_bytes_le len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_le false len b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Lib.IntTypes.size_t -> Hacl.Bignum.bn_lt_mask_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.bn_lt_mask", "Hacl.Bignum.Definitions.limb" ]
[]
false
false
false
false
false
let lt_mask len a b =
BN.bn_lt_mask len a b
false
Hacl.Bignum32.fst
Hacl.Bignum32.new_bn_from_bytes_be
val new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs
val new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs
let new_bn_from_bytes_be r len b = BS.new_bn_from_bytes_be r len b
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 81, "start_col": 0, "start_line": 80 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.SafeAPI.new_bn_from_bytes_be_st Hacl.Bignum32.t_limbs
Prims.Tot
[ "total" ]
[]
[ "FStar.Monotonic.HyperHeap.rid", "Lib.IntTypes.size_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Bignum.SafeAPI.new_bn_from_bytes_be", "Hacl.Bignum32.t_limbs", "LowStar.Buffer.buffer", "Hacl.Bignum.Definitions.limb" ]
[]
false
false
false
true
false
let new_bn_from_bytes_be r len b =
BS.new_bn_from_bytes_be r len b
false
Hacl.Bignum32.fst
Hacl.Bignum32.eq_mask
val eq_mask: len:_ -> BN.bn_eq_mask_st t_limbs len
val eq_mask: len:_ -> BN.bn_eq_mask_st t_limbs len
let eq_mask len a b = BN.bn_eq_mask len a b
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 96, "start_col": 0, "start_line": 95 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res let new_bn_from_bytes_be r len b = BS.new_bn_from_bytes_be r len b let new_bn_from_bytes_le r len b = BS.new_bn_from_bytes_le r len b let bn_to_bytes_be len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_be false len b res let bn_to_bytes_le len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_le false len b res let lt_mask len a b = BN.bn_lt_mask len a b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Lib.IntTypes.size_t -> Hacl.Bignum.bn_eq_mask_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.bn_eq_mask", "Hacl.Bignum.Definitions.limb" ]
[]
false
false
false
false
false
let eq_mask len a b =
BN.bn_eq_mask len a b
false
Hacl.Bignum32.fst
Hacl.Bignum32.new_bn_from_bytes_le
val new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs
val new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs
let new_bn_from_bytes_le r len b = BS.new_bn_from_bytes_le r len b
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 84, "start_col": 0, "start_line": 83 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res let new_bn_from_bytes_be r len b = BS.new_bn_from_bytes_be r len b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.SafeAPI.new_bn_from_bytes_le_st Hacl.Bignum32.t_limbs
Prims.Tot
[ "total" ]
[]
[ "FStar.Monotonic.HyperHeap.rid", "Lib.IntTypes.size_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Bignum.SafeAPI.new_bn_from_bytes_le", "Hacl.Bignum32.t_limbs", "LowStar.Buffer.buffer", "Hacl.Bignum.Definitions.limb" ]
[]
false
false
false
true
false
let new_bn_from_bytes_le r len b =
BS.new_bn_from_bytes_le r len b
false
Vale.AES.PPC64LE.GCTR.fst
Vale.AES.PPC64LE.GCTR.va_lemma_Gctr_blocks128_6way
val va_lemma_Gctr_blocks128_6way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 `op_Modulus` 6 == 0 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 <= Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))
val va_lemma_Gctr_blocks128_6way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 `op_Modulus` 6 == 0 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 <= Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))
let va_lemma_Gctr_blocks128_6way va_b0 va_s0 alg in_b out_b key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_6way va_mods alg in_b out_b key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 467 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 469 column 151 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 472 column 146 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 473 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 474 column 67 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 476 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 477 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "file_name": "obj/Vale.AES.PPC64LE.GCTR.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 2692, "start_col": 0, "start_line": 2648 }
module Vale.AES.PPC64LE.GCTR open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.HeapImpl open FStar.Seq open Vale.AES.AES_BE_s open Vale.AES.PPC64LE.AES open Vale.AES.GCTR_BE_s open Vale.AES.GCTR_BE open Vale.AES.GCM_helpers_BE open Vale.Poly1305.Math open Vale.Def.Words.Two_s open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.InsStack open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.Types_helpers #reset-options "--z3rlimit 30" open Vale.Lib.Basic #reset-options "--z3rlimit 20" //-- Gctr_register [@ "opaque_to_smt" va_qattr] let va_code_Gctr_register alg = (va_Block (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CNil ())))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_register alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_register (va_mods:va_mods_t) (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_register alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE_s.inc32 (va_get_vec 7 va_s) 0 == va_get_vec 7 va_s) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 100 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 101 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock alg (va_get_vec 7 va_s) key round_keys keys_b) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 102 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (va_get_vec 7 va_s)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 102 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 0 va_s == Vale.AES.AES_BE_s.aes_encrypt_word alg key (va_get_vec 7 va_s)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun (va_s:va_state) _ -> let (va_arg15:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg14:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg13:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let (va_arg12:Vale.Def.Types_s.quad32) = va_get_vec 7 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 107 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.gctr_encrypt_one_block va_arg12 va_arg13 va_arg14 va_arg15) (va_QEmpty (())))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_register va_b0 va_s0 alg key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_Gctr_register va_mods alg key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_register alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 96 column 142 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE #Vale.Def.Words_s.nat32 (FStar.Seq.Base.create #quad32 1 (va_get_vec 1 va_sM))) == Vale.AES.GCTR_BE_s.gctr_encrypt (va_get_vec 7 va_sM) (Vale.Arch.Types.be_quad32_to_bytes (va_get_vec 1 va_s0)) alg key) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 1 va_sM == Vale.AES.GCTR_BE_s.gctr_encrypt_block (va_get_vec 7 va_sM) (va_get_vec 1 va_s0) alg key 0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Gctr_register alg key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_register (va_code_Gctr_register alg) va_s0 alg key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Gctr_blocks128_body_1way val va_code_Gctr_blocks128_body_1way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_body_1way alg = (va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret) (va_CNil ())))))))) val va_codegen_success_Gctr_blocks128_body_1way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_body_1way alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_body_1way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_body_1way alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 152 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 6 va_s + count))) (fun _ -> let (ctr_enc:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 6 va_s + count) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 6 va_s + count))) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 154 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 155 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock alg (va_get_vec 7 va_s) key round_keys keys_b) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 157 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret in_b (va_get_reg 6 va_s + count)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 158 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 159 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret out_b (va_get_reg 6 va_s + count)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 160 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 6 va_s + count) (va_get_mem_heaplet 1 va_s)) == ctr_enc) (let (va_arg24:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg23:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg22:Vale.Def.Types_s.quad32) = old_icb in let (va_arg21:Prims.nat) = va_get_reg 6 va_s + count in let (va_arg20:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg19:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) out_b) in let (va_arg18:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 162 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.lemma_eq_reverse_bytes_quad32_seq va_arg18 va_arg19 va_arg20 va_arg21 va_arg22 va_arg23 va_arg24) (va_QEmpty (()))))))))))) val va_lemma_Gctr_blocks128_body_1way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> count:nat -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_body_1way alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= count /\ count < va_get_reg 26 va_s0 /\ va_get_reg 9 va_s0 == count `op_Multiply` 16 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0 + count) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + count) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0 + count) /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_body_1way va_b0 va_s0 alg in_b out_b count old_icb key round_keys keys_b plain_quads = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_body_1way va_mods alg in_b out_b count old_icb key round_keys keys_b plain_quads in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_body_1way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 110 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 148 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 149 column 132 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 150 column 126 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_body_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= count /\ count < va_get_reg 26 va_s0 /\ va_get_reg 9 va_s0 == count `op_Multiply` 16 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0 + count) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + count) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0 + count) /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_body_1way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> count:nat -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq 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_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_body_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_body_1way (va_code_Gctr_blocks128_body_1way alg) va_s0 alg in_b out_b count old_icb key round_keys keys_b plain_quads in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; 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_Gctr_blocks128_body_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_body_1way alg)) = (va_QProc (va_code_Gctr_blocks128_body_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem]) (va_wp_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads) (va_wpProof_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads)) //-- //-- Mod_cr0 val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Mod_cr0 () = (va_Block (va_CNil ())) val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Mod_cr0 () = (va_ttrue ()) [@ "opaque_to_smt" va_qattr] let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (()))) val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Mod_cr0 ()) va_s0 /\ va_get_ok 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_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_Mod_cr0 va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in let va_qc = va_qcode_Mod_cr0 va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 165 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Mod_cr0 va_s0 va_k = let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) = (va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0) //-- //-- Gctr_blocks128_1way_body0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way_body0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way_body0 alg = (va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Gctr_blocks128_body_1way alg) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_CNil ()))))))) val va_codegen_success_Gctr_blocks128_1way_body0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way_body0 alg = (va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and (va_codegen_success_Gctr_blocks128_body_1way alg) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way_body0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_body0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (old_icb:quad32) = va_in_old_icb in let (old_plain:(seq quad32)) = va_in_old_plain in let (out_b:buffer128) = va_in_out_b in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 257 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Mod_cr0 ()) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 259 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_body_1way alg in_b out_b (va_get_reg 8 va_s) old_icb key round_keys keys_b old_plain) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 261 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 262 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 263 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_QEmpty (())))))))) val va_lemma_Gctr_blocks128_1way_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way_body0 alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way_body0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_1way_body0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way_body0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 229 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 230 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 231 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 235 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 236 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 237 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 238 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 239 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 240 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 241 column 143 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 242 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 245 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 248 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 252 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 253 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 254 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))) in va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way_body0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq 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_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way_body0 (va_code_Gctr_blocks128_1way_body0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_1way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_body0 alg)) = (va_QProc (va_code_Gctr_blocks128_1way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys) (va_wpProof_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_1way_while0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way_while0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way_while0 alg = (va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 26)) (va_Block (va_CCons (va_code_Gctr_blocks128_1way_body0 alg) (va_CNil ())))) (va_CNil ()))) val va_codegen_success_Gctr_blocks128_1way_while0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way_while0 alg = (va_pbool_and (va_codegen_success_Gctr_blocks128_1way_body0 alg) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way_while0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_while0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (old_icb:quad32) = va_in_old_icb in let (old_plain:(seq quad32)) = va_in_old_plain in let (out_b:buffer128) = va_in_out_b in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_qWhile va_mods (Cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 26)) (fun va_g -> qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way_body0 va_old alg in_b key keys_b old_icb old_plain out_b round_keys) (va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_get_ok va_s /\ (0 <= va_get_reg 8 va_s /\ va_get_reg 8 va_s <= va_get_reg 26 va_s) /\ va_get_reg 9 va_s == 16 `op_Multiply` va_get_reg 8 va_s /\ va_get_vec 7 va_s == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s + va_get_reg 8 va_s) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 3 va_s) in_b (va_get_reg 6 va_s) (va_get_reg 26 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) out_b (va_get_reg 6 va_s) (va_get_reg 26 va_s) (va_get_mem_layout va_s) Secret /\ va_get_reg 3 va_s + 16 `op_Multiply` va_get_reg 26 va_s < pow2_64 /\ va_get_reg 7 va_s + 16 `op_Multiply` va_get_reg 26 va_s < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b /\ (va_get_reg 8 va_s =!= va_get_reg 26 va_s ==> Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) (va_get_reg 6 va_s + va_get_reg 8 va_s) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ va_get_reg 6 va_s + va_get_reg 26 va_s < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s) (va_get_mem_heaplet 0 va_s) (va_get_mem_layout va_s) /\ va_get_vec 3 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s + va_get_reg 8 va_s) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b)) key old_icb /\ (va_get_reg 6 va_s + va_get_reg 26 va_s == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) out_b)) (fun (va_s:va_state) va_g -> va_get_reg 26 va_s - va_get_reg 8 va_s) (())) (fun (va_s:va_state) va_g -> let va_g = () in va_QEmpty (())))) val va_lemma_Gctr_blocks128_1way_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way_while0 alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ ~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way_while0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_1way_while0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way_while0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 229 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 230 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 231 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 235 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 236 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 237 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 238 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 239 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 240 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 241 column 143 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 242 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 245 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 248 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 252 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 253 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))) in va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ ~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way_while0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq 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_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way_while0 (va_code_Gctr_blocks128_1way_while0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_1way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_while0 alg)) = (va_QProc (va_code_Gctr_blocks128_1way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys) (va_wpProof_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_1way #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way alg = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 3) 1) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 4) 0) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_CCons (va_code_Gctr_blocks128_1way_while0 alg) (va_CNil ())))))))) val va_codegen_success_Gctr_blocks128_1way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way alg = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 3) 1) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 0) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_pbool_and (va_codegen_success_Gctr_blocks128_1way_while0 alg) (va_ttrue ()))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_1way 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 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 3) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 220 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 4) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 221 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 223 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 226 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way_while0 va_old_s alg in_b key keys_b old_icb old_plain out_b round_keys) (va_QEmpty (()))))))))) val va_lemma_Gctr_blocks128_1way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> old_plain:(seq quad32) -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way alg) va_s0 /\ va_get_ok va_s0 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM) /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 7 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way va_b0 va_s0 alg in_b out_b old_icb old_plain key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_1way va_mods alg in_b out_b old_icb old_plain key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 212 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 215 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 216 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 217 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(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 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb) /\ (forall (va_x_mem:vale_heap) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v7:quad32) (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 (va_upd_vec 7 va_x_v7 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_mem va_x_mem va_s0)))))))))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM) /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> old_plain:(seq quad32) -> key:(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_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way (va_code_Gctr_blocks128_1way alg) va_s0 alg in_b out_b old_icb old_plain key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 7 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; 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_Gctr_blocks128_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_1way alg)) = (va_QProc (va_code_Gctr_blocks128_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_mem]) (va_wp_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b) (va_wpProof_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b)) #pop-options //-- //-- Store_3blocks128_1 val va_code_Store_3blocks128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Store_3blocks128_1 () = (va_Block (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret) (va_CNil ()))))) val va_codegen_success_Store_3blocks128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Store_3blocks128_1 () = (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Store_3blocks128_1 (va_mods:va_mods_t) (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_1 ())) = (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 287 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret out_b (va_get_reg 8 va_s)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 288 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret out_b (va_get_reg 8 va_s + 1)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 289 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret out_b (va_get_reg 8 va_s + 2)) (va_QEmpty (())))))) val va_lemma_Store_3blocks128_1 : va_b0:va_code -> va_s0:va_state -> out_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_3blocks128_1 ()) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_Store_3blocks128_1 va_b0 va_s0 out_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Store_3blocks128_1 va_mods out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Store_3blocks128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 267 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 282 column 76 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 283 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 284 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Store_3blocks128_1 (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16) /\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Store_3blocks128_1 : out_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_Store_3blocks128_1 out_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_3blocks128_1 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Store_3blocks128_1 out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_3blocks128_1 (va_code_Store_3blocks128_1 ()) va_s0 out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; 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_Store_3blocks128_1 (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_1 ())) = (va_QProc (va_code_Store_3blocks128_1 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Store_3blocks128_1 out_b) (va_wpProof_Store_3blocks128_1 out_b)) //-- //-- Store_3blocks128_2 val va_code_Store_3blocks128_2 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Store_3blocks128_2 () = (va_Block (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret) (va_CNil ()))))) val va_codegen_success_Store_3blocks128_2 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Store_3blocks128_2 () = (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Store_3blocks128_2 (va_mods:va_mods_t) (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_2 ())) = (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 313 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret out_b (va_get_reg 8 va_s + 3)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 314 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret out_b (va_get_reg 8 va_s + 4)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 315 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret out_b (va_get_reg 8 va_s + 5)) (va_QEmpty (())))))) val va_lemma_Store_3blocks128_2 : va_b0:va_code -> va_s0:va_state -> out_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_3blocks128_2 ()) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_Store_3blocks128_2 va_b0 va_s0 out_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Store_3blocks128_2 va_mods out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Store_3blocks128_2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 80 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 310 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Store_3blocks128_2 (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16) /\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Store_3blocks128_2 : out_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_Store_3blocks128_2 out_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_3blocks128_2 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Store_3blocks128_2 out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_3blocks128_2 (va_code_Store_3blocks128_2 ()) va_s0 out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; 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_Store_3blocks128_2 (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_2 ())) = (va_QProc (va_code_Store_3blocks128_2 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Store_3blocks128_2 out_b) (va_wpProof_Store_3blocks128_2 out_b)) //-- //-- Gctr_blocks128_6way_body val va_code_Gctr_blocks128_6way_body : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_body alg = (va_Block (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_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (va_CCons (va_code_AESEncryptBlock_6way alg) (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_CCons (va_code_Store_3blocks128_1 ()) (va_CCons (va_code_Store_3blocks128_2 ()) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_CNil ()))))))))))))))))))))))))))))))))) val va_codegen_success_Gctr_blocks128_6way_body : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_body alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (va_pbool_and (va_codegen_success_AESEncryptBlock_6way alg) (va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Store_3blocks128_1 ()) (va_pbool_and (va_codegen_success_Store_3blocks128_2 ()) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_ttrue ())))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_body (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 383 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s))) (fun _ -> let (ctr_enc_0:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 384 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 1))) (fun _ -> let (ctr_enc_1:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 1) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 1))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 385 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 2))) (fun _ -> let (ctr_enc_2:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 2) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 2))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 386 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 3))) (fun _ -> let (ctr_enc_3:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 3) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 3))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 387 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 4))) (fun _ -> let (ctr_enc_4:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 4) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 4))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 388 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 5))) (fun _ -> let (ctr_enc_5:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 5) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 5))) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 390 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 391 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 392 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 393 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 394 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 395 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 397 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock_6way alg (va_get_vec 7 va_s) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 1) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 2) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 3) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 4) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 5) key round_keys keys_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 399 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret in_b (va_get_reg 8 va_s)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 400 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret in_b (va_get_reg 8 va_s + 1)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 401 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret in_b (va_get_reg 8 va_s + 2)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 402 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret in_b (va_get_reg 8 va_s + 3)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 403 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret in_b (va_get_reg 8 va_s + 4)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 404 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret in_b (va_get_reg 8 va_s + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 407 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store_3blocks128_1 out_b) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store_3blocks128_2 out_b) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 415 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s) (va_get_mem_heaplet 1 va_s)) == ctr_enc_0) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 1) (va_get_mem_heaplet 1 va_s)) == ctr_enc_1) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 417 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 2) (va_get_mem_heaplet 1 va_s)) == ctr_enc_2) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 418 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 3) (va_get_mem_heaplet 1 va_s)) == ctr_enc_3) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 419 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 4) (va_get_mem_heaplet 1 va_s)) == ctr_enc_4) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 420 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 5) (va_get_mem_heaplet 1 va_s)) == ctr_enc_5) (let (va_arg64:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg63:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg62:Vale.Def.Types_s.quad32) = old_icb in let (va_arg61:Prims.nat) = va_get_reg 8 va_s in let (va_arg60:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg59:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) out_b) in let (va_arg58:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 422 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.lemma_eq_reverse_bytes_quad32_seq va_arg58 va_arg59 va_arg60 va_arg61 va_arg62 va_arg63 va_arg64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 424 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 425 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 426 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 427 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))))) val va_lemma_Gctr_blocks128_6way_body : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way_body va_b0 va_s0 alg in_b out_b old_icb key round_keys keys_b plain_quads = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_6way_body va_mods alg in_b out_b old_icb key round_keys keys_b plain_quads in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_body alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 374 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 375 column 114 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 376 column 108 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 378 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 379 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 380 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 381 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way_body (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way_body : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq 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_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way_body alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way_body (va_code_Gctr_blocks128_6way_body alg) va_s0 alg in_b out_b old_icb key round_keys keys_b plain_quads in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; 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_Gctr_blocks128_6way_body (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body alg)) = (va_QProc (va_code_Gctr_blocks128_6way_body alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_mem]) (va_wp_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads) (va_wpProof_Gctr_blocks128_6way_body alg in_b out_b old_icb key round_keys keys_b plain_quads)) //-- //-- Gctr_blocks128_6way_body0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_6way_body0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_body0 alg = (va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Gctr_blocks128_6way_body alg) (va_CNil ())))) val va_codegen_success_Gctr_blocks128_6way_body0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_body0 alg = (va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and (va_codegen_success_Gctr_blocks128_6way_body alg) (va_ttrue ()))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_body0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (out_b:buffer128) = va_in_out_b in let (plain_quads:(seq quad32)) = va_in_plain_quads in let (round_keys:(seq quad32)) = va_in_round_keys in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 548 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Mod_cr0 ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 550 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way_body alg in_b out_b (va_get_vec 7 va_old) key round_keys keys_b plain_quads) (va_QEmpty (()))))) val va_lemma_Gctr_blocks128_6way_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body0 alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 =!= va_get_reg 6 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 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ precedes_wrap (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way_body0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_6way_body0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_body0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 506 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 507 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 508 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 512 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 513 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 514 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 515 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 516 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 517 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 518 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 519 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 522 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 526 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 527 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 528 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 529 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 530 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 27 va_sM == 1 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 533 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 28 va_sM == 2 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 534 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 29 va_sM == 3 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 30 va_sM == 4 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 536 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 31 va_sM == 5 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 539 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 540 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 541 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 543 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 544 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 545 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (precedes_wrap (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 =!= va_get_reg 6 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ precedes_wrap (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way_body0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq 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_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way_body0 (va_code_Gctr_blocks128_6way_body0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_6way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body0 alg)) = (va_QProc (va_code_Gctr_blocks128_6way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys) (va_wpProof_Gctr_blocks128_6way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_6way_while0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_6way_while0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_while0 alg = (va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 6)) (va_Block (va_CCons (va_code_Gctr_blocks128_6way_body0 alg) (va_CNil ())))) (va_CNil ()))) val va_codegen_success_Gctr_blocks128_6way_while0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_while0 alg = (va_pbool_and (va_codegen_success_Gctr_blocks128_6way_body0 alg) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_while0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_while0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (out_b:buffer128) = va_in_out_b in let (plain_quads:(seq quad32)) = va_in_plain_quads in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_qWhile va_mods (Cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 6)) (fun va_g -> qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way_body0 va_old alg in_b key keys_b out_b plain_quads round_keys) (va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_get_ok va_s /\ (va_get_reg 6 va_s - va_get_reg 8 va_s) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s /\ va_get_reg 8 va_s <= va_get_reg 6 va_s) /\ va_get_vec 7 va_s == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 3 va_s) in_b (va_get_reg 8 va_s) (va_get_reg 6 va_s - va_get_reg 8 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) out_b (va_get_reg 8 va_s) (va_get_reg 6 va_s - va_get_reg 8 va_s) (va_get_mem_layout va_s) Secret /\ va_get_reg 3 va_s + 16 `op_Multiply` (va_get_reg 6 va_s - va_get_reg 8 va_s) < pow2_64 /\ va_get_reg 7 va_s + 16 `op_Multiply` (va_get_reg 6 va_s - va_get_reg 8 va_s) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) (va_get_reg 8 va_s) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_reg 6 va_s < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s) (va_get_mem_heaplet 0 va_s) (va_get_mem_layout va_s) /\ va_get_vec 8 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b)) key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) out_b) /\ va_get_reg 3 va_s == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s /\ va_get_reg 7 va_s == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s) (fun (va_s:va_state) va_g -> va_get_reg 6 va_s - va_get_reg 8 va_s) (())) (fun (va_s:va_state) va_g -> let va_g = () in va_QEmpty (())))) val va_lemma_Gctr_blocks128_6way_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_while0 alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 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 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ ~(va_get_reg 8 va_sM =!= va_get_reg 6 va_sM) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_6way_while0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_6way_while0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_while0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 506 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 507 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 508 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 512 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 513 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 514 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 515 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 516 column 49 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 517 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 518 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 519 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 522 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 525 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 526 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 527 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 528 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 529 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 530 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 27 va_sM == 1 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 533 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 28 va_sM == 2 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 534 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 29 va_sM == 3 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 535 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 30 va_sM == 4 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 536 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 31 va_sM == 5 `op_Multiply` 16) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 539 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 540 column 113 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 541 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 543 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 544 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (~(va_get_reg 8 va_sM =!= va_get_reg 6 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_6way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 6 va_s0) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_s0 == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_reg 7 va_s0 == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r3:nat64) (va_x_r7:nat64) (va_x_r8:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v14:quad32) (va_x_v15:quad32) (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17 (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 8 va_x_r8 (va_upd_reg 7 va_x_r7 (va_upd_reg 3 va_x_r3 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM - va_get_reg 8 va_sM) `op_Modulus` 6 == 0 /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 6 va_sM) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_old) (va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 8 va_sM) (va_get_reg 6 va_sM - va_get_reg 8 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` (va_get_reg 6 va_sM - va_get_reg 8 va_sM) < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ Vale.AES.GCTR_BE.partial_seq_agreement va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b) /\ va_get_reg 6 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_sM == 1 `op_Multiply` 16 /\ va_get_reg 28 va_sM == 2 `op_Multiply` 16 /\ va_get_reg 29 va_sM == 3 `op_Multiply` 16 /\ va_get_reg 30 va_sM == 4 `op_Multiply` 16 /\ va_get_reg 31 va_sM == 5 `op_Multiply` 16 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) va_in_plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key (va_get_vec 7 va_old) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_old + 16 `op_Multiply` va_get_reg 8 va_sM /\ ~(va_get_reg 8 va_sM =!= va_get_reg 6 va_sM) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_6way_while0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_out_b:buffer128 -> va_in_plain_quads:(seq quad32) -> va_in_round_keys:(seq 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_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_6way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_6way_while0 (va_code_Gctr_blocks128_6way_while0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_6way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_out_b:buffer128) (va_in_plain_quads:(seq quad32)) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_while0 alg)) = (va_QProc (va_code_Gctr_blocks128_6way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys) (va_wpProof_Gctr_blocks128_6way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_out_b va_in_plain_quads va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_6way #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_6way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way alg = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 8) 1) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 9) 2) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 10) 3) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 11) 4) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 12) 5) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 13) 6) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 14) 0) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 8) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 9) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 10) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 11) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) 4) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 13) 4) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 27) (1 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 28) (2 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 29) (3 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 30) (4 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 31) (5 `op_Multiply` 16)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_CCons (va_code_Gctr_blocks128_6way_while0 alg) (va_CNil ())))))))))))))))))))))) val va_codegen_success_Gctr_blocks128_6way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way alg = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 8) 1) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 9) 2) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 10) 3) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 11) 4) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 12) 5) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 13) 6) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 14) 0) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 8) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 9) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 10) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 11) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) 4) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 13) 4) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 27) (1 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 28) (2 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 29) (3 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 30) (4 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 31) (5 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_pbool_and (va_codegen_success_Gctr_blocks128_6way_while0 alg) (va_ttrue ()))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_6way 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 479 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 8) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 480 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 9) 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 481 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 10) 3) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 482 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 11) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 483 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 12) 5) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 484 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 13) 6) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 485 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 14) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 486 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 8) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 9) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 488 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 10) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 11) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 490 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 12) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 491 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 13) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 493 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 27) (1 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 494 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 28) (2 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 495 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 29) (3 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 496 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 30) (4 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 497 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 31) (5 `op_Multiply` 16)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 499 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 8) 0) (fun (va_s:va_state) _ -> let (plain_quads:(seq quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 503 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_6way_while0 va_old_s alg in_b key keys_b out_b plain_quads round_keys) (va_QEmpty (()))))))))))))))))))))))) val va_lemma_Gctr_blocks128_6way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 6 va_s0 `op_Modulus` 6 == 0 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 <= Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0) /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0) /\ (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 6 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsStack.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Poly1305.Math.fsti.checked", "Vale.Lib.Basic.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.AES.fsti.checked", "Vale.AES.GCTR_BE_s.fst.checked", "Vale.AES.GCTR_BE.fsti.checked", "Vale.AES.GCM_helpers_BE.fsti.checked", "Vale.AES.AES_common_s.fst.checked", "Vale.AES.AES_BE_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GCTR.fst" }
[ { "abbrev": false, "full_module": "Vale.Lib.Basic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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": 30, "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 -> alg: Vale.AES.AES_common_s.algorithm -> in_b: Vale.PPC64LE.Memory.buffer128 -> out_b: Vale.PPC64LE.Memory.buffer128 -> key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 -> keys_b: Vale.PPC64LE.Memory.buffer128 -> 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.AES.AES_common_s.algorithm", "Vale.PPC64LE.Memory.buffer128", "FStar.Seq.Base.seq", "Vale.PPC64LE.Memory.nat32", "Vale.PPC64LE.Memory.quad32", "Vale.PPC64LE.QuickCodes.fuel", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet", "Vale.PPC64LE.QuickCode.va_Mod_cr0", "Vale.PPC64LE.QuickCode.va_Mod_vec", "Vale.PPC64LE.QuickCode.va_Mod_reg", "Vale.PPC64LE.QuickCode.va_Mod_ok", "Vale.PPC64LE.QuickCode.va_Mod_mem", "Prims.Nil", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.list", "Vale.PPC64LE.QuickCode.__proj__QProc__item__mods", "Vale.AES.PPC64LE.GCTR.va_code_Gctr_blocks128_6way", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm", "Prims.l_and", "Vale.PPC64LE.QuickCodes.label", "Vale.PPC64LE.QuickCodes.va_range1", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Decls.modifies_buffer128", "Vale.PPC64LE.Decls.va_get_mem_heaplet", "Vale.AES.GCTR_BE.partial_seq_agreement", "Vale.Arch.Types.reverse_bytes_quad32_seq", "Vale.PPC64LE.Decls.s128", "Vale.PPC64LE.Decls.va_get_reg", "Vale.PPC64LE.Decls.buffer_length", "Vale.PPC64LE.Memory.vuint128", "Vale.AES.GCTR_BE.gctr_partial_def", "Vale.PPC64LE.Decls.va_get_vec", "Vale.Def.Types_s.quad32", "Vale.AES.GCTR_BE.inc32lite", "Prims.l_imp", "Prims.int", "Vale.PPC64LE.Machine_s.quad32", "Prims.op_Addition", "Prims.op_Multiply", "Vale.PPC64LE.QuickCode.quickCode", "Vale.AES.PPC64LE.GCTR.va_qcode_Gctr_blocks128_6way" ]
[]
false
false
false
false
false
let va_lemma_Gctr_blocks128_6way va_b0 va_s0 alg in_b out_b key round_keys keys_b =
let va_mods:va_mods_t = [ va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem ] in let va_qc = va_qcode_Gctr_blocks128_6way va_mods alg in_b out_b key round_keys keys_b in let va_sM, va_fM, va_g = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 467 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 469 column 151 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 472 column 146 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key (va_get_vec 7 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 473 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s0) (va_get_reg 6 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 474 column 67 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 476 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 477 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 31; va_Mod_reg 30; va_Mod_reg 29; va_Mod_reg 28; va_Mod_reg 27; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem ]) va_sM va_s0; (va_sM, va_fM)
false
Steel.Closure.fst
Steel.Closure.ctr
val ctr : r: Steel.Reference.ref Prims.int -> Type0
let ctr (r:ref int) = prev:erased int -> SteelT (y:int{y == prev + 1}) (repr r prev) (repr r)
{ "file_name": "lib/steel/Steel.Closure.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 94, "end_line": 28, "start_col": 0, "start_line": 28 }
(* Copyright 2020 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.Closure open Steel.Memory open Steel.Effect.Atomic open Steel.Effect open Steel.Reference open Steel.FractionalPermission [@@__reduce__] let repr (r:ref int) (x:int) = pts_to r full_perm (hide x)
{ "checked_file": "/", "dependencies": [ "Steel.Reference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Steel.Closure.fst" }
[ { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
r: Steel.Reference.ref Prims.int -> Type0
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Prims.int", "FStar.Ghost.erased", "Prims.eq2", "Prims.op_Addition", "FStar.Ghost.reveal", "Steel.Closure.repr" ]
[]
false
false
false
true
true
let ctr (r: ref int) =
prev: erased int -> SteelT (y: int{y == prev + 1}) (repr r prev) (repr r)
false
Steel.Closure.fst
Steel.Closure.repr
val repr : r: Steel.Reference.ref Prims.int -> x: Prims.int -> Steel.Effect.Common.vprop
let repr (r:ref int) (x:int) = pts_to r full_perm (hide x)
{ "file_name": "lib/steel/Steel.Closure.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 58, "end_line": 26, "start_col": 0, "start_line": 26 }
(* Copyright 2020 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.Closure open Steel.Memory open Steel.Effect.Atomic open Steel.Effect open Steel.Reference open Steel.FractionalPermission
{ "checked_file": "/", "dependencies": [ "Steel.Reference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Steel.Closure.fst" }
[ { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
r: Steel.Reference.ref Prims.int -> x: Prims.int -> Steel.Effect.Common.vprop
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Prims.int", "Steel.Reference.pts_to", "Steel.FractionalPermission.full_perm", "Steel.Effect.Common.vprop" ]
[]
false
false
false
true
false
let repr (r: ref int) (x: int) =
pts_to r full_perm (hide x)
false
Hacl.Bignum32.fst
Hacl.Bignum32.add_mod
val add_mod: len:BN.meta_len t_limbs -> BN.bn_add_mod_n_st t_limbs len
val add_mod: len:BN.meta_len t_limbs -> BN.bn_add_mod_n_st t_limbs len
let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 30, "start_col": 0, "start_line": 29 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.bn_add_mod_n_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.__proj__Mkbn__item__add_mod_n", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn", "Hacl.Bignum32.ke", "Prims.unit" ]
[]
false
false
false
false
false
let add_mod len n a b res =
(ke len).BE.bn.BN.add_mod_n n a b res
false
HoareSTFree.fst
HoareSTFree.act_p
val act_p (#st #a: Type) (a_p: mpre st) (a_q: mpost st a) (k_p: (a -> mpre st)) : mpre st
val act_p (#st #a: Type) (a_p: mpre st) (a_q: mpost st a) (k_p: (a -> mpre st)) : mpre st
let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1)
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 70, "end_line": 61, "start_col": 0, "start_line": 60 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a_p: HoareSTFree.mpre st -> a_q: HoareSTFree.mpost st a -> k_p: (_: a -> HoareSTFree.mpre st) -> HoareSTFree.mpre st
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.mpre", "HoareSTFree.mpost", "Prims.l_and", "Prims.l_Forall", "Prims.l_imp" ]
[]
false
false
false
true
false
let act_p (#st #a: Type) (a_p: mpre st) (a_q: mpost st a) (k_p: (a -> mpre st)) : mpre st =
fun s0 -> a_p s0 /\ (forall (x: a) (s1: st). a_q s0 x s1 ==> k_p x s1)
false
HoareSTFree.fst
HoareSTFree.strengthen_pre
val strengthen_pre (#st: Type) (p: mpre st) (phi: pure_pre) : mpre st
val strengthen_pre (#st: Type) (p: mpre st) (phi: pure_pre) : mpre st
let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 21, "end_line": 80, "start_col": 0, "start_line": 79 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
p: HoareSTFree.mpre st -> phi: Prims.pure_pre -> HoareSTFree.mpre st
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.mpre", "Prims.pure_pre", "Prims.l_and" ]
[]
false
false
false
true
false
let strengthen_pre (#st: Type) (p: mpre st) (phi: pure_pre) : mpre st =
fun s -> p s /\ phi
false
HoareSTFree.fst
HoareSTFree.act_q
val act_q (#st #a #b: Type) (a_q: mpost st a) (k_q: (a -> mpost st b)) : mpost st b
val act_q (#st #a #b: Type) (a_q: mpost st a) (k_q: (a -> mpost st b)) : mpost st b
let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 67, "end_line": 65, "start_col": 0, "start_line": 64 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a_q: HoareSTFree.mpost st a -> k_q: (_: a -> HoareSTFree.mpost st b) -> HoareSTFree.mpost st b
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.mpost", "Prims.l_Exists", "Prims.l_and" ]
[]
false
false
false
true
false
let act_q (#st #a #b: Type) (a_q: mpost st a) (k_q: (a -> mpost st b)) : mpost st b =
fun s0 y s2 -> exists (x: a) (s1: st). a_q s0 x s1 /\ k_q x s1 y s2
false
Hacl.Bignum32.fst
Hacl.Bignum32.bn_slow_precomp
val bn_slow_precomp (len: BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len
val bn_slow_precomp (len: BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len
let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len)
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 43, "start_col": 0, "start_line": 42 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.ModReduction.bn_mod_slow_precomp_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.ModReduction.bn_mod_slow_precomp", "Hacl.Bignum32.kam", "Hacl.Bignum.ModReduction.bn_mod_slow_precomp_st" ]
[]
false
false
false
false
false
let bn_slow_precomp (len: BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len =
BR.bn_mod_slow_precomp (kam len)
false
HoareSTFree.fst
HoareSTFree.weaken_ok
val weaken_ok (#st #a: Type) (p0: mpre st) (q0: mpost st a) (p1: mpre st) (q1: mpost st a) : Type0
val weaken_ok (#st #a: Type) (p0: mpre st) (q0: mpost st a) (p1: mpre st) (q1: mpost st a) : Type0
let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1)
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 69, "end_line": 73, "start_col": 0, "start_line": 71 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
p0: HoareSTFree.mpre st -> q0: HoareSTFree.mpost st a -> p1: HoareSTFree.mpre st -> q1: HoareSTFree.mpost st a -> Type0
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.mpre", "HoareSTFree.mpost", "Prims.l_and", "Prims.l_Forall", "Prims.l_imp" ]
[]
false
false
false
true
true
let weaken_ok (#st #a: Type) (p0: mpre st) (q0: mpost st a) (p1: mpre st) (q1: mpost st a) : Type0 =
(forall (s: st). p1 s ==> p0 s) /\ (forall (s0: st) (x: a) (s1: st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1)
false
Vale.AES.GF128.fst
Vale.AES.GF128.lemma_reduce_rev_hi
val lemma_reduce_rev_hi (x3 x2 h:poly) (n:pos) : Lemma (requires degree x3 < n /\ degree x2 < n /\ degree (monomial (n + n) +. h) == n + n /\ degree h < n /\ h.[0] ) (ensures ( let nn = n + n in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) (n - 1) in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 (n - 1) in let y1 = reverse x2 (n - 1) in reverse (x32 %. g) (nn - 1) == (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n) ))
val lemma_reduce_rev_hi (x3 x2 h:poly) (n:pos) : Lemma (requires degree x3 < n /\ degree x2 < n /\ degree (monomial (n + n) +. h) == n + n /\ degree h < n /\ h.[0] ) (ensures ( let nn = n + n in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) (n - 1) in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 (n - 1) in let y1 = reverse x2 (n - 1) in reverse (x32 %. g) (nn - 1) == (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n) ))
let lemma_reduce_rev_hi x3 x2 h n = let n1 = n - 1 in let nn = n + n in let nn1 = n + n - 1 in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) n1 in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 n1 in let y1 = reverse x2 n1 in let x3h = x3 *. h in let x3hl = x3h %. m in let x3hh = x3h /. m in lemma_index_i h 0; calc (==) { ((x3 *. m +. x2) *. mm) %. (mm +. h); == {lemma_mod_reduce (x3 *. m +. x2) mm h} ((x3 *. m +. x2) *. h) %. (mm +. h); == {lemma_mul_distribute_left (x3 *. m) x2 h} (x3 *. m *. h +. x2 *. h) %. (mm +. h); == {lemma_mod_distribute (x3 *. m *. h) (x2 *. h) (mm +. h)} (x3 *. m *. h) %. (mm +. h) +. (x2 *. h) %. (mm +. h); == {lemma_mod_small (x2 *. h) (mm +. h)} (x3 *. m *. h) %. (mm +. h) +. x2 *. h; == {lemma_mul_all ()} (x3h *. m) %. (mm +. h) +. x2 *. h; == {lemma_div_mod x3h m} ((x3hh *. m +. x3hl) *. m) %. (mm +. h) +. x2 *. h; == {lemma_mul_distribute_left (x3hh *. m) x3hl m} (x3hh *. m *. m +. x3hl *. m) %. (mm +. h) +. x2 *. h; == {lemma_mod_distribute (x3hh *. m *. m) (x3hl *. m) (mm +. h)} (x3hh *. m *. m) %. (mm +. h) +. (x3hl *. m) %. (mm +. h) +. x2 *. h; == {lemma_mod_small (x3hl *. m) (mm +. h)} (x3hh *. m *. m) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mul_associate x3hh m m} (x3hh *. (m *. m)) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mul_monomials n n} (x3hh *. mm) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mod_reduce x3hh mm h} (x3hh *. h) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; == {lemma_mod_small (x3hh *. h) (mm +. h)} x3hh *. h +. (x3hl *. m) +. x2 *. h; == {lemma_add_all ()} x3hh *. h +. x2 *. h +. (x3hl *. m); == {lemma_mul_distribute_left x3hh x2 h} (x3hh +. x2) *. h +. x3hl *. m; }; calc (==) { reverse (x32 %. g) nn1; == { // use the calc result from above (could put nested calc here, but it's slower) } reverse ((x3hh +. x2) *. h +. x3hl *. m) nn1; == {lemma_add_reverse ((x3hh +. x2) *. h) (x3hl *. m) nn1} reverse ((x3hh +. x2) *. h) nn1 +. reverse (x3hl *. m) nn1; == {lemma_mul_odd_reverse_shift_right_lo_shift x3 h n} reverse ((x3hh +. x2) *. h) nn1 +. (y0 +. (y0 *. c) /. m); == {lemma_mul_odd_reverse_shift_right (x3hh +. x2) h n} reverse (x3hh +. x2) n1 *. m +. reverse (x3hh +. x2) n1 *. c +. (y0 +. (y0 *. c) /. m); == {lemma_add_reverse x3hh x2 n1} (reverse x3hh n1 +. y1) *. m +. (reverse x3hh n1 +. y1) *. c +. (y0 +. (y0 *. c) /. m); == {lemma_mul_distribute_left (reverse x3hh n1) y1 c} (reverse x3hh n1 +. y1) *. m +. (reverse x3hh n1 *. c +. y1 *. c) +. (y0 +. (y0 *. c) /. m); == {lemma_mul_odd_reverse_shift_right_hi x3 h n} ((y0 *. c) %. m +. y1) *. m +. (((y0 *. c) %. m) *. c +. y1 *. c) +. (y0 +. (y0 *. c) /. m); == {lemma_mul_distribute_left ((y0 *. c) %. m) y1 c} ((y0 *. c) %. m +. y1) *. m +. ((y0 *. c) %. m +. y1) *. c +. (y0 +. (y0 *. c) /. m); == { lemma_shift_is_div (y0 *. c) n; lemma_mask_is_mod (y0 *. c) n; lemma_shift_is_mul ((y0 *. c) %. m +. y1) n } shift (mask (y0 *. c) n +. y1) n +. (mask (y0 *. c) n +. y1) *. c +. (y0 +. shift (y0 *. c) (-n)); == {lemma_add_all ()} (y1 +. mask (y0 *. c) n) *. c +. (shift (mask (y0 *. c) n +. y1) n +. (y0 +. shift (y0 *. c) (-n))); == { lemma_bitwise_all (); lemma_equal (shift (mask (y0 *. c) n +. y1) n +. (y0 +. shift (y0 *. c) (-n))) (shift y1 n +. y0 +. swap (y0 *. c) n) } (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n); }
{ "file_name": "vale/code/crypto/aes/Vale.AES.GF128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 428, "start_col": 0, "start_line": 346 }
module Vale.AES.GF128 open FStar.Mul open Vale.Arch.TypesNative open Vale.Math.Poly2.Bits #reset-options "--z3rlimit 20" let lemma_shift_left_1 a = reveal_to_quad32 a; reveal_to_quad32 (shift a 1); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_reverse_define_all (); quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal (to_quad32 (shift a 1)) (quad32_shift_left_1 (to_quad32 a)); () let lemma_shift_2_left_1 lo hi = let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let (qlo', qhi') = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in reveal_to_quad32 lo; reveal_to_quad32 hi; reveal_to_quad32 (a' %. n); reveal_to_quad32 (a' /. n); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_add_define_all (); lemma_reverse_define_all (); lemma_div_mod a' n; lemma_shift_is_mul hi 128; lemma_shift_define hi 128; lemma_shift_is_mul (a' /. n) 128; let lemma_lo () : Lemma (qlo' == to_quad32 (a' %. n)) = lemma_shift_define (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qlo' (to_quad32 (a' %. n)) in let lemma_hi () : Lemma (qhi' == to_quad32 (a' /. n)) = lemma_shift_define_forward (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qhi' (to_quad32 (a' /. n)) in lemma_lo (); lemma_hi (); () #reset-options let lemma_reverse_reverse a n = lemma_reverse_define_all (); lemma_index_all (); lemma_equal a (reverse (reverse a n) n) let lemma_gf128_degree () = lemma_add_define_all (); lemma_monomial_define 128; lemma_degree_is gf128_modulus_low_terms 7; lemma_degree_is (monomial 128) 128; lemma_degree_is gf128_modulus 128; () let lemma_gf128_constant_rev q = let n0:nat32 = 0 in let n1:nat32 = 0 in let n2:nat32 = 0 in let n3:nat32 = 0xe1000000 in calc (==) { Mkfour n0 n1 n2 n3; == {lemma_quad32_of_nat32s n0 n1 n2 n3} to_quad32 (poly128_of_nat32s n0 n1 n2 n3); == { lemma_bitwise_all (); lemma_to_nat 32 (reverse gf128_modulus_low_terms 31) 0xe1000000; lemma_equal (poly128_of_nat32s n0 n1 n2 n3) (reverse gf128_modulus_low_terms 127) } to_quad32 (reverse gf128_modulus_low_terms 127); }; Vale.Arch.Types.lemma_quad32_xor () let lemma_quad32_double_hi_rev a = let ra = reverse a 127 in lemma_split_define ra 64; lemma_split_define_forward a 64; lemma_index_all (); lemma_add_define_all (); lemma_reverse_define_all (); lemma_equal (a /. monomial 64) (reverse ra 63); lemma_quad32_double a let lemma_gf128_mul a b c d n = let m = monomial n in let ab = a *. m +. b in let cd = c *. m +. d in let ac = a *. c in let ad = a *. d in let bc = b *. c in let bd = b *. d in let adh = ad /. m in let bch = bc /. m in let adl = ad %. m in let bcl = bc %. m in // ab *. cd // (a *. m +. b) *. (c *. m +. d) lemma_mul_distribute_right (a *. m +. b) (c *. m) d; lemma_mul_distribute_left (a *. m) b (c *. m); lemma_mul_distribute_left (a *. m) b d; // ((a *. m) *. (c *. m) +. b *. (c *. m)) +. ((a *. m) *. d +. b *. d); lemma_mul_associate b c m; lemma_mul_associate a m d; lemma_mul_commute m d; lemma_mul_associate a d m; lemma_mul_associate a m (c *. m); lemma_mul_associate m c m; lemma_mul_commute c m; lemma_mul_associate c m m; lemma_mul_associate a c (m *. m); // (ac *. (m *. m) +. bc *. m) +. (ad *. m +. bd) lemma_div_mod ad m; lemma_div_mod bc m; // (ac *. (m *. m) +. (bch *. m +. bcl) *. m) +. ((adh *. m +. adl) *. m +. bd) lemma_mul_distribute_left (bch *. m) bcl m; lemma_mul_distribute_left (adh *. m) adl m; // (ac *. (m *. m) +. (bch *. m *. m +. bcl *. m)) +. ((adh *. m *. m +. adl *. m) +. bd) lemma_mul_associate bch m m; lemma_mul_associate adh m m; // (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd) assert (ab *. cd == (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd)); lemma_add_define_all (); lemma_equal (ab *. cd) ((ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd)); // (ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd) lemma_mul_distribute_left ac bch (m *. m); lemma_mul_distribute_left (ac +. bch) adh (m *. m); // (ac +. bch +. adh) *. (m *. m) +. (bcl *. m +. adl *. m +. bd) lemma_mul_monomials n n; lemma_shift_is_mul (ac +. bch +. adh) (n + n); // shift (ac +. bch +. adh) (n + n) +. (bcl *. m +. adl *. m +. bd) () let lemma_gf128_reduce a b g n h = let ab = a *. b in let d = ab /. n in let m = ab %. n in let dh = d *. h in let d' = dh /. n in let m' = dh %. n in lemma_div_mod ab n; lemma_div_mod dh n; // ab == d *. n +. m // dh == d' *. n +. m' // ab % g // (d *. n +. m) % g lemma_add_define_all (); lemma_zero_define (); lemma_equal n (g +. h); // (d *. (g +. h) +. m) % g lemma_mul_distribute_right d g h; // (d *. g +. dh +. m) % g // (d *. g +. (d' *. n +. m') + m) % g // (d *. g +. (d' *. (g +. h) +. m') + m) % g lemma_mul_distribute_right d' g h; // (d *. g +. (d' *. g +. d' *. h +. m') + m) % g lemma_equal ab ((d *. g +. d' *. g) +. (d' *. h +. m' +. m)); lemma_mul_distribute_left d d' g; // ((d +. d') *. g +. (d' *. h +. m' +. m)) % g lemma_mod_distribute ((d +. d') *. g) (d' *. h +. m' +. m) g; lemma_div_mod_exact (d +. d') g; lemma_equal (ab %. g) ((d' *. h +. m' +. m) %. g); // (d' *. h +. m' +. m) % g lemma_mod_small (d' *. h +. m' +. m) g; // d' *. h +. m' +. m () #reset-options "--max_ifuel 0" let lemma_gf128_reduce_rev a b h n = let m = monomial n in let g = m +. h in lemma_gf128_reduce a b g m h; let r x = reverse x (n - 1) in let rr x = reverse x (2 * n - 1) in let ab = a *. b in let d = (a *. b) /. m in let dh = d *. h in let rab = rr (a *. b) in let rd = rab %. m in let rdh = rr (r rd *. h) in let rdhL = rdh %. m in let rdhLh = r (r rdhL *. h) in lemma_add_define_all (); lemma_reverse_define_all (); lemma_index_all (); lemma_split_define ab n; lemma_split_define_forward rab n; lemma_equal (r rd) d; lemma_split_define ab n; lemma_split_define_forward rab n; lemma_equal (rab /. m) (r (ab %. m)); lemma_split_define dh n; lemma_split_define_forward rdh n; lemma_equal (rdh /. m) (r (dh %. m)); lemma_equal (r rdhL) (dh /. m); lemma_equal rdhLh (r ((dh /. m) *. h)); lemma_equal (r ((a *. b) %. g)) (r ((dh /. m) *. h) +. r (dh %. m) +. r ((a *. b) %. m)); () val lemma_odd_reverse_shift_right (a:poly) (n:pos) : Lemma (requires degree a < n /\ a.[0]) (ensures shift (reverse a (n - 1)) 1 == monomial n +. reverse (shift a (-1)) (n - 1)) let lemma_odd_reverse_shift_right a n = lemma_bitwise_all (); lemma_equal (shift (reverse a (n - 1)) 1) (monomial n +. reverse (shift a (-1)) (n - 1)) val lemma_mul_odd_reverse_shift_right (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (a *. h) (n + n - 1) == reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1 )) let lemma_mul_odd_reverse_shift_right a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in calc (==) { reverse (a *. h) nn1; == {lemma_mul_reverse_shift_1 a h n1} shift (reverse a n1 *. reverse h n1) 1; == {lemma_shift_is_mul_left (reverse a n1 *. reverse h n1) 1} monomial 1 *. (reverse a n1 *. reverse h n1); == {lemma_mul_all ()} reverse a n1 *. (monomial 1 *. reverse h n1); == {lemma_shift_is_mul_left (reverse h n1) 1} reverse a n1 *. shift (reverse h n1) 1; == {lemma_odd_reverse_shift_right h n} reverse a n1 *. (m +. reverse (shift h (-1)) n1); == {lemma_mul_distribute_right (reverse a n1) m (reverse (shift h (-1)) n1)} reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1; } val lemma_mul_odd_reverse_shift_right_hi (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse ((a *. h) /. m) n1 == (reverse a n1 *. reverse (shift h (-1)) n1) %. m )) let lemma_mul_odd_reverse_shift_right_hi a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc (==) { reverse (ah /. m) n1; == {lemma_shift_is_div ah n} reverse (shift ah (-n)) n1; == {lemma_bitwise_all (); lemma_equal (reverse (shift ah (-n)) n1) (mask (reverse ah nn1) n)} mask (reverse ah nn1) n; == {lemma_mask_is_mod (reverse ah nn1) n} reverse ah nn1 %. m; == {lemma_mul_odd_reverse_shift_right a h n} (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_mod_distribute (reverse a n1 *. m) (reverse a n1 *. reverse (shift h (-1)) n1) m} (reverse a n1 *. m) %. m +. (reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_div_mod_exact (reverse a n1) m} zero +. (reverse a n1 *. reverse (shift h (-1)) n1) %. m; == {lemma_add_all ()} (reverse a n1 *. reverse (shift h (-1)) n1) %. m; } val lemma_mul_odd_reverse_shift_right_lo_shift (a h:poly) (n:pos) : Lemma (requires degree h < n /\ degree a < n /\ h.[0]) (ensures ( let n1 = n - 1 in let m = monomial n in reverse (((a *. h) %. m) *. m) (n + n - 1) == reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m )) let lemma_mul_odd_reverse_shift_right_lo_shift a h n = let n1 = n - 1 in let nn1 = n + n - 1 in let m = monomial n in let ah = a *. h in calc (==) { reverse ((ah %. m) *. m) nn1; == {lemma_shift_is_mul (ah %. m) n; lemma_mask_is_mod ah n} reverse (shift (mask ah n) n) nn1; == { lemma_bitwise_all (); lemma_equal (reverse (shift (mask ah n) n) nn1) (shift (reverse ah nn1) (-n)) } shift (reverse ah nn1) (-n); == {lemma_mul_odd_reverse_shift_right a h n} shift (reverse a n1 *. m +. reverse a n1 *. reverse (shift h (-1)) n1) (-n); == {lemma_shift_is_mul (reverse a n1) n} shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (-1)) n1) (-n); == { lemma_bitwise_all (); lemma_equal (shift (shift (reverse a n1) n +. reverse a n1 *. reverse (shift h (-1)) n1) (-n)) (reverse a n1 +. shift (reverse a n1 *. reverse (shift h (-1)) n1) (-n)) } reverse a n1 +. shift (reverse a n1 *. reverse (shift h (-1)) n1) (-n); == {lemma_shift_is_div (reverse a n1 *. reverse (shift h (-1)) n1) n} reverse a n1 +. (reverse a n1 *. reverse (shift h (-1)) n1) /. m; } val lemma_reduce_rev_hi (x3 x2 h:poly) (n:pos) : Lemma (requires degree x3 < n /\ degree x2 < n /\ degree (monomial (n + n) +. h) == n + n /\ degree h < n /\ h.[0] ) (ensures ( let nn = n + n in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (-1)) (n - 1) in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 (n - 1) in let y1 = reverse x2 (n - 1) in reverse (x32 %. g) (nn - 1) == (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n) ))
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.GF128.fst" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x3: Vale.Math.Poly2_s.poly -> x2: Vale.Math.Poly2_s.poly -> h: Vale.Math.Poly2_s.poly -> n: Prims.pos -> FStar.Pervasives.Lemma (requires Vale.Math.Poly2_s.degree x3 < n /\ Vale.Math.Poly2_s.degree x2 < n /\ Vale.Math.Poly2_s.degree (Vale.Math.Poly2_s.monomial (n + n) +. h) == n + n /\ Vale.Math.Poly2_s.degree h < n /\ h.[ 0 ]) (ensures (let nn = n + n in let mm = Vale.Math.Poly2_s.monomial nn in let m = Vale.Math.Poly2_s.monomial n in let g = mm +. h in let c = Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift h (- 1)) (n - 1) in let x32 = (x3 *. m +. x2) *. mm in let y0 = Vale.Math.Poly2_s.reverse x3 (n - 1) in let y1 = Vale.Math.Poly2_s.reverse x2 (n - 1) in Vale.Math.Poly2_s.reverse (x32 %. g) (nn - 1) == (y1 +. Vale.Math.Poly2.mask (y0 *. c) n) *. c +. (Vale.Math.Poly2_s.shift y1 n +. y0 +. Vale.Math.Poly2.swap (y0 *. c) n)))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Math.Poly2_s.poly", "Prims.pos", "FStar.Calc.calc_finish", "Prims.eq2", "Vale.Math.Poly2_s.reverse", "Vale.Math.Poly2.op_Percent_Dot", "Vale.Math.Poly2.op_Plus_Dot", "Vale.Math.Poly2.op_Star_Dot", "Vale.Math.Poly2.mask", "Vale.Math.Poly2_s.shift", "Vale.Math.Poly2.swap", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "Prims.op_Minus", "Vale.Math.Poly2.op_Slash_Dot", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Prims.squash", "Vale.Math.Poly2.Lemmas.lemma_add_reverse", "Vale.AES.GF128.lemma_mul_odd_reverse_shift_right_lo_shift", "Vale.AES.GF128.lemma_mul_odd_reverse_shift_right", "Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left", "Vale.AES.GF128.lemma_mul_odd_reverse_shift_right_hi", "Vale.Math.Poly2.lemma_shift_is_mul", "Vale.Math.Poly2.Lemmas.lemma_mask_is_mod", "Vale.Math.Poly2.Lemmas.lemma_shift_is_div", "Vale.Math.Poly2.Lemmas.lemma_add_all", "Vale.Math.Poly2.lemma_equal", "Vale.Math.Poly2.Lemmas.lemma_bitwise_all", "Vale.Math.Poly2.Lemmas.lemma_mod_reduce", "Vale.Math.Poly2.Lemmas.lemma_mod_distribute", "Vale.Math.Poly2.Lemmas.lemma_mod_small", "Vale.Math.Poly2.Lemmas.lemma_mul_all", "Vale.Math.Poly2.lemma_div_mod", "Vale.Math.Poly2.lemma_mul_associate", "Vale.Math.Poly2.Lemmas.lemma_mul_monomials", "Vale.Math.Poly2.lemma_index_i", "Vale.Math.Poly2_s.monomial", "Prims.int", "Prims.op_Subtraction", "Prims.op_Addition" ]
[]
false
false
true
false
false
let lemma_reduce_rev_hi x3 x2 h n =
let n1 = n - 1 in let nn = n + n in let nn1 = n + n - 1 in let mm = monomial nn in let m = monomial n in let g = mm +. h in let c = reverse (shift h (- 1)) n1 in let x32 = (x3 *. m +. x2) *. mm in let y0 = reverse x3 n1 in let y1 = reverse x2 n1 in let x3h = x3 *. h in let x3hl = x3h %. m in let x3hh = x3h /. m in lemma_index_i h 0; calc ( == ) { ((x3 *. m +. x2) *. mm) %. (mm +. h); ( == ) { lemma_mod_reduce (x3 *. m +. x2) mm h } ((x3 *. m +. x2) *. h) %. (mm +. h); ( == ) { lemma_mul_distribute_left (x3 *. m) x2 h } (x3 *. m *. h +. x2 *. h) %. (mm +. h); ( == ) { lemma_mod_distribute (x3 *. m *. h) (x2 *. h) (mm +. h) } (x3 *. m *. h) %. (mm +. h) +. (x2 *. h) %. (mm +. h); ( == ) { lemma_mod_small (x2 *. h) (mm +. h) } (x3 *. m *. h) %. (mm +. h) +. x2 *. h; ( == ) { lemma_mul_all () } (x3h *. m) %. (mm +. h) +. x2 *. h; ( == ) { lemma_div_mod x3h m } ((x3hh *. m +. x3hl) *. m) %. (mm +. h) +. x2 *. h; ( == ) { lemma_mul_distribute_left (x3hh *. m) x3hl m } (x3hh *. m *. m +. x3hl *. m) %. (mm +. h) +. x2 *. h; ( == ) { lemma_mod_distribute (x3hh *. m *. m) (x3hl *. m) (mm +. h) } (x3hh *. m *. m) %. (mm +. h) +. (x3hl *. m) %. (mm +. h) +. x2 *. h; ( == ) { lemma_mod_small (x3hl *. m) (mm +. h) } (x3hh *. m *. m) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; ( == ) { lemma_mul_associate x3hh m m } (x3hh *. (m *. m)) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; ( == ) { lemma_mul_monomials n n } (x3hh *. mm) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; ( == ) { lemma_mod_reduce x3hh mm h } (x3hh *. h) %. (mm +. h) +. (x3hl *. m) +. x2 *. h; ( == ) { lemma_mod_small (x3hh *. h) (mm +. h) } x3hh *. h +. (x3hl *. m) +. x2 *. h; ( == ) { lemma_add_all () } x3hh *. h +. x2 *. h +. (x3hl *. m); ( == ) { lemma_mul_distribute_left x3hh x2 h } (x3hh +. x2) *. h +. x3hl *. m; }; calc ( == ) { reverse (x32 %. g) nn1; ( == ) { () } reverse ((x3hh +. x2) *. h +. x3hl *. m) nn1; ( == ) { lemma_add_reverse ((x3hh +. x2) *. h) (x3hl *. m) nn1 } reverse ((x3hh +. x2) *. h) nn1 +. reverse (x3hl *. m) nn1; ( == ) { lemma_mul_odd_reverse_shift_right_lo_shift x3 h n } reverse ((x3hh +. x2) *. h) nn1 +. (y0 +. (y0 *. c) /. m); ( == ) { lemma_mul_odd_reverse_shift_right (x3hh +. x2) h n } reverse (x3hh +. x2) n1 *. m +. reverse (x3hh +. x2) n1 *. c +. (y0 +. (y0 *. c) /. m); ( == ) { lemma_add_reverse x3hh x2 n1 } (reverse x3hh n1 +. y1) *. m +. (reverse x3hh n1 +. y1) *. c +. (y0 +. (y0 *. c) /. m); ( == ) { lemma_mul_distribute_left (reverse x3hh n1) y1 c } (reverse x3hh n1 +. y1) *. m +. (reverse x3hh n1 *. c +. y1 *. c) +. (y0 +. (y0 *. c) /. m); ( == ) { lemma_mul_odd_reverse_shift_right_hi x3 h n } ((y0 *. c) %. m +. y1) *. m +. (((y0 *. c) %. m) *. c +. y1 *. c) +. (y0 +. (y0 *. c) /. m); ( == ) { lemma_mul_distribute_left ((y0 *. c) %. m) y1 c } ((y0 *. c) %. m +. y1) *. m +. ((y0 *. c) %. m +. y1) *. c +. (y0 +. (y0 *. c) /. m); ( == ) { (lemma_shift_is_div (y0 *. c) n; lemma_mask_is_mod (y0 *. c) n; lemma_shift_is_mul ((y0 *. c) %. m +. y1) n) } shift (mask (y0 *. c) n +. y1) n +. (mask (y0 *. c) n +. y1) *. c +. (y0 +. shift (y0 *. c) (- n)); ( == ) { lemma_add_all () } (y1 +. mask (y0 *. c) n) *. c +. (shift (mask (y0 *. c) n +. y1) n +. (y0 +. shift (y0 *. c) (- n))); ( == ) { (lemma_bitwise_all (); lemma_equal (shift (mask (y0 *. c) n +. y1) n +. (y0 +. shift (y0 *. c) (- n))) (shift y1 n +. y0 +. swap (y0 *. c) n)) } (y1 +. mask (y0 *. c) n) *. c +. (shift y1 n +. y0 +. swap (y0 *. c) n); }
false
HoareSTFree.fst
HoareSTFree.return
val return (a: Type) (x: a) (q: post a) : repr a (fun s0 -> q s0 x s0) q
val return (a: Type) (x: a) (q: post a) : repr a (fun s0 -> q s0 x s0) q
let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 131, "start_col": 0, "start_line": 130 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> x: a -> q: HoareSTFree.post a -> HoareSTFree.repr a (fun s0 -> q s0 x s0) q
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.post", "Prims.unit", "HoareSTFree.Ret", "HoareSTFree.st", "HoareSTFree.m", "HoareSTFree.repr" ]
[]
false
false
false
false
false
let return (a: Type) (x: a) (q: post a) : repr a (fun s0 -> q s0 x s0) q =
fun _ -> Ret x
false
Hacl.Bignum32.fst
Hacl.Bignum32.add
val add: len:BN.meta_len t_limbs -> BN.bn_add_eq_len_st t_limbs len
val add: len:BN.meta_len t_limbs -> BN.bn_add_eq_len_st t_limbs len
let add len a b res = (ke len).BE.bn.BN.add a b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 24, "start_col": 0, "start_line": 23 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.bn_add_eq_len_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.__proj__Mkbn__item__add", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn", "Hacl.Bignum32.ke", "Hacl.Spec.Bignum.Base.carry" ]
[]
false
false
false
false
false
let add len a b res =
(ke len).BE.bn.BN.add a b res
false
Hacl.Bignum32.fst
Hacl.Bignum32.mont_ctx_init
val mont_ctx_init: len:BN.meta_len t_limbs -> MA.bn_field_init_st t_limbs len
val mont_ctx_init: len:BN.meta_len t_limbs -> MA.bn_field_init_st t_limbs len
let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 58, "start_col": 0, "start_line": 57 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.MontArithmetic.bn_field_init_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "FStar.Monotonic.HyperHeap.rid", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.MontArithmetic.bn_field_init", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__precompr2", "Hacl.Bignum32.ke", "Hacl.Bignum.MontArithmetic.pbn_mont_ctx" ]
[]
false
false
false
false
false
let mont_ctx_init len r n =
MA.bn_field_init len (ke len).BE.precompr2 r n
false
Hacl.Bignum32.fst
Hacl.Bignum32.sub
val sub: len:BN.meta_len t_limbs -> BN.bn_sub_eq_len_st t_limbs len
val sub: len:BN.meta_len t_limbs -> BN.bn_sub_eq_len_st t_limbs len
let sub len a b res = (ke len).BE.bn.BN.sub a b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 27, "start_col": 0, "start_line": 26 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.bn_sub_eq_len_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.__proj__Mkbn__item__sub", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn", "Hacl.Bignum32.ke", "Hacl.Spec.Bignum.Base.carry" ]
[]
false
false
false
false
false
let sub len a b res =
(ke len).BE.bn.BN.sub a b res
false
HoareSTFree.fst
HoareSTFree.pure_p
val pure_p (#a: Type) (wp: pure_wp a) : pre
val pure_p (#a: Type) (wp: pure_wp a) : pre
let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 25, "end_line": 181, "start_col": 0, "start_line": 180 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
wp: Prims.pure_wp a -> HoareSTFree.pre
Prims.Tot
[ "total" ]
[]
[ "Prims.pure_wp", "HoareSTFree.st", "Prims.as_requires", "HoareSTFree.pre" ]
[]
false
false
false
true
false
let pure_p (#a: Type) (wp: pure_wp a) : pre =
fun _ -> as_requires wp
false
HoareSTFree.fst
HoareSTFree.weaker_p
val weaker_p : p0: HoareSTFree.mpre st -> p1: HoareSTFree.mpre st -> s0: st -> s1: st -> Prims.logical
let weaker_p (#st:Type) (p0 p1:mpre st) (s0 s1:st) = p0 s0 ==> p1 s1
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 68, "end_line": 242, "start_col": 0, "start_line": 242 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp unfold let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x let lift_PURE_M (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (pure_p wp) (pure_q wp) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f : squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t : m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t : m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t : m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t sub_effect PURE ~> M = lift_PURE_M /// Using the effect, notice how the pre- and postconditions, /// refinements are chained seamlessly assume val p : prop assume val q : prop assume val st_p : st -> prop assume val st_q : st -> prop assume ST_axiom: forall s. st_p s ==> st_q s assume val f : squash p -> M unit (fun _ -> True) (fun _ _ s1 -> squash q /\ st_p s1) assume val g : unit -> Pure unit True (fun _ -> squash p) assume val h : unit -> M unit (fun s0 -> squash q /\ st_q s0) (fun _ _ s1 -> st_p s1) let test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) = g (); f (); h () /// And now a semantic model for the free monad, proving soundness of the logic /// /// We define a definitional interpreter as a state passing function, /// that interprets the action tree /// step_result is the result of taking a single step noeq type step_result (st:Type) (a:Type) = | Step: #p:mpre st -> #q:mpost st a -> m st a p q -> step_result st a /// As computations take step, /// their preconditions become weaker, /// while the postconditions become stronger
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
p0: HoareSTFree.mpre st -> p1: HoareSTFree.mpre st -> s0: st -> s1: st -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.mpre", "Prims.l_imp", "Prims.logical" ]
[]
false
false
false
true
true
let weaker_p (#st: Type) (p0 p1: mpre st) (s0 s1: st) =
p0 s0 ==> p1 s1
false
Hacl.Bignum32.fst
Hacl.Bignum32.sub_mod
val sub_mod: len:BN.meta_len t_limbs -> BN.bn_sub_mod_n_st t_limbs len
val sub_mod: len:BN.meta_len t_limbs -> BN.bn_sub_mod_n_st t_limbs len
let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 33, "start_col": 0, "start_line": 32 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.bn_sub_mod_n_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.__proj__Mkbn__item__sub_mod_n", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn", "Hacl.Bignum32.ke", "Prims.unit" ]
[]
false
false
false
false
false
let sub_mod len n a b res =
(ke len).BE.bn.BN.sub_mod_n n a b res
false
HoareSTFree.fst
HoareSTFree.pure_q
val pure_q (#a: Type) (wp: pure_wp a) : post a
val pure_q (#a: Type) (wp: pure_wp a) : post a
let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 185, "start_col": 0, "start_line": 184 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
wp: Prims.pure_wp a -> HoareSTFree.post a
Prims.Tot
[ "total" ]
[]
[ "Prims.pure_wp", "HoareSTFree.st", "Prims.l_and", "Prims.eq2", "Prims.as_ensures", "HoareSTFree.post" ]
[]
false
false
false
true
false
let pure_q (#a: Type) (wp: pure_wp a) : post a =
fun s0 x s1 -> s0 == s1 /\ as_ensures wp x
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_inv_prime_vartime
val mod_inv_prime_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_inv_prime_safe_st t_limbs len
val mod_inv_prime_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_inv_prime_safe_st t_limbs len
let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 60, "end_line": 55, "start_col": 0, "start_line": 54 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.SafeAPI.bn_mod_inv_prime_safe_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.SafeAPI.mk_bn_mod_inv_prime_safe", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_vt", "Hacl.Bignum32.ke", "Prims.bool" ]
[]
false
false
false
false
false
let mod_inv_prime_vartime len n a res =
BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res
false
HoareSTFree.fst
HoareSTFree.stronger_q
val stronger_q : q0: HoareSTFree.mpost st a -> q1: HoareSTFree.mpost st a -> s0: st -> s1: st -> Prims.logical
let stronger_q (#st:Type) (#a:Type) (q0 q1:mpost st a) (s0 s1:st) = forall (x:a) (s_final:st). q1 s1 x s_final ==> q0 s0 x s_final
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 64, "end_line": 246, "start_col": 0, "start_line": 245 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp unfold let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x let lift_PURE_M (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (pure_p wp) (pure_q wp) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f : squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t : m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t : m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t : m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t sub_effect PURE ~> M = lift_PURE_M /// Using the effect, notice how the pre- and postconditions, /// refinements are chained seamlessly assume val p : prop assume val q : prop assume val st_p : st -> prop assume val st_q : st -> prop assume ST_axiom: forall s. st_p s ==> st_q s assume val f : squash p -> M unit (fun _ -> True) (fun _ _ s1 -> squash q /\ st_p s1) assume val g : unit -> Pure unit True (fun _ -> squash p) assume val h : unit -> M unit (fun s0 -> squash q /\ st_q s0) (fun _ _ s1 -> st_p s1) let test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) = g (); f (); h () /// And now a semantic model for the free monad, proving soundness of the logic /// /// We define a definitional interpreter as a state passing function, /// that interprets the action tree /// step_result is the result of taking a single step noeq type step_result (st:Type) (a:Type) = | Step: #p:mpre st -> #q:mpost st a -> m st a p q -> step_result st a /// As computations take step, /// their preconditions become weaker, /// while the postconditions become stronger unfold let weaker_p (#st:Type) (p0 p1:mpre st) (s0 s1:st) = p0 s0 ==> p1 s1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
q0: HoareSTFree.mpost st a -> q1: HoareSTFree.mpost st a -> s0: st -> s1: st -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.mpost", "Prims.l_Forall", "Prims.l_imp", "Prims.logical" ]
[]
false
false
false
true
true
let stronger_q (#st #a: Type) (q0 q1: mpost st a) (s0 s1: st) =
forall (x: a) (s_final: st). q1 s1 x s_final ==> q0 s0 x s_final
false
HoareSTFree.fst
HoareSTFree.subcomp
val subcomp (a: Type) (f_p: pre) (f_q: post a) (g_p: pre) (g_q: post a) (f: repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True)
val subcomp (a: Type) (f_p: pre) (f_q: post a) (g_p: pre) (g_q: post a) (f: repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True)
let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ())
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 168, "start_col": 0, "start_line": 161 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> f_p: HoareSTFree.pre -> f_q: HoareSTFree.post a -> g_p: HoareSTFree.pre -> g_q: HoareSTFree.post a -> f: HoareSTFree.repr a f_p f_q -> Prims.Pure (HoareSTFree.repr a g_p g_q)
Prims.Pure
[]
[]
[ "HoareSTFree.pre", "HoareSTFree.post", "HoareSTFree.repr", "Prims.unit", "HoareSTFree.Weaken", "HoareSTFree.st", "HoareSTFree.m", "HoareSTFree.weaken_ok", "Prims.l_True" ]
[]
false
false
false
false
false
let subcomp (a: Type) (f_p: pre) (f_q: post a) (g_p: pre) (g_q: post a) (f: repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) =
fun _ -> Weaken (f ())
false
HoareSTFree.fst
HoareSTFree.lift_PURE_M
val lift_PURE_M (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp)) : repr a (pure_p wp) (pure_q wp)
val lift_PURE_M (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp)) : repr a (pure_p wp) (pure_q wp)
let lift_PURE_M (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (pure_p wp) (pure_q wp) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f : squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t : m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t : m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t : m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 12, "end_line": 200, "start_col": 0, "start_line": 187 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp unfold let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> wp: Prims.pure_wp a -> f: (_: Prims.unit -> Prims.PURE a) -> HoareSTFree.repr a (HoareSTFree.pure_p wp) (HoareSTFree.pure_q wp)
Prims.Tot
[ "total" ]
[]
[ "Prims.pure_wp", "Prims.unit", "HoareSTFree.Weaken", "HoareSTFree.st", "Prims.l_and", "Prims.l_True", "Prims.eq2", "Prims.l_not", "HoareSTFree.pure_p", "HoareSTFree.pure_q", "HoareSTFree.m", "HoareSTFree.Strengthen", "Prims.squash", "HoareSTFree.Ret", "Prims.pure_pre", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "HoareSTFree.repr" ]
[]
false
false
false
false
false
let lift_PURE_M (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp)) : repr a (pure_p wp) (pure_q wp) =
FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f: squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t:m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t:m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t:m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_precomp
val mod_precomp: len:Ghost.erased _ -> BS.bn_mod_slow_ctx_st t_limbs len
val mod_precomp: len:Ghost.erased _ -> BS.bn_mod_slow_ctx_st t_limbs len
let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 65, "start_col": 0, "start_line": 63 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: FStar.Ghost.erased (Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs) -> Hacl.Bignum.SafeAPI.bn_mod_slow_ctx_st Hacl.Bignum32.t_limbs (FStar.Ghost.reveal len)
Prims.Tot
[ "total" ]
[]
[ "FStar.Ghost.erased", "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.MontArithmetic.pbn_mont_ctx", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "FStar.Ghost.reveal", "Hacl.Bignum.SafeAPI.bn_mod_ctx", "Hacl.Bignum32.bn_slow_precomp", "Prims.unit", "Hacl.Bignum.MontArithmetic.bn_field_get_len" ]
[]
false
false
false
false
false
let mod_precomp len k a res =
let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod
val mod: len:BN.meta_len t_limbs -> BS.bn_mod_slow_safe_st t_limbs len
val mod: len:BN.meta_len t_limbs -> BS.bn_mod_slow_safe_st t_limbs len
let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 103, "end_line": 46, "start_col": 0, "start_line": 45 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.SafeAPI.bn_mod_slow_safe_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.SafeAPI.mk_bn_mod_slow_safe", "Hacl.Bignum.ModReduction.mk_bn_mod_slow", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__precomp", "Hacl.Bignum32.kam", "Hacl.Bignum32.bn_slow_precomp", "Prims.bool" ]
[]
false
false
false
false
false
let mod len n a res =
BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_inv_prime_vartime_precomp
val mod_inv_prime_vartime_precomp: len:Ghost.erased _ -> BS.bn_mod_inv_prime_ctx_st t_limbs len
val mod_inv_prime_vartime_precomp: len:Ghost.erased _ -> BS.bn_mod_inv_prime_ctx_st t_limbs len
let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 77, "end_line": 78, "start_col": 0, "start_line": 75 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: FStar.Ghost.erased (Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs) -> Hacl.Bignum.SafeAPI.bn_mod_inv_prime_ctx_st Hacl.Bignum32.t_limbs (FStar.Ghost.reveal len)
Prims.Tot
[ "total" ]
[]
[ "FStar.Ghost.erased", "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.MontArithmetic.pbn_mont_ctx", "Hacl.Bignum.Definitions.lbignum", "FStar.Ghost.reveal", "Hacl.Bignum.SafeAPI.mk_bn_mod_inv_prime_ctx", "Hacl.Bignum.ModInv.mk_bn_mod_inv_prime_precomp", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_vt_precomp", "Hacl.Bignum32.ke", "Prims.unit", "Hacl.Bignum.MontArithmetic.bn_field_get_len" ]
[]
false
false
false
false
false
let mod_inv_prime_vartime_precomp len k a res =
let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res
false
Vale.AES.GF128.fst
Vale.AES.GF128.lemma_shift_2_left_1
val lemma_shift_2_left_1 (lo hi:poly) : Lemma (requires degree hi < 127 /\ degree lo < 128) (ensures ( let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let (lo', hi') = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in lo' == to_quad32 (a' %. n) /\ hi' == to_quad32 (a' /. n) ))
val lemma_shift_2_left_1 (lo hi:poly) : Lemma (requires degree hi < 127 /\ degree lo < 128) (ensures ( let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let (lo', hi') = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in lo' == to_quad32 (a' %. n) /\ hi' == to_quad32 (a' /. n) ))
let lemma_shift_2_left_1 lo hi = let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let (qlo', qhi') = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in reveal_to_quad32 lo; reveal_to_quad32 hi; reveal_to_quad32 (a' %. n); reveal_to_quad32 (a' /. n); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_add_define_all (); lemma_reverse_define_all (); lemma_div_mod a' n; lemma_shift_is_mul hi 128; lemma_shift_define hi 128; lemma_shift_is_mul (a' /. n) 128; let lemma_lo () : Lemma (qlo' == to_quad32 (a' %. n)) = lemma_shift_define (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qlo' (to_quad32 (a' %. n)) in let lemma_hi () : Lemma (qhi' == to_quad32 (a' /. n)) = lemma_shift_define_forward (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qhi' (to_quad32 (a' /. n)) in lemma_lo (); lemma_hi (); ()
{ "file_name": "vale/code/crypto/aes/Vale.AES.GF128.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 57, "start_col": 0, "start_line": 22 }
module Vale.AES.GF128 open FStar.Mul open Vale.Arch.TypesNative open Vale.Math.Poly2.Bits #reset-options "--z3rlimit 20" let lemma_shift_left_1 a = reveal_to_quad32 a; reveal_to_quad32 (shift a 1); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_reverse_define_all (); quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal (to_quad32 (shift a 1)) (quad32_shift_left_1 (to_quad32 a)); ()
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2.Bits.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.GF128.fst" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
lo: Vale.Math.Poly2_s.poly -> hi: Vale.Math.Poly2_s.poly -> FStar.Pervasives.Lemma (requires Vale.Math.Poly2_s.degree hi < 127 /\ Vale.Math.Poly2_s.degree lo < 128) (ensures (let n = Vale.Math.Poly2_s.monomial 128 in let a = hi *. n +. lo in let a' = Vale.Math.Poly2_s.shift a 1 in let _ = Vale.AES.GF128.quad32_shift_2_left_1 (Vale.Math.Poly2.Bits_s.to_quad32 lo) (Vale.Math.Poly2.Bits_s.to_quad32 hi) in (let FStar.Pervasives.Native.Mktuple2 #_ #_ lo' hi' = _ in lo' == Vale.Math.Poly2.Bits_s.to_quad32 (a' %. n) /\ hi' == Vale.Math.Poly2.Bits_s.to_quad32 (a' /. n)) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Math.Poly2_s.poly", "Vale.Def.Types_s.quad32", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "Vale.Math.Poly2.Bits_s.to_quad32", "Vale.Math.Poly2_s.div", "Prims.Nil", "FStar.Pervasives.pattern", "Vale.Arch.TypesNative.lemma_quad32_vec_equal", "Vale.Math.Poly2.op_Slash_Dot", "Vale.Def.Types_s.reverse_bytes_nat32_reveal", "Vale.Def.Types_s.quad32_xor_reveal", "Vale.Math.Poly2.Lemmas.lemma_shift_define_forward", "Vale.Math.Poly2_s.mod", "Vale.Math.Poly2.op_Percent_Dot", "Vale.Math.Poly2.Lemmas.lemma_shift_define", "Vale.Math.Poly2.lemma_shift_is_mul", "Vale.Math.Poly2.lemma_div_mod", "Vale.Math.Poly2.Lemmas.lemma_reverse_define_all", "Vale.Math.Poly2.Lemmas.lemma_add_define_all", "Vale.Math.Poly2.Lemmas.lemma_index_all", "Vale.Arch.TypesNative.lemma_ixor_nth_all", "Vale.Arch.TypesNative.lemma_ishr_nth_all", "Vale.Arch.TypesNative.lemma_ishl_nth_all", "Vale.Arch.TypesNative.lemma_zero_nth", "Vale.Math.Poly2.Bits_s.reveal_to_quad32", "FStar.Pervasives.Native.tuple2", "Vale.AES.GF128.quad32_shift_2_left_1", "Vale.Math.Poly2_s.shift", "Vale.Math.Poly2.op_Plus_Dot", "Vale.Math.Poly2.op_Star_Dot", "Vale.Math.Poly2_s.monomial" ]
[]
false
false
true
false
false
let lemma_shift_2_left_1 lo hi =
let n = monomial 128 in let a = hi *. n +. lo in let a' = shift a 1 in let qlo', qhi' = quad32_shift_2_left_1 (to_quad32 lo) (to_quad32 hi) in reveal_to_quad32 lo; reveal_to_quad32 hi; reveal_to_quad32 (a' %. n); reveal_to_quad32 (a' /. n); lemma_zero_nth 32; lemma_ishl_nth_all 32; lemma_ishr_nth_all 32; lemma_ixor_nth_all 32; lemma_index_all (); lemma_shift_define a 1; lemma_add_define_all (); lemma_reverse_define_all (); lemma_div_mod a' n; lemma_shift_is_mul hi 128; lemma_shift_define hi 128; lemma_shift_is_mul (a' /. n) 128; let lemma_lo () : Lemma (qlo' == to_quad32 (a' %. n)) = lemma_shift_define (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qlo' (to_quad32 (a' %. n)) in let lemma_hi () : Lemma (qhi' == to_quad32 (a' /. n)) = lemma_shift_define_forward (a' /. n) 128; quad32_xor_reveal (); reverse_bytes_nat32_reveal (); lemma_quad32_vec_equal qhi' (to_quad32 (a' /. n)) in lemma_lo (); lemma_hi (); ()
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_exp_consttime
val mod_exp_consttime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
val mod_exp_consttime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 52, "start_col": 0, "start_line": 51 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.bits", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "Lib.IntTypes.max_size_t", "Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_check", "Hacl.Bignum32.ke", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_ct", "Prims.bool" ]
[]
false
false
false
false
false
let mod_exp_consttime len n a bBits b res =
BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res
false
HoareSTFree.fst
HoareSTFree.run
val run (#st #a: Type) (#p: mpre st) (#q: mpost st a) (f: m st a p q) (s0: st) : Div (a & st) (requires p s0) (ensures fun (x, s1) -> q s0 x s1)
val run (#st #a: Type) (#p: mpre st) (#q: mpost st a) (f: m st a p q) (s0: st) : Div (a & st) (requires p s0) (ensures fun (x, s1) -> q s0 x s1)
let rec run (#st:Type) (#a:Type) (#p:mpre st) (#q:mpost st a) (f:m st a p q) : s0:st -> Div (a & st) (requires p s0) (ensures fun (x, s1) -> q s0 x s1) = fun s0 -> match f with | Ret x -> x, s0 | _ -> let Step f, s1 = step f s0 in run f s1
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 279, "start_col": 0, "start_line": 270 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp unfold let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x let lift_PURE_M (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (pure_p wp) (pure_q wp) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f : squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t : m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t : m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t : m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t sub_effect PURE ~> M = lift_PURE_M /// Using the effect, notice how the pre- and postconditions, /// refinements are chained seamlessly assume val p : prop assume val q : prop assume val st_p : st -> prop assume val st_q : st -> prop assume ST_axiom: forall s. st_p s ==> st_q s assume val f : squash p -> M unit (fun _ -> True) (fun _ _ s1 -> squash q /\ st_p s1) assume val g : unit -> Pure unit True (fun _ -> squash p) assume val h : unit -> M unit (fun s0 -> squash q /\ st_q s0) (fun _ _ s1 -> st_p s1) let test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) = g (); f (); h () /// And now a semantic model for the free monad, proving soundness of the logic /// /// We define a definitional interpreter as a state passing function, /// that interprets the action tree /// step_result is the result of taking a single step noeq type step_result (st:Type) (a:Type) = | Step: #p:mpre st -> #q:mpost st a -> m st a p q -> step_result st a /// As computations take step, /// their preconditions become weaker, /// while the postconditions become stronger unfold let weaker_p (#st:Type) (p0 p1:mpre st) (s0 s1:st) = p0 s0 ==> p1 s1 unfold let stronger_q (#st:Type) (#a:Type) (q0 q1:mpost st a) (s0 s1:st) = forall (x:a) (s_final:st). q1 s1 x s_final ==> q0 s0 x s_final /// The single-step function let step (#st:Type) (#a:Type) (#p:mpre st) (#q:mpost st a) (f:m st a p q) : s0:st -> Div (step_result st a & st) (requires p s0) (ensures fun (r, s1) -> let Step #_ #_ #p_next #q_next g = r in weaker_p p p_next s0 s1 /\ stronger_q q q_next s0 s1) = fun s0 -> match f with | Ret _ -> Step f, s0 | Act act k -> let x, s1 = act s0 in Step (k x), s1 | Weaken f -> Step f, s0 | Strengthen f -> Step (f ()), s0 /// Wrapper around step, notice the spec of the Div effect
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: HoareSTFree.m st a p q -> s0: st -> FStar.Pervasives.Div (a * st)
FStar.Pervasives.Div
[]
[]
[ "HoareSTFree.mpre", "HoareSTFree.mpost", "HoareSTFree.m", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.tuple2", "HoareSTFree.run", "HoareSTFree.step_result", "HoareSTFree.step" ]
[ "recursion" ]
false
true
false
false
false
let rec run (#st #a: Type) (#p: mpre st) (#q: mpost st a) (f: m st a p q) (s0: st) : Div (a & st) (requires p s0) (ensures fun (x, s1) -> q s0 x s1) =
fun s0 -> match f with | Ret x -> x, s0 | _ -> let Step f, s1 = step f s0 in run f s1
false
Vale.AES.PPC64LE.GCTR.fst
Vale.AES.PPC64LE.GCTR.va_lemma_Gctr_blocks128_6way_body
val va_lemma_Gctr_blocks128_6way_body : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
val va_lemma_Gctr_blocks128_6way_body : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
let va_lemma_Gctr_blocks128_6way_body va_b0 va_s0 alg in_b out_b old_icb key round_keys keys_b plain_quads = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_6way_body va_mods alg in_b out_b old_icb key round_keys keys_b plain_quads in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_body alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 374 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 375 column 114 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 376 column 108 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 378 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 379 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 380 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 381 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "file_name": "obj/Vale.AES.PPC64LE.GCTR.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 1676, "start_col": 0, "start_line": 1640 }
module Vale.AES.PPC64LE.GCTR open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.HeapImpl open FStar.Seq open Vale.AES.AES_BE_s open Vale.AES.PPC64LE.AES open Vale.AES.GCTR_BE_s open Vale.AES.GCTR_BE open Vale.AES.GCM_helpers_BE open Vale.Poly1305.Math open Vale.Def.Words.Two_s open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Memory open Vale.PPC64LE.State open Vale.PPC64LE.Decls open Vale.PPC64LE.InsBasic open Vale.PPC64LE.InsMem open Vale.PPC64LE.InsVector open Vale.PPC64LE.InsStack open Vale.PPC64LE.QuickCode open Vale.PPC64LE.QuickCodes open Vale.AES.Types_helpers #reset-options "--z3rlimit 30" open Vale.Lib.Basic #reset-options "--z3rlimit 20" //-- Gctr_register [@ "opaque_to_smt" va_qattr] let va_code_Gctr_register alg = (va_Block (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_CNil ())))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_register alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_register (va_mods:va_mods_t) (alg:algorithm) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_register alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 99 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE_s.inc32 (va_get_vec 7 va_s) 0 == va_get_vec 7 va_s) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 100 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 101 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock alg (va_get_vec 7 va_s) key round_keys keys_b) (fun (va_s:va_state) _ -> va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 102 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (va_get_vec 7 va_s)) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 102 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 0 va_s == Vale.AES.AES_BE_s.aes_encrypt_word alg key (va_get_vec 7 va_s)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 104 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 0)) (fun (va_s:va_state) _ -> let (va_arg15:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg14:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg13:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let (va_arg12:Vale.Def.Types_s.quad32) = va_get_vec 7 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 107 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.gctr_encrypt_one_block va_arg12 va_arg13 va_arg14 va_arg15) (va_QEmpty (())))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_register va_b0 va_s0 alg key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in let va_qc = va_qcode_Gctr_register va_mods alg key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_register alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 80 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 96 column 142 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE #Vale.Def.Words_s.nat32 (FStar.Seq.Base.create #quad32 1 (va_get_vec 1 va_sM))) == Vale.AES.GCTR_BE_s.gctr_encrypt (va_get_vec 7 va_sM) (Vale.Arch.Types.be_quad32_to_bytes (va_get_vec 1 va_s0)) alg key) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 97 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 1 va_sM == Vale.AES.GCTR_BE_s.gctr_encrypt_block (va_get_vec 7 va_sM) (va_get_vec 1 va_s0) alg key 0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@"opaque_to_smt"] let va_wpProof_Gctr_register alg key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_register (va_code_Gctr_register alg) va_s0 alg key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))); va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) //-- //-- Gctr_blocks128_body_1way val va_code_Gctr_blocks128_body_1way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_body_1way alg = (va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret) (va_CNil ())))))))) val va_codegen_success_Gctr_blocks128_body_1way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_body_1way alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_body_1way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_body_1way alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 152 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 6 va_s + count))) (fun _ -> let (ctr_enc:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 6 va_s + count) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 6 va_s + count))) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 154 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 155 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock alg (va_get_vec 7 va_s) key round_keys keys_b) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 157 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 9) Secret in_b (va_get_reg 6 va_s + count)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 158 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 0)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 159 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 9) Secret out_b (va_get_reg 6 va_s + count)) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 160 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 6 va_s + count) (va_get_mem_heaplet 1 va_s)) == ctr_enc) (let (va_arg24:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg23:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg22:Vale.Def.Types_s.quad32) = old_icb in let (va_arg21:Prims.nat) = va_get_reg 6 va_s + count in let (va_arg20:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg19:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) out_b) in let (va_arg18:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 162 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.lemma_eq_reverse_bytes_quad32_seq va_arg18 va_arg19 va_arg20 va_arg21 va_arg22 va_arg23 va_arg24) (va_QEmpty (()))))))))))) val va_lemma_Gctr_blocks128_body_1way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> count:nat -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_body_1way alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= count /\ count < va_get_reg 26 va_s0 /\ va_get_reg 9 va_s0 == count `op_Multiply` 16 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0 + count) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + count) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0 + count) /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_body_1way va_b0 va_s0 alg in_b out_b count old_icb key round_keys keys_b plain_quads = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_body_1way va_mods alg in_b out_b count old_icb key round_keys keys_b plain_quads in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_body_1way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 110 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 148 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 149 column 132 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 150 column 126 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_body_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= count /\ count < va_get_reg 26 va_s0 /\ va_get_reg 9 va_s0 == count `op_Multiply` 16 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0 + count) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + count) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0 + count) /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)) /\ (forall (va_x_mem:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 6 va_sM + count + 1) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + count + 1) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_body_1way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> count:nat -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq 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_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_body_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_body_1way (va_code_Gctr_blocks128_body_1way alg) va_s0 alg in_b out_b count old_icb key round_keys keys_b plain_quads in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; 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_Gctr_blocks128_body_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (count:nat) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_body_1way alg)) = (va_QProc (va_code_Gctr_blocks128_body_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem]) (va_wp_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads) (va_wpProof_Gctr_blocks128_body_1way alg in_b out_b count old_icb key round_keys keys_b plain_quads)) //-- //-- Mod_cr0 val va_code_Mod_cr0 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Mod_cr0 () = (va_Block (va_CNil ())) val va_codegen_success_Mod_cr0 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Mod_cr0 () = (va_ttrue ()) [@ "opaque_to_smt" va_qattr] let va_qcode_Mod_cr0 (va_mods:va_mods_t) : (va_quickCode unit (va_code_Mod_cr0 ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QEmpty (()))) val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Mod_cr0 ()) va_s0 /\ va_get_ok 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_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0)))) [@"opaque_to_smt"] let va_lemma_Mod_cr0 va_b0 va_s0 = let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in let va_qc = va_qcode_Mod_cr0 va_mods in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 165 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM)) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Mod_cr0 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (forall (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0 va_x_cr0 va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) val va_wpProof_Mod_cr0 : va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Mod_cr0 va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Mod_cr0 va_s0 va_k = let (va_sM, va_f0) = va_lemma_Mod_cr0 (va_code_Mod_cr0 ()) va_s0 in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))); va_lemma_norm_mods ([va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Mod_cr0 () : (va_quickCode unit (va_code_Mod_cr0 ())) = (va_QProc (va_code_Mod_cr0 ()) ([va_Mod_cr0]) va_wp_Mod_cr0 va_wpProof_Mod_cr0) //-- //-- Gctr_blocks128_1way_body0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way_body0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way_body0 alg = (va_Block (va_CCons (va_code_Mod_cr0 ()) (va_CCons (va_code_Gctr_blocks128_body_1way alg) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_CNil ()))))))) val va_codegen_success_Gctr_blocks128_1way_body0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way_body0 alg = (va_pbool_and (va_codegen_success_Mod_cr0 ()) (va_pbool_and (va_codegen_success_Gctr_blocks128_body_1way alg) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_ttrue ())))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way_body0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_body0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (old_icb:quad32) = va_in_old_icb in let (old_plain:(seq quad32)) = va_in_old_plain in let (out_b:buffer128) = va_in_out_b in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 257 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Mod_cr0 ()) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 259 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_body_1way alg in_b out_b (va_get_reg 8 va_s) old_icb key round_keys keys_b old_plain) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 261 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 262 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 9) (va_op_reg_opr_reg 9) 16) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 263 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 3)) (va_QEmpty (())))))))) val va_lemma_Gctr_blocks128_1way_body0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way_body0 alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way_body0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_1way_body0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way_body0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 229 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 230 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 231 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 235 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 236 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 237 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 238 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 239 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 240 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 241 column 143 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 242 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 245 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 248 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 252 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 253 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 254 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))) in va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ precedes_wrap (va_get_reg 26 va_sM - va_get_reg 8 va_sM) (va_get_reg 26 va_s0 - va_get_reg 8 va_s0) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way_body0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq 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_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way_body0 (va_code_Gctr_blocks128_1way_body0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_1way_body0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_body0 alg)) = (va_QProc (va_code_Gctr_blocks128_1way_body0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys) (va_wpProof_Gctr_blocks128_1way_body0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_1way_while0 #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way_while0 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way_while0 alg = (va_Block (va_CCons (va_While (va_cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 26)) (va_Block (va_CCons (va_code_Gctr_blocks128_1way_body0 alg) (va_CNil ())))) (va_CNil ()))) val va_codegen_success_Gctr_blocks128_1way_while0 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way_while0 alg = (va_pbool_and (va_codegen_success_Gctr_blocks128_1way_body0 alg) (va_ttrue ())) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way_while0 (va_mods:va_mods_t) (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_while0 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (in_b:buffer128) = va_in_in_b in let (key:(seq nat32)) = va_in_key in let (keys_b:buffer128) = va_in_keys_b in let (old_icb:quad32) = va_in_old_icb in let (old_plain:(seq quad32)) = va_in_old_plain in let (out_b:buffer128) = va_in_out_b in let (round_keys:(seq quad32)) = va_in_round_keys in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_qWhile va_mods (Cmp_ne (va_op_cmp_reg 8) (va_op_cmp_reg 26)) (fun va_g -> qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way_body0 va_old alg in_b key keys_b old_icb old_plain out_b round_keys) (va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_get_ok va_s /\ (0 <= va_get_reg 8 va_s /\ va_get_reg 8 va_s <= va_get_reg 26 va_s) /\ va_get_reg 9 va_s == 16 `op_Multiply` va_get_reg 8 va_s /\ va_get_vec 7 va_s == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s + va_get_reg 8 va_s) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 3 va_s) in_b (va_get_reg 6 va_s) (va_get_reg 26 va_s) (va_get_mem_layout va_s) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s) (va_get_reg 7 va_s) out_b (va_get_reg 6 va_s) (va_get_reg 26 va_s) (va_get_mem_layout va_s) Secret /\ va_get_reg 3 va_s + 16 `op_Multiply` va_get_reg 26 va_s < pow2_64 /\ va_get_reg 7 va_s + 16 `op_Multiply` va_get_reg 26 va_s < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b /\ (va_get_reg 8 va_s =!= va_get_reg 26 va_s ==> Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) in_b)) (va_get_reg 6 va_s + va_get_reg 8 va_s) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ va_get_reg 6 va_s + va_get_reg 26 va_s < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s) (va_get_mem_heaplet 0 va_s) (va_get_mem_layout va_s) /\ va_get_vec 3 va_s == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s + va_get_reg 8 va_s) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b)) key old_icb /\ (va_get_reg 6 va_s + va_get_reg 26 va_s == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) out_b)) (fun (va_s:va_state) va_g -> va_get_reg 26 va_s - va_get_reg 8 va_s) (())) (fun (va_s:va_state) va_g -> let va_g = () in va_QEmpty (())))) val va_lemma_Gctr_blocks128_1way_while0 : va_b0:va_code -> va_s0:va_state -> va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way_while0 alg) va_s0 /\ va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ ~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM) /\ va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0)))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way_while0 va_b0 va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys = let va_old = va_expand_state va_old in let (va_mods:va_mods_t) = [va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0] in let va_qc = va_qcode_Gctr_blocks128_1way_while0 va_mods va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way_while0 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 229 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 230 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 231 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 235 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 236 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 237 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 238 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 239 column 41 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 240 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 241 column 143 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 242 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 245 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 248 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 251 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 252 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 253 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (0 <= va_get_reg 8 va_s0 /\ va_get_reg 8 va_s0 <= va_get_reg 26 va_s0) /\ va_get_reg 9 va_s0 == 16 `op_Multiply` va_get_reg 8 va_s0 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) va_in_in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) va_in_out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_s0 =!= va_get_reg 26 va_s0 ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_in_b)) (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_vec 3 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0 + va_get_reg 8 va_s0) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ (forall (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) (va_x_mem:vale_heap) (va_x_ok:bool) (va_x_r10:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v7:quad32) . let va_sM = va_upd_vec 7 va_x_v7 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_reg 10 va_x_r10 (va_upd_ok va_x_ok (va_upd_mem va_x_mem (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 va_s0))))))))) in va_get_ok va_sM /\ (0 <= va_get_reg 8 va_sM /\ va_get_reg 8 va_sM <= va_get_reg 26 va_sM) /\ va_get_reg 9 va_sM == 16 `op_Multiply` va_get_reg 8 va_sM /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite va_in_old_icb (va_get_reg 6 va_sM + va_get_reg 8 va_sM) /\ (Vale.PPC64LE.Decls.buffers_disjoint128 va_in_in_b va_in_out_b \/ va_in_in_b == va_in_out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) va_in_in_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 7 va_sM) va_in_out_b (va_get_reg 6 va_sM) (va_get_reg 26 va_sM) (va_get_mem_layout va_sM) Secret /\ va_get_reg 3 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ va_get_reg 7 va_sM + 16 `op_Multiply` va_get_reg 26 va_sM < pow2_64 /\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_out_b /\ (va_get_reg 8 va_sM =!= va_get_reg 26 va_sM ==> Vale.AES.GCTR_BE.partial_seq_agreement va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_in_b)) (va_get_reg 6 va_sM + va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 va_in_in_b)) /\ va_get_reg 6 va_sM + va_get_reg 26 va_sM < pow2_32 /\ aes_reqs alg va_in_key va_in_round_keys va_in_keys_b (va_get_reg 4 va_sM) (va_get_mem_heaplet 0 va_sM) (va_get_mem_layout va_sM) /\ va_get_vec 3 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ Vale.PPC64LE.Decls.modifies_buffer128 va_in_out_b (va_get_mem_heaplet 1 va_old) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 8 va_sM) va_in_old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b)) va_in_key va_in_old_icb /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) va_in_out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old) va_in_out_b) /\ ~(va_get_reg 8 va_sM =!= va_get_reg 26 va_sM) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way_while0 : va_old:va_state -> alg:algorithm -> va_in_in_b:buffer128 -> va_in_key:(seq nat32) -> va_in_keys_b:buffer128 -> va_in_old_icb:quad32 -> va_in_old_plain:(seq quad32) -> va_in_out_b:buffer128 -> va_in_round_keys:(seq 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_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way_while0 (va_code_Gctr_blocks128_1way_while0 alg) va_s0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_vec 7 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM va_s0))))))))))); va_lemma_norm_mods ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gctr_blocks128_1way_while0 (va_old:va_state) (alg:algorithm) (va_in_in_b:buffer128) (va_in_key:(seq nat32)) (va_in_keys_b:buffer128) (va_in_old_icb:quad32) (va_in_old_plain:(seq quad32)) (va_in_out_b:buffer128) (va_in_round_keys:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_1way_while0 alg)) = (va_QProc (va_code_Gctr_blocks128_1way_while0 alg) ([va_Mod_vec 7; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 9; va_Mod_reg 8; va_Mod_reg 10; va_Mod_ok; va_Mod_mem; va_Mod_mem_heaplet 1; va_Mod_cr0]) (va_wp_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys) (va_wpProof_Gctr_blocks128_1way_while0 va_old alg va_in_in_b va_in_key va_in_keys_b va_in_old_icb va_in_old_plain va_in_out_b va_in_round_keys)) #pop-options //-- //-- Gctr_blocks128_1way #push-options "--z3rlimit 30" val va_code_Gctr_blocks128_1way : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_1way alg = (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 3) 1) (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 4) 0) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_CCons (va_code_Gctr_blocks128_1way_while0 alg) (va_CNil ())))))))) val va_codegen_success_Gctr_blocks128_1way : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_1way alg = (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 3) 1) (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 0) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_pbool_and (va_codegen_success_Gctr_blocks128_1way_while0 alg) (va_ttrue ()))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_1way (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_1way 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 219 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 3) 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 220 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vspltisw (va_op_vec_opr_vec 4) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 221 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vsldoi (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 3) 4) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 223 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 8) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 224 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_LoadImm64 (va_op_reg_opr_reg 9) 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 226 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Gctr_blocks128_1way_while0 va_old_s alg in_b key keys_b old_icb old_plain out_b round_keys) (va_QEmpty (()))))))))) val va_lemma_Gctr_blocks128_1way : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> old_plain:(seq quad32) -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_1way alg) va_s0 /\ va_get_ok va_s0 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM) /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 7 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))) [@"opaque_to_smt"] let va_lemma_Gctr_blocks128_1way va_b0 va_s0 alg in_b out_b old_icb old_plain key round_keys keys_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gctr_blocks128_1way va_mods alg in_b out_b old_icb old_plain key round_keys keys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gctr_blocks128_1way alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 171 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 212 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 215 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 216 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 217 column 79 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gctr_blocks128_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(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 /\ ((Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 6 va_s0) (va_get_reg 26 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ va_get_reg 7 va_s0 + 16 `op_Multiply` va_get_reg 26 va_s0 < pow2_64 /\ l_and (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out_b) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b < pow2_32) /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 == Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b /\ va_get_reg 6 va_s0 + va_get_reg 26 va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ Vale.AES.GCTR_BE.partial_seq_agreement old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 6 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_s0) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_s0) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb) /\ (forall (va_x_mem:vale_heap) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v7:quad32) (va_x_cr0:cr0_t) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_cr0 va_x_cr0 (va_upd_vec 7 va_x_v7 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_reg 9 va_x_r9 (va_upd_reg 8 va_x_r8 (va_upd_mem va_x_mem va_s0)))))))))) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 6 va_sM + va_get_reg 26 va_sM) old_plain (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 6 va_sM + va_get_reg 26 va_sM) /\ (va_get_reg 6 va_sM + va_get_reg 26 va_sM == 0 ==> Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) ==> va_k va_sM (()))) val va_wpProof_Gctr_blocks128_1way : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> old_plain:(seq quad32) -> key:(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_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gctr_blocks128_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gctr_blocks128_1way (va_code_Gctr_blocks128_1way alg) va_s0 alg in_b out_b old_icb old_plain key round_keys keys_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 7 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; 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_Gctr_blocks128_1way (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (old_plain:(seq quad32)) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) : (va_quickCode unit (va_code_Gctr_blocks128_1way alg)) = (va_QProc (va_code_Gctr_blocks128_1way alg) ([va_Mod_mem_heaplet 1; va_Mod_cr0; va_Mod_vec 7; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 9; va_Mod_reg 8; va_Mod_mem]) (va_wp_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b) (va_wpProof_Gctr_blocks128_1way alg in_b out_b old_icb old_plain key round_keys keys_b)) #pop-options //-- //-- Store_3blocks128_1 val va_code_Store_3blocks128_1 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Store_3blocks128_1 () = (va_Block (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret) (va_CNil ()))))) val va_codegen_success_Store_3blocks128_1 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Store_3blocks128_1 () = (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Store_3blocks128_1 (va_mods:va_mods_t) (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_1 ())) = (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 287 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 0) (va_op_reg_opr_reg 7) Secret out_b (va_get_reg 8 va_s)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 288 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 27) Secret out_b (va_get_reg 8 va_s + 1)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 289 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 2) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 28) Secret out_b (va_get_reg 8 va_s + 2)) (va_QEmpty (())))))) val va_lemma_Store_3blocks128_1 : va_b0:va_code -> va_s0:va_state -> out_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_3blocks128_1 ()) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_Store_3blocks128_1 va_b0 va_s0 out_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Store_3blocks128_1 va_mods out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Store_3blocks128_1 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 267 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 282 column 76 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 283 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 284 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 285 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Store_3blocks128_1 (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16) /\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM) (va_get_reg 8 va_sM + 2) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 0 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 1) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 1 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 2) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 2 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Store_3blocks128_1 : out_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_Store_3blocks128_1 out_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_3blocks128_1 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Store_3blocks128_1 out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_3blocks128_1 (va_code_Store_3blocks128_1 ()) va_s0 out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; 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_Store_3blocks128_1 (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_1 ())) = (va_QProc (va_code_Store_3blocks128_1 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Store_3blocks128_1 out_b) (va_wpProof_Store_3blocks128_1 out_b)) //-- //-- Store_3blocks128_2 val va_code_Store_3blocks128_2 : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Store_3blocks128_2 () = (va_Block (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret) (va_CNil ()))))) val va_codegen_success_Store_3blocks128_2 : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Store_3blocks128_2 () = (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Store_3blocks128_2 (va_mods:va_mods_t) (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_2 ())) = (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 313 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 29) Secret out_b (va_get_reg 8 va_s + 3)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 314 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 4) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 30) Secret out_b (va_get_reg 8 va_s + 4)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 315 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 31) Secret out_b (va_get_reg 8 va_s + 5)) (va_QEmpty (())))))) val va_lemma_Store_3blocks128_2 : va_b0:va_code -> va_s0:va_state -> out_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Store_3blocks128_2 ()) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))) [@"opaque_to_smt"] let va_lemma_Store_3blocks128_2 va_b0 va_s0 out_b = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Store_3blocks128_2 va_mods out_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Store_3blocks128_2 ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 292 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 308 column 80 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 309 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 310 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 311 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Store_3blocks128_2 (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16) /\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0) in va_get_ok va_sM /\ (Vale.PPC64LE.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) (va_get_reg 8 va_sM + 3) (va_get_reg 8 va_sM + 5) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 3) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 3 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 4) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 4 va_sM) /\ Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_sM + 5) (va_get_mem_heaplet 1 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 (va_get_vec 5 va_sM)) ==> va_k va_sM (()))) val va_wpProof_Store_3blocks128_2 : out_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_Store_3blocks128_2 out_b va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_3blocks128_2 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Store_3blocks128_2 out_b va_s0 va_k = let (va_sM, va_f0) = va_lemma_Store_3blocks128_2 (va_code_Store_3blocks128_2 ()) va_s0 out_b in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; 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_Store_3blocks128_2 (out_b:buffer128) : (va_quickCode unit (va_code_Store_3blocks128_2 ())) = (va_QProc (va_code_Store_3blocks128_2 ()) ([va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Store_3blocks128_2 out_b) (va_wpProof_Store_3blocks128_2 out_b)) //-- //-- Gctr_blocks128_6way_body val va_code_Gctr_blocks128_6way_body : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gctr_blocks128_6way_body alg = (va_Block (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_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (va_CCons (va_code_AESEncryptBlock_6way alg) (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_CCons (va_code_Store_3blocks128_1 ()) (va_CCons (va_code_Store_3blocks128_2 ()) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_CCons (va_code_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_CNil ()))))))))))))))))))))))))))))))))) val va_codegen_success_Gctr_blocks128_6way_body : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gctr_blocks128_6way_body alg = (va_pbool_and (va_codegen_success_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (va_pbool_and (va_codegen_success_AESEncryptBlock_6way alg) (va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_Store_3blocks128_1 ()) (va_pbool_and (va_codegen_success_Store_3blocks128_2 ()) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_pbool_and (va_codegen_success_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_ttrue ())))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gctr_blocks128_6way_body (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (old_icb:quad32) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (plain_quads:(seq quad32)) : (va_quickCode unit (va_code_Gctr_blocks128_6way_body alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 383 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s))) (fun _ -> let (ctr_enc_0:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 384 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 1))) (fun _ -> let (ctr_enc_1:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 1) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 1))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 385 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 2))) (fun _ -> let (ctr_enc_2:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 2) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 2))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 386 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 3))) (fun _ -> let (ctr_enc_3:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 3) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 3))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 387 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 4))) (fun _ -> let (ctr_enc_4:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 4) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 4))) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 388 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" ((fun (alg_10591:Vale.AES.AES_common_s.algorithm) (key_10592:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (input_10593:Vale.Def.Types_s.quad32) -> Vale.AES.AES_BE_s.is_aes_key_word alg_10591 key_10592) alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 5))) (fun _ -> let (ctr_enc_5:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read in_b (va_get_reg 8 va_s + 5) (va_get_mem_heaplet 1 va_s))) (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.AES.GCTR_BE_s.inc32 old_icb (va_get_reg 8 va_s + 5))) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 390 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vmr (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 7)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 391 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 392 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 9)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 393 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 394 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 11)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 395 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 12)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 397 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AESEncryptBlock_6way alg (va_get_vec 7 va_s) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 1) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 2) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 3) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 4) (Vale.AES.GCTR_BE.inc32lite (va_get_vec 7 va_s) 5) key round_keys keys_b) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 399 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 14) (va_op_reg_opr_reg 3) Secret in_b (va_get_reg 8 va_s)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 400 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 15) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 27) Secret in_b (va_get_reg 8 va_s + 1)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 401 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 16) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 28) Secret in_b (va_get_reg 8 va_s + 2)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 402 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 17) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 29) Secret in_b (va_get_reg 8 va_s + 3)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 403 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 18) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 30) Secret in_b (va_get_reg 8 va_s + 4)) (fun (va_s:va_state) _ -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 404 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 19) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 31) Secret in_b (va_get_reg 8 va_s + 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 0)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 407 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 1)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 2)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 3)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 4)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 5)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 413 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store_3blocks128_1 out_b) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 414 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Store_3blocks128_2 out_b) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 415 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s) (va_get_mem_heaplet 1 va_s)) == ctr_enc_0) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 416 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 1) (va_get_mem_heaplet 1 va_s)) == ctr_enc_1) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 417 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 2) (va_get_mem_heaplet 1 va_s)) == ctr_enc_2) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 418 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 3) (va_get_mem_heaplet 1 va_s)) == ctr_enc_3) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 419 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 4) (va_get_mem_heaplet 1 va_s)) == ctr_enc_4) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 420 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read out_b (va_get_reg 8 va_s + 5) (va_get_mem_heaplet 1 va_s)) == ctr_enc_5) (let (va_arg64:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg63:Vale.AES.AES_common_s.algorithm) = alg in let (va_arg62:Vale.Def.Types_s.quad32) = old_icb in let (va_arg61:Prims.nat) = va_get_reg 8 va_s in let (va_arg60:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_quads in let (va_arg59:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_old_s) out_b) in let (va_arg58:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s) out_b) in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 422 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (fun (_:unit) -> Vale.AES.GCTR_BE.lemma_eq_reverse_bytes_quad32_seq va_arg58 va_arg59 va_arg60 va_arg61 va_arg62 va_arg63 va_arg64) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 424 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 8) (va_op_reg_opr_reg 8) 6) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 425 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 3) (6 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 426 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_AddImm (va_op_reg_opr_reg 7) (va_op_reg_opr_reg 7) (6 `op_Multiply` 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 427 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_quick_Vadduwm (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 13)) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))))) val va_lemma_Gctr_blocks128_6way_body : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> old_icb:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> plain_quads:(seq quad32) -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gctr_blocks128_6way_body alg) va_s0 /\ va_get_ok va_s0 /\ (va_get_reg 8 va_s0 + 5 < va_get_reg 6 va_s0 /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0) in_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) out_b (va_get_reg 8 va_s0) (va_get_reg 6 va_s0 - va_get_reg 8 va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg 3 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ va_get_reg 7 va_s0 + 6 `op_Multiply` 16 < pow2_64 /\ (Vale.PPC64LE.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)) (va_get_reg 8 va_s0) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_s0) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) key old_icb /\ va_get_reg 6 va_s0 < pow2_32 /\ va_get_vec 7 va_s0 == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_s0) /\ va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_get_vec 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_get_vec 10 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 3 0 0 0 /\ va_get_vec 11 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 4 0 0 0 /\ va_get_vec 12 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 5 0 0 0 /\ va_get_vec 13 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 6 0 0 0 /\ va_get_reg 27 va_s0 == 1 `op_Multiply` 16 /\ va_get_reg 28 va_s0 == 2 `op_Multiply` 16 /\ va_get_reg 29 va_s0 == 3 `op_Multiply` 16 /\ va_get_reg 30 va_s0 == 4 `op_Multiply` 16 /\ va_get_reg 31 va_s0 == 5 `op_Multiply` 16 /\ aes_reqs alg key round_keys keys_b (va_get_reg 4 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout 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.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b) /\ Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb /\ va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6 /\ va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6 /\ va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6 /\ va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 3 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.PPC64LE.State.fsti.checked", "Vale.PPC64LE.QuickCodes.fsti.checked", "Vale.PPC64LE.QuickCode.fst.checked", "Vale.PPC64LE.Memory.fsti.checked", "Vale.PPC64LE.Machine_s.fst.checked", "Vale.PPC64LE.InsVector.fsti.checked", "Vale.PPC64LE.InsStack.fsti.checked", "Vale.PPC64LE.InsMem.fsti.checked", "Vale.PPC64LE.InsBasic.fsti.checked", "Vale.PPC64LE.Decls.fsti.checked", "Vale.Poly1305.Math.fsti.checked", "Vale.Lib.Basic.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.Types_helpers.fsti.checked", "Vale.AES.PPC64LE.AES.fsti.checked", "Vale.AES.GCTR_BE_s.fst.checked", "Vale.AES.GCTR_BE.fsti.checked", "Vale.AES.GCM_helpers_BE.fsti.checked", "Vale.AES.AES_common_s.fst.checked", "Vale.AES.AES_BE_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.PPC64LE.GCTR.fst" }
[ { "abbrev": false, "full_module": "Vale.Lib.Basic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.Types_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_BE_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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": 20, "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 -> alg: Vale.AES.AES_common_s.algorithm -> in_b: Vale.PPC64LE.Memory.buffer128 -> out_b: Vale.PPC64LE.Memory.buffer128 -> old_icb: Vale.PPC64LE.Memory.quad32 -> key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 -> keys_b: Vale.PPC64LE.Memory.buffer128 -> plain_quads: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 -> 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.AES.AES_common_s.algorithm", "Vale.PPC64LE.Memory.buffer128", "Vale.PPC64LE.Memory.quad32", "FStar.Seq.Base.seq", "Vale.PPC64LE.Memory.nat32", "Vale.PPC64LE.QuickCodes.fuel", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "Vale.PPC64LE.Decls.va_fuel", "Vale.PPC64LE.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.PPC64LE.QuickCode.mod_t", "Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet", "Vale.PPC64LE.QuickCode.va_Mod_vec", "Vale.PPC64LE.QuickCode.va_Mod_reg", "Vale.PPC64LE.QuickCode.va_Mod_ok", "Vale.PPC64LE.QuickCode.va_Mod_mem", "Prims.Nil", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.list", "Vale.PPC64LE.QuickCode.__proj__QProc__item__mods", "Vale.AES.PPC64LE.GCTR.va_code_Gctr_blocks128_6way_body", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "Vale.PPC64LE.Machine_s.state", "Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm", "Prims.l_and", "Vale.PPC64LE.QuickCodes.label", "Vale.PPC64LE.QuickCodes.va_range1", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Decls.modifies_buffer128", "Vale.PPC64LE.Decls.va_get_mem_heaplet", "Vale.AES.GCTR_BE.partial_seq_agreement", "Vale.Arch.Types.reverse_bytes_quad32_seq", "Vale.PPC64LE.Decls.s128", "Vale.PPC64LE.Decls.va_get_reg", "Vale.PPC64LE.Decls.buffer_length", "Vale.PPC64LE.Memory.vuint128", "Vale.AES.GCTR_BE.gctr_partial_def", "Prims.int", "Prims.op_Addition", "Prims.op_Multiply", "Vale.Def.Types_s.quad32", "Vale.PPC64LE.Decls.va_get_vec", "Vale.AES.GCTR_BE.inc32lite", "Vale.PPC64LE.QuickCode.quickCode", "Vale.AES.PPC64LE.GCTR.va_qcode_Gctr_blocks128_6way_body" ]
[]
false
false
false
false
false
let va_lemma_Gctr_blocks128_6way_body va_b0 va_s0 alg in_b out_b old_icb key round_keys keys_b plain_quads =
let va_mods:va_mods_t = [ va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem ] in let va_qc = va_qcode_Gctr_blocks128_6way_body va_mods alg in_b out_b old_icb key round_keys keys_b plain_quads in let va_sM, va_fM, va_g = va_wp_sound_code_norm (va_code_Gctr_blocks128_6way_body alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 318 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 374 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.PPC64LE.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 375 column 114 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.partial_seq_agreement plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) (va_get_reg 8 va_sM) (Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 376 column 108 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (Vale.AES.GCTR_BE.gctr_partial_def alg (va_get_reg 8 va_sM) plain_quads (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)) key old_icb) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 378 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 8 va_sM == va_get_reg 8 va_s0 + 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 379 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 3 va_sM == va_get_reg 3 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 380 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_reg 7 va_sM == va_get_reg 7 va_s0 + 16 `op_Multiply` 6) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 381 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****" (va_get_vec 7 va_sM == Vale.AES.GCTR_BE.inc32lite old_icb (va_get_reg 8 va_sM)))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_reg 8; va_Mod_reg 7; va_Mod_reg 3; va_Mod_ok; va_Mod_mem ]) va_sM va_s0; (va_sM, va_fM)
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_exp_vartime
val mod_exp_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
val mod_exp_vartime: len:BN.meta_len t_limbs -> BS.bn_mod_exp_safe_st t_limbs len
let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 49, "start_col": 0, "start_line": 48 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.bits", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "Lib.IntTypes.max_size_t", "Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_check", "Hacl.Bignum32.ke", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_vt", "Prims.bool" ]
[]
false
false
false
false
false
let mod_exp_vartime len n a bBits b res =
BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res
false
HoareSTFree.fst
HoareSTFree.step
val step (#st #a: Type) (#p: mpre st) (#q: mpost st a) (f: m st a p q) (s0: st) : Div (step_result st a & st) (requires p s0) (ensures fun (r, s1) -> let Step #_ #_ #p_next #q_next g = r in weaker_p p p_next s0 s1 /\ stronger_q q q_next s0 s1)
val step (#st #a: Type) (#p: mpre st) (#q: mpost st a) (f: m st a p q) (s0: st) : Div (step_result st a & st) (requires p s0) (ensures fun (r, s1) -> let Step #_ #_ #p_next #q_next g = r in weaker_p p p_next s0 s1 /\ stronger_q q q_next s0 s1)
let step (#st:Type) (#a:Type) (#p:mpre st) (#q:mpost st a) (f:m st a p q) : s0:st -> Div (step_result st a & st) (requires p s0) (ensures fun (r, s1) -> let Step #_ #_ #p_next #q_next g = r in weaker_p p p_next s0 s1 /\ stronger_q q q_next s0 s1) = fun s0 -> match f with | Ret _ -> Step f, s0 | Act act k -> let x, s1 = act s0 in Step (k x), s1 | Weaken f -> Step f, s0 | Strengthen f -> Step (f ()), s0
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 37, "end_line": 265, "start_col": 0, "start_line": 250 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp unfold let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x let lift_PURE_M (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (pure_p wp) (pure_q wp) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f : squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t : m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t : m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t : m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t sub_effect PURE ~> M = lift_PURE_M /// Using the effect, notice how the pre- and postconditions, /// refinements are chained seamlessly assume val p : prop assume val q : prop assume val st_p : st -> prop assume val st_q : st -> prop assume ST_axiom: forall s. st_p s ==> st_q s assume val f : squash p -> M unit (fun _ -> True) (fun _ _ s1 -> squash q /\ st_p s1) assume val g : unit -> Pure unit True (fun _ -> squash p) assume val h : unit -> M unit (fun s0 -> squash q /\ st_q s0) (fun _ _ s1 -> st_p s1) let test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) = g (); f (); h () /// And now a semantic model for the free monad, proving soundness of the logic /// /// We define a definitional interpreter as a state passing function, /// that interprets the action tree /// step_result is the result of taking a single step noeq type step_result (st:Type) (a:Type) = | Step: #p:mpre st -> #q:mpost st a -> m st a p q -> step_result st a /// As computations take step, /// their preconditions become weaker, /// while the postconditions become stronger unfold let weaker_p (#st:Type) (p0 p1:mpre st) (s0 s1:st) = p0 s0 ==> p1 s1 unfold let stronger_q (#st:Type) (#a:Type) (q0 q1:mpost st a) (s0 s1:st) = forall (x:a) (s_final:st). q1 s1 x s_final ==> q0 s0 x s_final /// The single-step function
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: HoareSTFree.m st a p q -> s0: st -> FStar.Pervasives.Div (HoareSTFree.step_result st a * st)
FStar.Pervasives.Div
[]
[]
[ "HoareSTFree.mpre", "HoareSTFree.mpost", "HoareSTFree.m", "FStar.Pervasives.Native.Mktuple2", "HoareSTFree.step_result", "HoareSTFree.Step", "FStar.Pervasives.Native.tuple2", "Prims.squash", "HoareSTFree.weaken_ok", "Prims.pure_pre", "Prims.l_and", "HoareSTFree.weaker_p", "HoareSTFree.stronger_q" ]
[]
false
true
false
false
false
let step (#st #a: Type) (#p: mpre st) (#q: mpost st a) (f: m st a p q) (s0: st) : Div (step_result st a & st) (requires p s0) (ensures fun (r, s1) -> let Step #_ #_ #p_next #q_next g = r in weaker_p p p_next s0 s1 /\ stronger_q q q_next s0 s1) =
fun s0 -> match f with | Ret _ -> Step f, s0 | Act act k -> let x, s1 = act s0 in Step (k x), s1 | Weaken f -> Step f, s0 | Strengthen f -> Step (f ()), s0
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_exp_consttime_precomp
val mod_exp_consttime_precomp: len:Ghost.erased _ -> BS.bn_mod_exp_ctx_st t_limbs len
val mod_exp_consttime_precomp: len:Ghost.erased _ -> BS.bn_mod_exp_ctx_st t_limbs len
let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 70, "end_line": 73, "start_col": 0, "start_line": 71 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: FStar.Ghost.erased (Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs) -> Hacl.Bignum.SafeAPI.bn_mod_exp_ctx_st Hacl.Bignum32.t_limbs (FStar.Ghost.reveal len)
Prims.Tot
[ "total" ]
[]
[ "FStar.Ghost.erased", "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.MontArithmetic.pbn_mont_ctx", "Hacl.Bignum.Definitions.lbignum", "FStar.Ghost.reveal", "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "Lib.IntTypes.bits", "Hacl.Bignum.SafeAPI.mk_bn_mod_exp_ctx", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_ct_precomp", "Hacl.Bignum32.ke", "Prims.unit", "Hacl.Bignum.MontArithmetic.bn_field_get_len" ]
[]
false
false
false
false
false
let mod_exp_consttime_precomp len k a bBits b res =
let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res
false
Hacl.Bignum32.fst
Hacl.Bignum32.bn_to_bytes_le
val bn_to_bytes_le: len:_ -> Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs len
val bn_to_bytes_le: len:_ -> Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs len
let bn_to_bytes_le len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_le false len b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 90, "start_col": 0, "start_line": 89 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res let new_bn_from_bytes_be r len b = BS.new_bn_from_bytes_be r len b let new_bn_from_bytes_le r len b = BS.new_bn_from_bytes_le r len b let bn_to_bytes_be len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_be false len b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Lib.IntTypes.size_t { 0 < Lib.IntTypes.v len /\ Lib.IntTypes.numbytes Hacl.Bignum32.t_limbs * Lib.IntTypes.v (Hacl.Bignum.Definitions.blocks len (Lib.IntTypes.size (Lib.IntTypes.numbytes Hacl.Bignum32.t_limbs))) <= Lib.IntTypes.max_size_t } -> Hacl.Bignum.Convert.bn_to_bytes_le_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.numbytes", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.blocks", "Lib.IntTypes.size", "Lib.IntTypes.max_size_t", "Hacl.Bignum.Definitions.lbignum", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Bignum.Convert.mk_bn_to_bytes_le", "Prims.unit" ]
[]
false
false
false
false
false
let bn_to_bytes_le len b res =
Hacl.Bignum.Convert.mk_bn_to_bytes_le false len b res
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_mod_mul_distr
val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n)
val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n)
let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 23, "start_col": 0, "start_line": 21 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.int -> n: Prims.pos -> FStar.Pervasives.Lemma (ensures a * b % n = (a % n) * (b % n) % n)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.pos", "FStar.Math.Lemmas.lemma_mod_mul_distr_r", "Prims.op_Modulus", "Prims.unit", "FStar.Math.Lemmas.lemma_mod_mul_distr_l" ]
[]
true
false
true
false
false
let lemma_mod_mul_distr a b n =
Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n
false
HoareSTFree.fst
HoareSTFree.test
val test: Prims.unit -> M unit (fun _ -> True) (fun _ _ s1 -> st_q s1)
val test: Prims.unit -> M unit (fun _ -> True) (fun _ _ s1 -> st_q s1)
let test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) = g (); f (); h ()
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 6, "end_line": 222, "start_col": 0, "start_line": 219 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f /// subcomp simply wraps in a Weaken node let subcomp (a:Type) (f_p:pre) (f_q:post a) (g_p:pre) (g_q:post a) (f:repr a f_p f_q) : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True) = fun _ -> Weaken (f ()) /// And that's it! effect { M (a:Type) (p:pre) (q:post a) with {repr; return; bind; subcomp} } /// We now define a lift from PURE unfold let pure_p (#a:Type) (wp:pure_wp a) : pre = fun _ -> as_requires wp unfold let pure_q (#a:Type) (wp:pure_wp a) : post a = fun s0 x s1 -> s0 == s1 /\ as_ensures wp x let lift_PURE_M (a:Type) (wp:pure_wp a) (f:unit -> PURE a wp) : repr a (pure_p wp) (pure_q wp) = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp; fun _ -> let f : squash (as_requires wp) -> Dv (m st a (fun s0 -> True) (pure_q wp)) = fun _ -> let x = f () in let t : m st a (fun s0 -> s0 == s0 /\ as_ensures wp x) (pure_q wp) = Ret x in let t : m st a (fun _ -> True) (pure_q wp) = Weaken t in t in let t : m st a (strengthen_pre (fun _ -> True) (as_requires wp)) (pure_q wp) = Strengthen f in Weaken t sub_effect PURE ~> M = lift_PURE_M /// Using the effect, notice how the pre- and postconditions, /// refinements are chained seamlessly assume val p : prop assume val q : prop assume val st_p : st -> prop assume val st_q : st -> prop assume ST_axiom: forall s. st_p s ==> st_q s assume val f : squash p -> M unit (fun _ -> True) (fun _ _ s1 -> squash q /\ st_p s1) assume val g : unit -> Pure unit True (fun _ -> squash p) assume val h : unit -> M unit (fun s0 -> squash q /\ st_q s0) (fun _ _ s1 -> st_p s1)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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 -> HoareSTFree.M Prims.unit
HoareSTFree.M
[]
[]
[ "Prims.unit", "HoareSTFree.h", "HoareSTFree.f", "HoareSTFree.g", "HoareSTFree.st", "Prims.l_True", "HoareSTFree.st_q" ]
[]
false
true
false
false
false
let test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) =
g (); f (); h ()
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_ab_le_cd
val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d)
val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d)
let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 37, "start_col": 0, "start_line": 35 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.nat -> b: Prims.nat -> c: Prims.nat -> d: Prims.nat -> FStar.Pervasives.Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "FStar.Math.Lemmas.lemma_mult_le_right", "Prims.unit", "FStar.Math.Lemmas.lemma_mult_le_left" ]
[]
true
false
true
false
false
let lemma_ab_le_cd a b c d =
Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_swap_mul3
val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b)
val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b)
let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 17, "start_col": 0, "start_line": 8 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.int -> c: Prims.int -> FStar.Pervasives.Lemma (ensures (a * b) * c == (a * c) * b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "FStar.Calc.calc_finish", "Prims.eq2", "FStar.Mul.op_Star", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.paren_mul_right", "Prims.squash", "FStar.Math.Lemmas.swap_mul" ]
[]
false
false
true
false
false
let lemma_swap_mul3 a b c =
calc ( == ) { (a * b) * c; ( == ) { Math.Lemmas.paren_mul_right a b c } a * (b * c); ( == ) { Math.Lemmas.swap_mul b c } a * (c * b); ( == ) { Math.Lemmas.paren_mul_right a c b } (a * c) * b; }
false
Apply.fst
Apply.lem1
val lem1 : Prims.unit
let lem1 = assert (x == x) by tau ()
{ "file_name": "examples/native_tactics/Apply.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 36, "end_line": 30, "start_col": 0, "start_line": 30 }
(* 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 Apply open FStar.Mul open FStar.Tactics.V2 assume val x : int val refl : (a:Type) -> (x:a) -> Lemma (x == x) let refl a x = () [@@plugin] let tau () : Tac unit = apply_lemma (`refl)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Apply.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
Prims.Tot
[ "total" ]
[]
[ "FStar.Tactics.Effect.assert_by_tactic", "Prims.eq2", "Prims.int", "Apply.x", "Prims.unit", "Apply.tau" ]
[]
false
false
false
true
false
let lem1 =
FStar.Tactics.Effect.assert_by_tactic (x == x) (fun _ -> (); tau ())
false
Apply.fst
Apply.tau
val tau: Prims.unit -> Tac unit
val tau: Prims.unit -> Tac unit
let tau () : Tac unit = apply_lemma (`refl)
{ "file_name": "examples/native_tactics/Apply.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 23, "end_line": 28, "start_col": 0, "start_line": 27 }
(* 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 Apply open FStar.Mul open FStar.Tactics.V2 assume val x : int val refl : (a:Type) -> (x:a) -> Lemma (x == x) let refl a x = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Apply.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.apply_lemma" ]
[]
false
true
false
false
false
let tau () : Tac unit =
apply_lemma (`refl)
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_mod_sub_distr
val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n)
val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n)
let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 45, "end_line": 29, "start_col": 0, "start_line": 27 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.int -> n: Prims.pos -> FStar.Pervasives.Lemma (ensures (a - b) % n = (a % n - b % n) % n)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.pos", "FStar.Math.Lemmas.lemma_mod_sub_distr", "Prims.op_Modulus", "Prims.unit", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "Prims.op_Minus" ]
[]
true
false
true
false
false
let lemma_mod_sub_distr a b n =
Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n
false
HoareSTFree.fst
HoareSTFree.bind
val bind (a b: Type) (f_p: pre) (f_q: post a) (g_p: (a -> pre)) (g_q: (a -> post b)) (f: repr a f_p f_q) (g: (x: a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q)
val bind (a b: Type) (f_p: pre) (f_q: post a) (g_p: (a -> pre)) (g_q: (a -> post b)) (f: repr a f_p f_q) (g: (x: a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q)
let rec bind (a b:Type) (f_p:pre) (f_q:post a) (g_p:a -> pre) (g_q:a -> post b) (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) = fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f
{ "file_name": "examples/layeredeffects/HoareSTFree.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 157, "start_col": 0, "start_line": 139 }
(* Copyright 2008-2022 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. Author: Aseem Rastogi *) /// This module derives a Hoare-style state effect using a free monad representation /// /// There are several design considerations to make such an effect /// work well within F*: /// /// - The effect should support a subsumption relation that allows for /// strengthening of preconditions and weakening of postconditions /// - The effect should play nicely with pure pre- and postconditions, /// i.e. they should be integrated with the hoare indices of the state effect /// Squash types, refinements, lemmas, etc. are quite commonplace in F*, /// and so, the effect should work seamlessly with them /// /// - Then there are other considerations such as bind should be doubly /// universe polymorphic, etc. /// /// See also https://fstar-lang.org/oplss2021/code/OPLSS2021.ParDiv.fst /// for another attempt, /// The current module enhances it by providing a better integrated PURE effect /// /// The main trick is to add a Strengthen node in the action tree that /// strengthens the precondition with a prop module HoareSTFree open FStar.Monotonic.Pure /// type of pre and postconditions, parameteric in the state type type mpre (st:Type) = st -> Type0 type mpost (st:Type) (a:Type) = st -> a -> st -> Type0 /// The free monad would contain an Act node, /// that has an atomic action, followed by a continuation k /// /// The following combinators are for the pre- and postcondition of /// the Act node (derived from the action and k pre and post) /// /// They are basically the bind hoare logic rule unfold let act_p (#st:Type) (#a:Type) (a_p:mpre st) (a_q:mpost st a) (k_p:a -> mpre st) : mpre st = fun s0 -> a_p s0 /\ (forall (x:a) (s1:st). a_q s0 x s1 ==> k_p x s1) unfold let act_q (#st:Type) (#a:Type) (#b:Type) (a_q:mpost st a) (k_q:a -> mpost st b) : mpost st b = fun s0 y s2 -> exists (x:a) (s1:st). a_q s0 x s1 /\ k_q x s1 y s2 /// Logical guard for the rule of consequence, i.e. weakening /// {p0} c {q0} to {p1} c {q1} unfold let weaken_ok (#st:Type) (#a:Type) (p0:mpre st) (q0:mpost st a) (p1:mpre st) (q1:mpost st a) : Type0 = (forall (s:st). p1 s ==> p0 s) /\ (forall (s0:st) (x:a) (s1:st). p1 s0 ==> q0 s0 x s1 ==> q1 s0 x s1) /// Precondition of the strengthen node (that strengthens precondition with a pure prop) unfold let strengthen_pre (#st:Type) (p:mpre st) (phi:pure_pre) : mpre st = fun s -> p s /\ phi /// A free monad for divergence and state /// /// It can also be made total, by indexing with a nat that /// counts number of actions in the tree /// /// See https://fstar-lang.org/oplss2021/code/OPLSS2021.ParTot.fst noeq type m (st:Type u#s) : a:Type u#a -> p:mpre st -> q:mpost st a -> Type = | Ret: //parametric on the postcondition q #a:Type -> #q:mpost st a -> x:a -> m st a (fun s0 -> q s0 x s0) q | Act: #a:Type -> #a_p:mpre st -> #a_q:mpost st a -> act:(s0:st -> Pure (a & st) (a_p s0) (fun (x, s1) -> a_q s0 x s1)) -> //atomic action #b:Type -> #k_p:(a -> mpre st) -> #k_q:(a -> mpost st b) -> k:(x:a -> Dv (m st b (k_p x) (k_q x))) -> m st b (act_p a_p a_q k_p) (act_q a_q k_q) | Weaken: #a:Type -> #p0:mpre st -> #q0:mpost st a -> #p1:mpre st -> #q1:mpost st a -> #squash (weaken_ok p0 q0 p1 q1) -> f:m st a p0 q0 -> m st a p1 q1 | Strengthen: //strengthening the precondition with phi #a:Type -> #phi:pure_pre -> #p:mpre st -> #q:mpost st a -> f:(squash phi -> Dv (m st a p q)) -> m st a (strengthen_pre p phi) q /// We first define the effect, /// later we will give a semantic model and prove soundness of the logic /// with a definitional interpreter /// Underlying representation is a thunked tree /// /// Our free monad is parametric in the state (and also its universe), /// for defining an effect we fix the state type assume val st : Type u#1 type pre = st -> Type0 type post (a:Type) = st -> a -> st -> Type0 type repr (a:Type) (p:pre) (q:post a) = unit -> Dv (m st a p q) /// return is simple, use the Ret node let return (a:Type) (x:a) (q:post a) : repr a (fun s0 -> q s0 x s0) q = fun _ -> Ret x /// bind pushes the continuation g inside the tree /// /// When f is a Ret, apply the result to the continuation /// /// Note the indices of the return type, this is the hoare logic we want
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked" ], "interface_file": false, "source_file": "HoareSTFree.fst" }
[ { "abbrev": false, "full_module": "FStar.Monotonic.Pure", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> b: Type -> f_p: HoareSTFree.pre -> f_q: HoareSTFree.post a -> g_p: (_: a -> HoareSTFree.pre) -> g_q: (_: a -> HoareSTFree.post b) -> f: HoareSTFree.repr a f_p f_q -> g: (x: a -> HoareSTFree.repr b (g_p x) (g_q x)) -> HoareSTFree.repr b (HoareSTFree.act_p f_p f_q g_p) (HoareSTFree.act_q f_q g_q)
Prims.Tot
[ "total" ]
[]
[ "HoareSTFree.pre", "HoareSTFree.post", "HoareSTFree.repr", "Prims.unit", "HoareSTFree.mpost", "HoareSTFree.st", "HoareSTFree.Weaken", "HoareSTFree.act_p", "HoareSTFree.act_q", "HoareSTFree.m", "HoareSTFree.mpre", "FStar.Pervasives.Native.tuple2", "Prims.l_and", "Prims.l_Forall", "Prims.l_imp", "Prims.l_Exists", "HoareSTFree.Act", "HoareSTFree.bind", "Prims.squash", "HoareSTFree.weaken_ok", "Prims.pure_pre", "HoareSTFree.Strengthen" ]
[ "recursion" ]
false
false
false
false
false
let rec bind (a b: Type) (f_p: pre) (f_q: post a) (g_p: (a -> pre)) (g_q: (a -> post b)) (f: repr a f_p f_q) (g: (x: a -> repr b (g_p x) (g_q x))) : repr b (act_p f_p f_q g_p) (act_q f_q g_q) =
fun _ -> let f = f () in match f with | Ret x -> Weaken (g x ()) | Act #_ #c #a_p #a_q act #_ #_ #_ k -> let k' = fun (x: c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k') | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ()) | Strengthen #_ #_ #phi #p #q f -> let f: squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) = fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in let f:m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) = Strengthen f in Weaken f
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_ab_lt_cd
val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d)
val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d)
let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 39, "end_line": 45, "start_col": 0, "start_line": 43 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.pos -> b: Prims.pos -> c: Prims.pos -> d: Prims.pos -> FStar.Pervasives.Lemma (requires a < c /\ b < d) (ensures a * b < c * d)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.pos", "FStar.Math.Lemmas.lemma_mult_lt_right", "Prims.unit", "FStar.Math.Lemmas.lemma_mult_lt_left" ]
[]
true
false
true
false
false
let lemma_ab_lt_cd a b c d =
Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_distr_pow
val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d))
val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d))
let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 77, "start_col": 0, "start_line": 70 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.int -> c: Prims.nat -> d: Prims.nat -> FStar.Pervasives.Lemma (ensures (a + b * Prims.pow2 c) * Prims.pow2 d = a * Prims.pow2 d + b * Prims.pow2 (c + d))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.nat", "FStar.Calc.calc_finish", "Prims.eq2", "FStar.Mul.op_Star", "Prims.op_Addition", "Prims.pow2", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.distributivity_add_left", "Prims.squash", "FStar.Math.Lemmas.pow2_plus", "FStar.Math.Lemmas.paren_mul_right" ]
[]
false
false
true
false
false
let lemma_distr_pow a b c d =
calc ( == ) { (a + b * pow2 c) * pow2 d; ( == ) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + (b * pow2 c) * pow2 d; ( == ) { (Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d) } a * pow2 d + b * pow2 (c + d); }
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_distr_pow_pow
val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e))
val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e))
let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 89, "start_col": 0, "start_line": 82 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) :
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.nat -> c: Prims.int -> d: Prims.nat -> e: Prims.nat -> FStar.Pervasives.Lemma (ensures (a * Prims.pow2 b + c * Prims.pow2 d) * Prims.pow2 e = a * Prims.pow2 (b + e) + c * Prims.pow2 (d + e))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.nat", "FStar.Calc.calc_finish", "Prims.eq2", "FStar.Mul.op_Star", "Prims.op_Addition", "Prims.pow2", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Hacl.Spec.K256.MathLemmas.lemma_distr_pow", "Prims.squash", "FStar.Math.Lemmas.pow2_plus", "FStar.Math.Lemmas.paren_mul_right" ]
[]
false
false
true
false
false
let lemma_distr_pow_pow a b c d e =
calc ( == ) { (a * pow2 b + c * pow2 d) * pow2 e; ( == ) { lemma_distr_pow (a * pow2 b) c d e } (a * pow2 b) * pow2 e + c * pow2 (d + e); ( == ) { (Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e) } a * pow2 (b + e) + c * pow2 (d + e); }
false
Steel.Closure.fst
Steel.Closure.new_counter
val new_counter (u:unit) : SteelT ctr_t emp (fun r -> dfst r 0)
val new_counter (u:unit) : SteelT ctr_t emp (fun r -> dfst r 0)
let new_counter = new_counter'
{ "file_name": "lib/steel/Steel.Closure.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 30, "end_line": 47, "start_col": 0, "start_line": 47 }
(* Copyright 2020 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.Closure open Steel.Memory open Steel.Effect.Atomic open Steel.Effect open Steel.Reference open Steel.FractionalPermission [@@__reduce__] let repr (r:ref int) (x:int) = pts_to r full_perm (hide x) let ctr (r:ref int) = prev:erased int -> SteelT (y:int{y == prev + 1}) (repr r prev) (repr r) let next (r:ref int) (prev:erased int) : SteelT (y:int{y == prev + 1}) (repr r prev) (repr r) = let v = read_pt r in let (x:int { x == prev + 1 }) = v + 1 in write_pt r x; x val new_counter' (u:unit) : SteelT ctr_t emp (fun r -> dfst r 0) let new_counter' () = let x = alloc_pt 0 in let f : ctr x = next x in let res : ctr_t = (| repr x, f |) in rewrite_slprop (repr x 0) (dfst res 0) (fun _ -> ()); return res
{ "checked_file": "/", "dependencies": [ "Steel.Reference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Steel.Closure.fst" }
[ { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
u16: Prims.unit -> Steel.Effect.SteelT Steel.Closure.ctr_t
Steel.Effect.SteelT
[]
[]
[ "Steel.Closure.new_counter'" ]
[]
false
true
false
false
false
let new_counter =
new_counter'
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_distr_eucl
val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52)
val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52)
let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52)
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 123, "start_col": 0, "start_line": 123 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.int -> FStar.Pervasives.Lemma (ensures (a / Prims.pow2 52 + b) * Prims.pow2 52 + a % Prims.pow2 52 = a + b * Prims.pow2 52)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul_add", "Prims.pow2", "Prims.unit" ]
[]
true
false
true
false
false
let lemma_distr_eucl a b =
lemma_distr_eucl_mul_add 1 a b (pow2 52)
false
Hacl.Bignum32.fst
Hacl.Bignum32.mul
val mul: len:BN.meta_len t_limbs -> a:lbignum t_limbs len -> BN.bn_karatsuba_mul_st t_limbs len a
val mul: len:BN.meta_len t_limbs -> a:lbignum t_limbs len -> BN.bn_karatsuba_mul_st t_limbs len a
let mul len a b res = (ke len).BE.bn.BN.mul a b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 36, "start_col": 0, "start_line": 35 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> a: Hacl.Bignum32.lbignum Hacl.Bignum32.t_limbs len -> Hacl.Bignum.bn_karatsuba_mul_st Hacl.Bignum32.t_limbs len a
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum32.lbignum", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.__proj__Mkbn__item__mul", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn", "Hacl.Bignum32.ke", "Prims.unit" ]
[]
false
false
false
false
false
let mul len a b res =
(ke len).BE.bn.BN.mul a b res
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_bound_mul64_wide
val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb))
val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb))
let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 66, "start_col": 0, "start_line": 52 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ma: Prims.nat -> mb: Prims.nat -> mma: Prims.nat -> mmb: Prims.nat -> a: Prims.nat -> b: Prims.nat -> FStar.Pervasives.Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= (ma * mb) * (mma * mmb))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "FStar.Calc.calc_finish", "Prims.int", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Prims.Cons", "FStar.Preorder.relation", "Prims.eq2", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Hacl.Spec.K256.MathLemmas.lemma_ab_le_cd", "Prims.squash", "FStar.Math.Lemmas.paren_mul_right", "FStar.Math.Lemmas.swap_mul" ]
[]
false
false
true
false
false
let lemma_bound_mul64_wide ma mb mma mmb a b =
calc ( <= ) { a * b; ( <= ) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); ( == ) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); ( == ) { (Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb) } ma * (mb * (mma * mmb)); ( == ) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } (ma * mb) * (mma * mmb); }
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_a_plus_b_pow2_mod2
val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2)
val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2)
let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 130, "start_col": 0, "start_line": 127 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.int -> b: Prims.int -> c: Prims.pos -> FStar.Pervasives.Lemma (ensures (a + b * Prims.pow2 c) % 2 = a % 2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.pos", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_1", "Prims.unit", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.Mul.op_Star", "Prims.pow2", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality" ]
[]
true
false
true
false
false
let lemma_a_plus_b_pow2_mod2 a b c =
assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c
false
Hacl.Bignum32.fst
Hacl.Bignum32.mod_exp_vartime_precomp
val mod_exp_vartime_precomp: len:Ghost.erased _ -> BS.bn_mod_exp_ctx_st t_limbs len
val mod_exp_vartime_precomp: len:Ghost.erased _ -> BS.bn_mod_exp_ctx_st t_limbs len
let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 70, "end_line": 69, "start_col": 0, "start_line": 67 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: FStar.Ghost.erased (Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs) -> Hacl.Bignum.SafeAPI.bn_mod_exp_ctx_st Hacl.Bignum32.t_limbs (FStar.Ghost.reveal len)
Prims.Tot
[ "total" ]
[]
[ "FStar.Ghost.erased", "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.MontArithmetic.pbn_mont_ctx", "Hacl.Bignum.Definitions.lbignum", "FStar.Ghost.reveal", "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "Lib.IntTypes.bits", "Hacl.Bignum.SafeAPI.mk_bn_mod_exp_ctx", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_vt_precomp", "Hacl.Bignum32.ke", "Prims.unit", "Hacl.Bignum.MontArithmetic.bn_field_get_len" ]
[]
false
false
false
false
false
let mod_exp_vartime_precomp len k a bBits b res =
let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul
val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a)
val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a)
let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 102, "start_col": 0, "start_line": 93 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Prims.int -> a: Prims.int -> b: Prims.pos -> FStar.Pervasives.Lemma (ensures r * (a % b) + (r * (a / b)) * b = r * a)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.pos", "FStar.Calc.calc_finish", "Prims.eq2", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.op_Modulus", "Prims.op_Division", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.paren_mul_right", "Prims.squash", "FStar.Math.Lemmas.distributivity_add_right", "FStar.Math.Lemmas.euclidean_division_definition" ]
[]
false
false
true
false
false
let lemma_distr_eucl_mul r a b =
calc ( == ) { r * (a % b) + (r * (a / b)) * b; ( == ) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); ( == ) { Math.Lemmas.distributivity_add_right r (a % b) ((a / b) * b) } r * (a % b + (a / b) * b); ( == ) { Math.Lemmas.euclidean_division_definition a b } r * a; }
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_a_div_b_plus_c_mod_d_mul_e
val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma (requires a / pow2 b < pow2 e) (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e))
val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma (requires a / pow2 b < pow2 e) (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e))
let lemma_a_div_b_plus_c_mod_d_mul_e a b c d e = let t_r = c % pow2 d * pow2 e in Math.Lemmas.lemma_mult_le_right (pow2 e) (c % pow2 d) (pow2 d - 1); assert (t_r <= (pow2 d - 1) * pow2 e); assert (t_r <= pow2 d * pow2 e - pow2 e); Math.Lemmas.pow2_plus d e; assert (t_r <= pow2 (d + e) - pow2 e); assert (a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e))
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 265, "start_col": 0, "start_line": 258 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52) val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2) let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0) let lemma_as_nat64_horner r0 r1 r2 r3 = calc (==) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); (==) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; (==) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; (==) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; (==) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; (==) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; } val lemma_as_nat_horner (r0 r1 r2 r3 r4:int) : Lemma (r0 + r1 * pow2 52 + r2 * pow2 104 + r3 * pow2 156 + r4 * pow2 208 == (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0) let lemma_as_nat_horner r0 r1 r2 r3 r4 = calc (==) { (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0; (==) { lemma_distr_pow r1 ((r4 * pow2 52 + r3) * pow2 52 + r2) 52 52 } ((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r2 (r4 * pow2 52 + r3) 52 104 } (r4 * pow2 52 + r3) * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r3 r4 52 156 } r4 * pow2 208 + r3 * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; } val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b) let lemma_distr5 a0 a1 a2 a3 a4 b = calc (==) { (a0 + a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b } a0 * b + (a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b } a0 * b + a1 * b + (a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b } a0 * b + a1 * b + a2 * b + (a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a3 a4 b } a0 * b + a1 * b + a2 * b + a3 * b + a4 * b; } val lemma_distr5_pow52 (a b0 b1 b2 b3 b4:int) : Lemma (a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) let lemma_distr5_pow52 a b0 b1 b2 b3 b4 = calc (==) { a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208); (==) { lemma_distr5 b0 (b1 * pow2 52) (b2 * pow2 104) (b3 * pow2 156) (b4 * pow2 208) a } b0 * a + b1 * pow2 52 * a + b2 * pow2 104 * a + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b1 (pow2 52) a; lemma_swap_mul3 b2 (pow2 104) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b3 (pow2 156) a; lemma_swap_mul3 b4 (pow2 208) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * a * pow2 156 + b4 * a * pow2 208; } val lemma_distr5_pow52_mul_pow (a b0 b1 b2 b3 b4: int) (p:nat) : Lemma (a * pow2 p * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p)) let lemma_distr5_pow52_mul_pow a b0 b1 b2 b3 b4 p = let b_sum = b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208 in calc (==) { a * pow2 p * b_sum; (==) { lemma_swap_mul3 a (pow2 p) b_sum } a * b_sum * pow2 p; (==) { lemma_distr5_pow52 a b0 b1 b2 b3 b4 } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) * pow2 p; (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) (a * b4) 208 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) * pow2 p + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) (a * b3) 156 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) * pow2 p + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52) (a * b2) 104 p } (a * b0 + a * b1 * pow2 52) * pow2 p + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0) (a * b1) 52 p } a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); } val lemma_distr5_pow52_sub (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c:int) : Lemma ((b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208 == (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208)) let lemma_distr5_pow52_sub a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c = calc (==) { (b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b1 * c) a1 (pow2 52) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b2 * c) a2 (pow2 104) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b3 * c) a3 (pow2 156) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b4 * c) a4 (pow2 208) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + c * b4 * pow2 208 - a4 * pow2 208; (==) { lemma_distr5_pow52 c b0 b1 b2 b3 b4 } (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208); } val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma (requires a / pow2 b < pow2 e) (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.nat -> b: Prims.nat -> c: Prims.nat -> d: Prims.nat -> e: Prims.nat -> FStar.Pervasives.Lemma (requires a / Prims.pow2 b < Prims.pow2 e) (ensures a / Prims.pow2 b + (c % Prims.pow2 d) * Prims.pow2 e < Prims.pow2 (d + e))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims._assert", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Addition", "Prims.op_Division", "Prims.pow2", "FStar.Mul.op_Star", "Prims.op_Modulus", "Prims.unit", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "FStar.Math.Lemmas.pow2_plus", "FStar.Math.Lemmas.lemma_mult_le_right", "Prims.int" ]
[]
true
false
true
false
false
let lemma_a_div_b_plus_c_mod_d_mul_e a b c d e =
let t_r = (c % pow2 d) * pow2 e in Math.Lemmas.lemma_mult_le_right (pow2 e) (c % pow2 d) (pow2 d - 1); assert (t_r <= (pow2 d - 1) * pow2 e); assert (t_r <= pow2 d * pow2 e - pow2 e); Math.Lemmas.pow2_plus d e; assert (t_r <= pow2 (d + e) - pow2 e); assert (a / pow2 b + (c % pow2 d) * pow2 e < pow2 (d + e))
false
Hacl.Bignum32.fst
Hacl.Bignum32.sqr
val sqr: len:BN.meta_len t_limbs -> a:lbignum t_limbs len -> BN.bn_karatsuba_sqr_st t_limbs len a
val sqr: len:BN.meta_len t_limbs -> a:lbignum t_limbs len -> BN.bn_karatsuba_sqr_st t_limbs len a
let sqr len a res = (ke len).BE.bn.BN.sqr a res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 39, "start_col": 0, "start_line": 38 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len Hacl.Bignum32.t_limbs -> a: Hacl.Bignum32.lbignum Hacl.Bignum32.t_limbs len -> Hacl.Bignum.bn_karatsuba_sqr_st Hacl.Bignum32.t_limbs len a
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.meta_len", "Hacl.Bignum32.t_limbs", "Hacl.Bignum32.lbignum", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.__proj__Mkbn__item__sqr", "Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn", "Hacl.Bignum32.ke", "Prims.unit" ]
[]
false
false
false
false
false
let sqr len a res =
(ke len).BE.bn.BN.sqr a res
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_distr5
val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b)
val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b)
let lemma_distr5 a0 a1 a2 a3 a4 b = calc (==) { (a0 + a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b } a0 * b + (a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b } a0 * b + a1 * b + (a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b } a0 * b + a1 * b + a2 * b + (a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a3 a4 b } a0 * b + a1 * b + a2 * b + a3 * b + a4 * b; }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 183, "start_col": 0, "start_line": 172 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52) val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2) let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0) let lemma_as_nat64_horner r0 r1 r2 r3 = calc (==) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); (==) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; (==) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; (==) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; (==) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; (==) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; } val lemma_as_nat_horner (r0 r1 r2 r3 r4:int) : Lemma (r0 + r1 * pow2 52 + r2 * pow2 104 + r3 * pow2 156 + r4 * pow2 208 == (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0) let lemma_as_nat_horner r0 r1 r2 r3 r4 = calc (==) { (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0; (==) { lemma_distr_pow r1 ((r4 * pow2 52 + r3) * pow2 52 + r2) 52 52 } ((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r2 (r4 * pow2 52 + r3) 52 104 } (r4 * pow2 52 + r3) * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r3 r4 52 156 } r4 * pow2 208 + r3 * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; } val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a0: Prims.int -> a1: Prims.int -> a2: Prims.int -> a3: Prims.int -> a4: Prims.int -> b: Prims.int -> FStar.Pervasives.Lemma (ensures (a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "FStar.Calc.calc_finish", "Prims.eq2", "FStar.Mul.op_Star", "Prims.op_Addition", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.distributivity_add_left", "Prims.squash" ]
[]
false
false
true
false
false
let lemma_distr5 a0 a1 a2 a3 a4 b =
calc ( == ) { (a0 + a1 + a2 + a3 + a4) * b; ( == ) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b } a0 * b + (a1 + a2 + a3 + a4) * b; ( == ) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b } a0 * b + a1 * b + (a2 + a3 + a4) * b; ( == ) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b } a0 * b + a1 * b + a2 * b + (a3 + a4) * b; ( == ) { Math.Lemmas.distributivity_add_left a3 a4 b } a0 * b + a1 * b + a2 * b + a3 * b + a4 * b; }
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_a_mod_b_mul_c_mod_d
val lemma_a_mod_b_mul_c_mod_d (a b c d:nat) : Lemma (requires c <= d /\ b <= d - c) (ensures (a % pow2 b) * pow2 c % pow2 d = (a % pow2 b) * pow2 c)
val lemma_a_mod_b_mul_c_mod_d (a b c d:nat) : Lemma (requires c <= d /\ b <= d - c) (ensures (a % pow2 b) * pow2 c % pow2 d = (a % pow2 b) * pow2 c)
let lemma_a_mod_b_mul_c_mod_d a b c d = Math.Lemmas.pow2_multiplication_modulo_lemma_2 (a % pow2 b) d c; Math.Lemmas.pow2_modulo_modulo_lemma_2 a (d - c) b
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 52, "end_line": 274, "start_col": 0, "start_line": 272 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52) val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2) let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0) let lemma_as_nat64_horner r0 r1 r2 r3 = calc (==) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); (==) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; (==) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; (==) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; (==) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; (==) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; } val lemma_as_nat_horner (r0 r1 r2 r3 r4:int) : Lemma (r0 + r1 * pow2 52 + r2 * pow2 104 + r3 * pow2 156 + r4 * pow2 208 == (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0) let lemma_as_nat_horner r0 r1 r2 r3 r4 = calc (==) { (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0; (==) { lemma_distr_pow r1 ((r4 * pow2 52 + r3) * pow2 52 + r2) 52 52 } ((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r2 (r4 * pow2 52 + r3) 52 104 } (r4 * pow2 52 + r3) * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r3 r4 52 156 } r4 * pow2 208 + r3 * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; } val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b) let lemma_distr5 a0 a1 a2 a3 a4 b = calc (==) { (a0 + a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b } a0 * b + (a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b } a0 * b + a1 * b + (a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b } a0 * b + a1 * b + a2 * b + (a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a3 a4 b } a0 * b + a1 * b + a2 * b + a3 * b + a4 * b; } val lemma_distr5_pow52 (a b0 b1 b2 b3 b4:int) : Lemma (a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) let lemma_distr5_pow52 a b0 b1 b2 b3 b4 = calc (==) { a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208); (==) { lemma_distr5 b0 (b1 * pow2 52) (b2 * pow2 104) (b3 * pow2 156) (b4 * pow2 208) a } b0 * a + b1 * pow2 52 * a + b2 * pow2 104 * a + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b1 (pow2 52) a; lemma_swap_mul3 b2 (pow2 104) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b3 (pow2 156) a; lemma_swap_mul3 b4 (pow2 208) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * a * pow2 156 + b4 * a * pow2 208; } val lemma_distr5_pow52_mul_pow (a b0 b1 b2 b3 b4: int) (p:nat) : Lemma (a * pow2 p * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p)) let lemma_distr5_pow52_mul_pow a b0 b1 b2 b3 b4 p = let b_sum = b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208 in calc (==) { a * pow2 p * b_sum; (==) { lemma_swap_mul3 a (pow2 p) b_sum } a * b_sum * pow2 p; (==) { lemma_distr5_pow52 a b0 b1 b2 b3 b4 } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) * pow2 p; (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) (a * b4) 208 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) * pow2 p + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) (a * b3) 156 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) * pow2 p + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52) (a * b2) 104 p } (a * b0 + a * b1 * pow2 52) * pow2 p + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0) (a * b1) 52 p } a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); } val lemma_distr5_pow52_sub (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c:int) : Lemma ((b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208 == (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208)) let lemma_distr5_pow52_sub a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c = calc (==) { (b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b1 * c) a1 (pow2 52) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b2 * c) a2 (pow2 104) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b3 * c) a3 (pow2 156) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b4 * c) a4 (pow2 208) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + c * b4 * pow2 208 - a4 * pow2 208; (==) { lemma_distr5_pow52 c b0 b1 b2 b3 b4 } (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208); } val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma (requires a / pow2 b < pow2 e) (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e)) let lemma_a_div_b_plus_c_mod_d_mul_e a b c d e = let t_r = c % pow2 d * pow2 e in Math.Lemmas.lemma_mult_le_right (pow2 e) (c % pow2 d) (pow2 d - 1); assert (t_r <= (pow2 d - 1) * pow2 e); assert (t_r <= pow2 d * pow2 e - pow2 e); Math.Lemmas.pow2_plus d e; assert (t_r <= pow2 (d + e) - pow2 e); assert (a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e)) val lemma_a_mod_b_mul_c_mod_d (a b c d:nat) : Lemma (requires c <= d /\ b <= d - c) (ensures (a % pow2 b) * pow2 c % pow2 d = (a % pow2 b) * pow2 c)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.nat -> b: Prims.nat -> c: Prims.nat -> d: Prims.nat -> FStar.Pervasives.Lemma (requires c <= d /\ b <= d - c) (ensures (a % Prims.pow2 b) * Prims.pow2 c % Prims.pow2 d = (a % Prims.pow2 b) * Prims.pow2 c)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_2", "Prims.op_Subtraction", "Prims.unit", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_2", "Prims.op_Modulus", "Prims.pow2" ]
[]
true
false
true
false
false
let lemma_a_mod_b_mul_c_mod_d a b c d =
Math.Lemmas.pow2_multiplication_modulo_lemma_2 (a % pow2 b) d c; Math.Lemmas.pow2_modulo_modulo_lemma_2 a (d - c) b
false
Hacl.Bignum32.fst
Hacl.Bignum32.bn_to_bytes_be
val bn_to_bytes_be: len:_ -> Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs len
val bn_to_bytes_be: len:_ -> Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs len
let bn_to_bytes_be len b res = Hacl.Bignum.Convert.mk_bn_to_bytes_be false len b res
{ "file_name": "code/bignum/Hacl.Bignum32.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 87, "start_col": 0, "start_line": 86 }
module Hacl.Bignum32 open FStar.Mul module BN = Hacl.Bignum module BE = Hacl.Bignum.Exponentiation module BR = Hacl.Bignum.ModReduction module AM = Hacl.Bignum.AlmostMontgomery module MA = Hacl.Bignum.MontArithmetic module BI = Hacl.Bignum.ModInv module BM = Hacl.Bignum.Montgomery #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let kam (len:BN.meta_len t_limbs) = AM.mk_runtime_almost_mont #t_limbs len inline_for_extraction noextract let ke (len:BN.meta_len t_limbs) = BE.mk_runtime_exp #t_limbs len let add len a b res = (ke len).BE.bn.BN.add a b res let sub len a b res = (ke len).BE.bn.BN.sub a b res let add_mod len n a b res = (ke len).BE.bn.BN.add_mod_n n a b res let sub_mod len n a b res = (ke len).BE.bn.BN.sub_mod_n n a b res let mul len a b res = (ke len).BE.bn.BN.mul a b res let sqr len a res = (ke len).BE.bn.BN.sqr a res [@CInline] let bn_slow_precomp (len:BN.meta_len t_limbs) : BR.bn_mod_slow_precomp_st t_limbs len = BR.bn_mod_slow_precomp (kam len) let mod len n a res = BS.mk_bn_mod_slow_safe len (BR.mk_bn_mod_slow len (kam len).AM.precomp (bn_slow_precomp len)) n a res let mod_exp_vartime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_vt n a bBits b res let mod_exp_consttime len n a bBits b res = BS.mk_bn_mod_exp_safe len (ke len).BE.exp_check (ke len).BE.exp_ct n a bBits b res let mod_inv_prime_vartime len n a res = BS.mk_bn_mod_inv_prime_safe len (ke len).BE.exp_vt n a res let mont_ctx_init len r n = MA.bn_field_init len (ke len).BE.precompr2 r n let mont_ctx_free k = MA.bn_field_free k let mod_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.bn_mod_ctx len (bn_slow_precomp len1) k a res let mod_exp_vartime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_vt_precomp k a bBits b res let mod_exp_consttime_precomp len k a bBits b res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_exp_ctx len (ke len1).BE.exp_ct_precomp k a bBits b res let mod_inv_prime_vartime_precomp len k a res = let len1 = MA.bn_field_get_len k in BS.mk_bn_mod_inv_prime_ctx len (BI.mk_bn_mod_inv_prime_precomp len1 (ke len1).BE.exp_vt_precomp) k a res let new_bn_from_bytes_be r len b = BS.new_bn_from_bytes_be r len b let new_bn_from_bytes_le r len b = BS.new_bn_from_bytes_le r len b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.MontArithmetic.fsti.checked", "Hacl.Bignum.ModReduction.fst.checked", "Hacl.Bignum.ModInv.fst.checked", "Hacl.Bignum.Exponentiation.fsti.checked", "Hacl.Bignum.Convert.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Hacl.Bignum32.fst" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModInv", "short_module": "BI" }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.ModReduction", "short_module": "BR" }, { "abbrev": true, "full_module": "Hacl.Bignum.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Bignum.MontArithmetic", "short_module": "MA" }, { "abbrev": true, "full_module": "Hacl.Bignum.SafeAPI", "short_module": "BS" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Lib.IntTypes.size_t { 0 < Lib.IntTypes.v len /\ Lib.IntTypes.numbytes Hacl.Bignum32.t_limbs * Lib.IntTypes.v (Hacl.Bignum.Definitions.blocks len (Lib.IntTypes.size (Lib.IntTypes.numbytes Hacl.Bignum32.t_limbs))) <= Lib.IntTypes.max_size_t } -> Hacl.Bignum.Convert.bn_to_bytes_be_st Hacl.Bignum32.t_limbs len
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.numbytes", "Hacl.Bignum32.t_limbs", "Hacl.Bignum.Definitions.blocks", "Lib.IntTypes.size", "Lib.IntTypes.max_size_t", "Hacl.Bignum.Definitions.lbignum", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Bignum.Convert.mk_bn_to_bytes_be", "Prims.unit" ]
[]
false
false
false
false
false
let bn_to_bytes_be len b res =
Hacl.Bignum.Convert.mk_bn_to_bytes_be false len b res
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul_add
val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b)
val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b)
let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 119, "start_col": 0, "start_line": 106 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r: Prims.int -> a: Prims.int -> c: Prims.int -> b: Prims.pos -> FStar.Pervasives.Lemma (ensures r * (a % b) + (r * (a / b + c)) * b = r * a + (r * c) * b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Prims.pos", "FStar.Calc.calc_finish", "Prims.eq2", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.op_Modulus", "Prims.op_Division", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.paren_mul_right", "Prims.squash", "FStar.Math.Lemmas.distributivity_add_left", "FStar.Math.Lemmas.distributivity_add_right", "Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul" ]
[]
false
false
true
false
false
let lemma_distr_eucl_mul_add r a c b =
calc ( == ) { r * (a % b) + (r * (a / b + c)) * b; ( == ) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); ( == ) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * (((a / b) * b) + c * b); ( == ) { Math.Lemmas.distributivity_add_right r ((a / b) * b) (c * b) } r * (a % b) + r * ((a / b) * b) + r * (c * b); ( == ) { (Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b) } r * (a % b) + (r * (a / b)) * b + (r * c) * b; ( == ) { lemma_distr_eucl_mul r a b } r * a + (r * c) * b; }
false
Vale.AES.AES_common_s.fst
Vale.AES.AES_common_s.aes_rcon
val aes_rcon (i: int) : nat32
val aes_rcon (i: int) : nat32
let aes_rcon (i:int) : nat32 = if i = 0 then 0x01 else if i = 1 then 0x02 else if i = 2 then 0x04 else if i = 3 then 0x08 else if i = 4 then 0x10 else if i = 5 then 0x20 else if i = 6 then 0x40 else if i = 7 then 0x80 else if i = 8 then 0x1b else 0x36
{ "file_name": "vale/specs/crypto/Vale.AES.AES_common_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 33, "start_col": 0, "start_line": 23 }
module Vale.AES.AES_common_s // IMPORTANT: This specification is written assuming a little-endian mapping from bytes to quad32s // This is explicit in key_schedule_to_round_keys when we construct the round_key rk, // but it also applies implicitly to the input quad32 open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Words.Four_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open FStar.Seq open FStar.Mul // substitution is endian-neutral; assume val sub_bytes (q:quad32) : quad32 assume val inv_sub_bytes (q:quad32) : quad32 assume val sub_word (w:nat32) : nat32 type algorithm:eqtype = | AES_128 | AES_192 | AES_256
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.AES_common_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
i: Prims.int -> Vale.Def.Types_s.nat32
Prims.Tot
[ "total" ]
[]
[ "Prims.int", "Prims.op_Equality", "Prims.bool", "Vale.Def.Types_s.nat32" ]
[]
false
false
false
true
false
let aes_rcon (i: int) : nat32 =
if i = 0 then 0x01 else if i = 1 then 0x02 else if i = 2 then 0x04 else if i = 3 then 0x08 else if i = 4 then 0x10 else if i = 5 then 0x20 else if i = 6 then 0x40 else if i = 7 then 0x80 else if i = 8 then 0x1b else 0x36
false
Vale.AES.AES_common_s.fst
Vale.AES.AES_common_s.nb
val nb : Prims.int
let nb = 4
{ "file_name": "vale/specs/crypto/Vale.AES.AES_common_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 10, "end_line": 36, "start_col": 0, "start_line": 36 }
module Vale.AES.AES_common_s // IMPORTANT: This specification is written assuming a little-endian mapping from bytes to quad32s // This is explicit in key_schedule_to_round_keys when we construct the round_key rk, // but it also applies implicitly to the input quad32 open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Words.Four_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open FStar.Seq open FStar.Mul // substitution is endian-neutral; assume val sub_bytes (q:quad32) : quad32 assume val inv_sub_bytes (q:quad32) : quad32 assume val sub_word (w:nat32) : nat32 type algorithm:eqtype = | AES_128 | AES_192 | AES_256 let aes_rcon (i:int) : nat32 = if i = 0 then 0x01 else if i = 1 then 0x02 else if i = 2 then 0x04 else if i = 3 then 0x08 else if i = 4 then 0x10 else if i = 5 then 0x20 else if i = 6 then 0x40 else if i = 7 then 0x80 else if i = 8 then 0x1b else 0x36
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.AES_common_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let nb =
4
false
Vale.AES.AES_common_s.fst
Vale.AES.AES_common_s.is_aes_key
val is_aes_key (alg: algorithm) (s: seq nat8) : prop0
val is_aes_key (alg: algorithm) (s: seq nat8) : prop0
let is_aes_key (alg:algorithm) (s:seq nat8) : prop0 = length s == 4 * nk alg
{ "file_name": "vale/specs/crypto/Vale.AES.AES_common_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 52, "start_col": 0, "start_line": 52 }
module Vale.AES.AES_common_s // IMPORTANT: This specification is written assuming a little-endian mapping from bytes to quad32s // This is explicit in key_schedule_to_round_keys when we construct the round_key rk, // but it also applies implicitly to the input quad32 open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Words.Four_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open FStar.Seq open FStar.Mul // substitution is endian-neutral; assume val sub_bytes (q:quad32) : quad32 assume val inv_sub_bytes (q:quad32) : quad32 assume val sub_word (w:nat32) : nat32 type algorithm:eqtype = | AES_128 | AES_192 | AES_256 let aes_rcon (i:int) : nat32 = if i = 0 then 0x01 else if i = 1 then 0x02 else if i = 2 then 0x04 else if i = 3 then 0x08 else if i = 4 then 0x10 else if i = 5 then 0x20 else if i = 6 then 0x40 else if i = 7 then 0x80 else if i = 8 then 0x1b else 0x36 // AES fixes Rijndael's block size at 4 32-bit words let nb = 4 // Number of key words unfold let nk(alg:algorithm) = match alg with | AES_128 -> 4 | AES_192 -> 6 | AES_256 -> 8 // Number of rounds unfold let nr(alg:algorithm) = match alg with | AES_128 -> 10 | AES_192 -> 12 | AES_256 -> 14
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.AES_common_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> s: FStar.Seq.Base.seq Vale.Def.Types_s.nat8 -> Vale.Def.Prop_s.prop0
Prims.Tot
[ "total" ]
[]
[ "Vale.AES.AES_common_s.algorithm", "FStar.Seq.Base.seq", "Vale.Def.Types_s.nat8", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "FStar.Mul.op_Star", "Vale.AES.AES_common_s.nk", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
true
false
let is_aes_key (alg: algorithm) (s: seq nat8) : prop0 =
length s == 4 * nk alg
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_a_mul_c_plus_d_mod_e_mul_f_g
val lemma_a_mul_c_plus_d_mod_e_mul_f_g (a b c d f g:nat) : Lemma (requires c == g - b) (ensures a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g == a * pow2 c + d * pow2 (f + g))
val lemma_a_mul_c_plus_d_mod_e_mul_f_g (a b c d f g:nat) : Lemma (requires c == g - b) (ensures a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g == a * pow2 c + d * pow2 (f + g))
let lemma_a_mul_c_plus_d_mod_e_mul_f_g a b c d f g = calc (==) { a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g; (==) { lemma_distr_pow (a / pow2 b) d f g } a % pow2 b * pow2 c + (a / pow2 b) * pow2 (c + b) + d * pow2 (f + g); (==) { lemma_distr_pow (a % pow2 b) (a / pow2 b) b c } (a % pow2 b + (a / pow2 b) * pow2 b) * pow2 c + d * pow2 (f + g); (==) { Math.Lemmas.euclidean_division_definition a (pow2 b) } a * pow2 c + d * pow2 (f + g); }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 292, "start_col": 0, "start_line": 283 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52) val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2) let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0) let lemma_as_nat64_horner r0 r1 r2 r3 = calc (==) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); (==) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; (==) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; (==) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; (==) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; (==) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; } val lemma_as_nat_horner (r0 r1 r2 r3 r4:int) : Lemma (r0 + r1 * pow2 52 + r2 * pow2 104 + r3 * pow2 156 + r4 * pow2 208 == (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0) let lemma_as_nat_horner r0 r1 r2 r3 r4 = calc (==) { (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0; (==) { lemma_distr_pow r1 ((r4 * pow2 52 + r3) * pow2 52 + r2) 52 52 } ((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r2 (r4 * pow2 52 + r3) 52 104 } (r4 * pow2 52 + r3) * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r3 r4 52 156 } r4 * pow2 208 + r3 * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; } val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b) let lemma_distr5 a0 a1 a2 a3 a4 b = calc (==) { (a0 + a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b } a0 * b + (a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b } a0 * b + a1 * b + (a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b } a0 * b + a1 * b + a2 * b + (a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a3 a4 b } a0 * b + a1 * b + a2 * b + a3 * b + a4 * b; } val lemma_distr5_pow52 (a b0 b1 b2 b3 b4:int) : Lemma (a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) let lemma_distr5_pow52 a b0 b1 b2 b3 b4 = calc (==) { a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208); (==) { lemma_distr5 b0 (b1 * pow2 52) (b2 * pow2 104) (b3 * pow2 156) (b4 * pow2 208) a } b0 * a + b1 * pow2 52 * a + b2 * pow2 104 * a + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b1 (pow2 52) a; lemma_swap_mul3 b2 (pow2 104) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b3 (pow2 156) a; lemma_swap_mul3 b4 (pow2 208) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * a * pow2 156 + b4 * a * pow2 208; } val lemma_distr5_pow52_mul_pow (a b0 b1 b2 b3 b4: int) (p:nat) : Lemma (a * pow2 p * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p)) let lemma_distr5_pow52_mul_pow a b0 b1 b2 b3 b4 p = let b_sum = b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208 in calc (==) { a * pow2 p * b_sum; (==) { lemma_swap_mul3 a (pow2 p) b_sum } a * b_sum * pow2 p; (==) { lemma_distr5_pow52 a b0 b1 b2 b3 b4 } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) * pow2 p; (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) (a * b4) 208 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) * pow2 p + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) (a * b3) 156 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) * pow2 p + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52) (a * b2) 104 p } (a * b0 + a * b1 * pow2 52) * pow2 p + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0) (a * b1) 52 p } a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); } val lemma_distr5_pow52_sub (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c:int) : Lemma ((b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208 == (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208)) let lemma_distr5_pow52_sub a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c = calc (==) { (b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b1 * c) a1 (pow2 52) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b2 * c) a2 (pow2 104) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b3 * c) a3 (pow2 156) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b4 * c) a4 (pow2 208) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + c * b4 * pow2 208 - a4 * pow2 208; (==) { lemma_distr5_pow52 c b0 b1 b2 b3 b4 } (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208); } val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma (requires a / pow2 b < pow2 e) (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e)) let lemma_a_div_b_plus_c_mod_d_mul_e a b c d e = let t_r = c % pow2 d * pow2 e in Math.Lemmas.lemma_mult_le_right (pow2 e) (c % pow2 d) (pow2 d - 1); assert (t_r <= (pow2 d - 1) * pow2 e); assert (t_r <= pow2 d * pow2 e - pow2 e); Math.Lemmas.pow2_plus d e; assert (t_r <= pow2 (d + e) - pow2 e); assert (a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e)) val lemma_a_mod_b_mul_c_mod_d (a b c d:nat) : Lemma (requires c <= d /\ b <= d - c) (ensures (a % pow2 b) * pow2 c % pow2 d = (a % pow2 b) * pow2 c) let lemma_a_mod_b_mul_c_mod_d a b c d = Math.Lemmas.pow2_multiplication_modulo_lemma_2 (a % pow2 b) d c; Math.Lemmas.pow2_modulo_modulo_lemma_2 a (d - c) b val lemma_a_mul_c_plus_d_mod_e_mul_f_g (a b c d f g:nat) : Lemma (requires c == g - b) (ensures a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g == a * pow2 c + d * pow2 (f + g))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.nat -> b: Prims.nat -> c: Prims.nat -> d: Prims.nat -> f: Prims.nat -> g: Prims.nat -> FStar.Pervasives.Lemma (requires c == g - b) (ensures (a % Prims.pow2 b) * Prims.pow2 c + (a / Prims.pow2 b + d * Prims.pow2 f) * Prims.pow2 g == a * Prims.pow2 c + d * Prims.pow2 (f + g))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "FStar.Calc.calc_finish", "Prims.int", "Prims.eq2", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.op_Modulus", "Prims.pow2", "Prims.op_Division", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Hacl.Spec.K256.MathLemmas.lemma_distr_pow", "Prims.squash", "FStar.Math.Lemmas.euclidean_division_definition" ]
[]
false
false
true
false
false
let lemma_a_mul_c_plus_d_mod_e_mul_f_g a b c d f g =
calc ( == ) { (a % pow2 b) * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g; ( == ) { lemma_distr_pow (a / pow2 b) d f g } (a % pow2 b) * pow2 c + (a / pow2 b) * pow2 (c + b) + d * pow2 (f + g); ( == ) { lemma_distr_pow (a % pow2 b) (a / pow2 b) b c } (a % pow2 b + (a / pow2 b) * pow2 b) * pow2 c + d * pow2 (f + g); ( == ) { Math.Lemmas.euclidean_division_definition a (pow2 b) } a * pow2 c + d * pow2 (f + g); }
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_a_mod_52_mul_b
val lemma_a_mod_52_mul_b (a b:nat) : Lemma ((a % pow2 52) * pow2 b = a * pow2 b - a / pow2 52 * pow2 (b + 52))
val lemma_a_mod_52_mul_b (a b:nat) : Lemma ((a % pow2 52) * pow2 b = a * pow2 b - a / pow2 52 * pow2 (b + 52))
let lemma_a_mod_52_mul_b a b = calc (==) { (a % pow2 52) * pow2 b; (==) { Math.Lemmas.euclidean_division_definition a (pow2 52) } (a - a / pow2 52 * pow2 52) * pow2 b; (==) { Math.Lemmas.distributivity_sub_left a (a / pow2 52 * pow2 52) (pow2 b) } a * pow2 b - a / pow2 52 * pow2 52 * pow2 b; (==) { Math.Lemmas.paren_mul_right (a / pow2 52) (pow2 52) (pow2 b); Math.Lemmas.pow2_plus 52 b } a * pow2 b - a / pow2 52 * pow2 (52 + b); }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 307, "start_col": 0, "start_line": 298 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52) val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2) let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0) let lemma_as_nat64_horner r0 r1 r2 r3 = calc (==) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); (==) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; (==) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; (==) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; (==) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; (==) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; } val lemma_as_nat_horner (r0 r1 r2 r3 r4:int) : Lemma (r0 + r1 * pow2 52 + r2 * pow2 104 + r3 * pow2 156 + r4 * pow2 208 == (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0) let lemma_as_nat_horner r0 r1 r2 r3 r4 = calc (==) { (((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 52 + r1) * pow2 52 + r0; (==) { lemma_distr_pow r1 ((r4 * pow2 52 + r3) * pow2 52 + r2) 52 52 } ((r4 * pow2 52 + r3) * pow2 52 + r2) * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r2 (r4 * pow2 52 + r3) 52 104 } (r4 * pow2 52 + r3) * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; (==) { lemma_distr_pow r3 r4 52 156 } r4 * pow2 208 + r3 * pow2 156 + r2 * pow2 104 + r1 * pow2 52 + r0; } val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b) let lemma_distr5 a0 a1 a2 a3 a4 b = calc (==) { (a0 + a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b } a0 * b + (a1 + a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b } a0 * b + a1 * b + (a2 + a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b } a0 * b + a1 * b + a2 * b + (a3 + a4) * b; (==) { Math.Lemmas.distributivity_add_left a3 a4 b } a0 * b + a1 * b + a2 * b + a3 * b + a4 * b; } val lemma_distr5_pow52 (a b0 b1 b2 b3 b4:int) : Lemma (a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) let lemma_distr5_pow52 a b0 b1 b2 b3 b4 = calc (==) { a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208); (==) { lemma_distr5 b0 (b1 * pow2 52) (b2 * pow2 104) (b3 * pow2 156) (b4 * pow2 208) a } b0 * a + b1 * pow2 52 * a + b2 * pow2 104 * a + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b1 (pow2 52) a; lemma_swap_mul3 b2 (pow2 104) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * pow2 156 * a + b4 * pow2 208 * a; (==) { lemma_swap_mul3 b3 (pow2 156) a; lemma_swap_mul3 b4 (pow2 208) a } b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * a * pow2 156 + b4 * a * pow2 208; } val lemma_distr5_pow52_mul_pow (a b0 b1 b2 b3 b4: int) (p:nat) : Lemma (a * pow2 p * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) = a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p)) let lemma_distr5_pow52_mul_pow a b0 b1 b2 b3 b4 p = let b_sum = b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208 in calc (==) { a * pow2 p * b_sum; (==) { lemma_swap_mul3 a (pow2 p) b_sum } a * b_sum * pow2 p; (==) { lemma_distr5_pow52 a b0 b1 b2 b3 b4 } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208) * pow2 p; (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) (a * b4) 208 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156) * pow2 p + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) (a * b3) 156 p } (a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104) * pow2 p + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0 + a * b1 * pow2 52) (a * b2) 104 p } (a * b0 + a * b1 * pow2 52) * pow2 p + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); (==) { lemma_distr_pow (a * b0) (a * b1) 52 p } a * b0 * pow2 p + a * b1 * pow2 (52 + p) + a * b2 * pow2 (104 + p) + a * b3 * pow2 (156 + p) + a * b4 * pow2 (208 + p); } val lemma_distr5_pow52_sub (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c:int) : Lemma ((b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208 == (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208)) let lemma_distr5_pow52_sub a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c = calc (==) { (b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b1 * c) a1 (pow2 52) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + (b2 * c - a2) * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b2 * c) a2 (pow2 104) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b3 * c) a3 (pow2 156) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + (b4 * c - a4) * pow2 208; (==) { Math.Lemmas.distributivity_sub_left (b4 * c) a4 (pow2 208) } c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 + c * b3 * pow2 156 - a3 * pow2 156 + c * b4 * pow2 208 - a4 * pow2 208; (==) { lemma_distr5_pow52 c b0 b1 b2 b3 b4 } (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c - (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208); } val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma (requires a / pow2 b < pow2 e) (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e)) let lemma_a_div_b_plus_c_mod_d_mul_e a b c d e = let t_r = c % pow2 d * pow2 e in Math.Lemmas.lemma_mult_le_right (pow2 e) (c % pow2 d) (pow2 d - 1); assert (t_r <= (pow2 d - 1) * pow2 e); assert (t_r <= pow2 d * pow2 e - pow2 e); Math.Lemmas.pow2_plus d e; assert (t_r <= pow2 (d + e) - pow2 e); assert (a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e)) val lemma_a_mod_b_mul_c_mod_d (a b c d:nat) : Lemma (requires c <= d /\ b <= d - c) (ensures (a % pow2 b) * pow2 c % pow2 d = (a % pow2 b) * pow2 c) let lemma_a_mod_b_mul_c_mod_d a b c d = Math.Lemmas.pow2_multiplication_modulo_lemma_2 (a % pow2 b) d c; Math.Lemmas.pow2_modulo_modulo_lemma_2 a (d - c) b val lemma_a_mul_c_plus_d_mod_e_mul_f_g (a b c d f g:nat) : Lemma (requires c == g - b) (ensures a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g == a * pow2 c + d * pow2 (f + g)) let lemma_a_mul_c_plus_d_mod_e_mul_f_g a b c d f g = calc (==) { a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g; (==) { lemma_distr_pow (a / pow2 b) d f g } a % pow2 b * pow2 c + (a / pow2 b) * pow2 (c + b) + d * pow2 (f + g); (==) { lemma_distr_pow (a % pow2 b) (a / pow2 b) b c } (a % pow2 b + (a / pow2 b) * pow2 b) * pow2 c + d * pow2 (f + g); (==) { Math.Lemmas.euclidean_division_definition a (pow2 b) } a * pow2 c + d * pow2 (f + g); } val lemma_a_mod_52_mul_b (a b:nat) : Lemma ((a % pow2 52) * pow2 b = a * pow2 b - a / pow2 52 * pow2 (b + 52))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.nat -> b: Prims.nat -> FStar.Pervasives.Lemma (ensures (a % Prims.pow2 52) * Prims.pow2 b = a * Prims.pow2 b - (a / Prims.pow2 52) * Prims.pow2 (b + 52))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "FStar.Calc.calc_finish", "Prims.int", "Prims.eq2", "FStar.Mul.op_Star", "Prims.op_Modulus", "Prims.pow2", "Prims.op_Subtraction", "Prims.op_Division", "Prims.op_Addition", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.euclidean_division_definition", "Prims.squash", "FStar.Math.Lemmas.distributivity_sub_left", "FStar.Math.Lemmas.pow2_plus", "FStar.Math.Lemmas.paren_mul_right" ]
[]
false
false
true
false
false
let lemma_a_mod_52_mul_b a b =
calc ( == ) { (a % pow2 52) * pow2 b; ( == ) { Math.Lemmas.euclidean_division_definition a (pow2 52) } (a - (a / pow2 52) * pow2 52) * pow2 b; ( == ) { Math.Lemmas.distributivity_sub_left a ((a / pow2 52) * pow2 52) (pow2 b) } a * pow2 b - ((a / pow2 52) * pow2 52) * pow2 b; ( == ) { (Math.Lemmas.paren_mul_right (a / pow2 52) (pow2 52) (pow2 b); Math.Lemmas.pow2_plus 52 b) } a * pow2 b - (a / pow2 52) * pow2 (52 + b); }
false
GEXN.fst
GEXN.exn
val exn : Prims.eqtype
let exn = string
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 25, "start_col": 0, "start_line": 25 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.eqtype
Prims.Tot
[ "total" ]
[]
[ "Prims.string" ]
[]
false
false
false
true
false
let exn =
string
false
GEXN.fst
GEXN.gex'
val gex' : a: Type -> Type
let gex' (a:Type) = unit -> M (s:set exn & (either a (e:exn{mem e s})))
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 71, "end_line": 31, "start_col": 0, "start_line": 31 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string let gex (a:Type) = unit -> M ((set exn) * either a exn) (* If DM4F would accept it, would prefer to use the more precise spec below *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Prims.dtuple2", "FStar.Set.set", "GEXN.exn", "FStar.Pervasives.either", "Prims.b2t", "FStar.Set.mem" ]
[]
false
false
false
true
true
let gex' (a: Type) =
unit -> M (s: set exn & (either a (e: exn{mem e s})))
false
GEXN.fst
GEXN.gex
val gex : a: Type -> Type
let gex (a:Type) = unit -> M ((set exn) * either a exn)
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 55, "end_line": 27, "start_col": 0, "start_line": 27 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "FStar.Pervasives.Native.tuple2", "FStar.Set.set", "GEXN.exn", "FStar.Pervasives.either" ]
[]
false
false
false
true
true
let gex (a: Type) =
unit -> M ((set exn) * either a exn)
false
GEXN.fst
GEXN.return_gex
val return_gex : (a:Type) -> (x:a) -> gex a
val return_gex : (a:Type) -> (x:a) -> gex a
let return_gex a x = fun _ -> empty , Inl x
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 43, "end_line": 35, "start_col": 0, "start_line": 35 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string let gex (a:Type) = unit -> M ((set exn) * either a exn) (* If DM4F would accept it, would prefer to use the more precise spec below *) let gex' (a:Type) = unit -> M (s:set exn & (either a (e:exn{mem e s}))) (* Monad definition *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> x: a -> GEXN.gex a
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "FStar.Set.set", "GEXN.exn", "FStar.Pervasives.either", "FStar.Set.empty", "FStar.Pervasives.Inl", "FStar.Pervasives.Native.tuple2" ]
[]
false
false
false
true
false
let return_gex a x =
fun _ -> empty, Inl x
false
GEXN.fst
GEXN.raise0
val raise0 (a: Type) (e: exn) : gex a
val raise0 (a: Type) (e: exn) : gex a
let raise0 (a:Type) (e:exn) : gex a = fun _ -> singleton e , Inr e
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 66, "end_line": 44, "start_col": 0, "start_line": 44 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string let gex (a:Type) = unit -> M ((set exn) * either a exn) (* If DM4F would accept it, would prefer to use the more precise spec below *) let gex' (a:Type) = unit -> M (s:set exn & (either a (e:exn{mem e s}))) (* Monad definition *) val return_gex : (a:Type) -> (x:a) -> gex a let return_gex a x = fun _ -> empty , Inl x val bind_gex : (a:Type) -> (b:Type) -> (f:gex a) -> (g:a -> gex b) -> gex b let bind_gex a b f g = fun _ -> let (s,r) = f () in match r with | Inr e -> s , Inr e | Inl x -> g x ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> e: GEXN.exn -> GEXN.gex a
Prims.Tot
[ "total" ]
[]
[ "GEXN.exn", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "FStar.Set.set", "FStar.Pervasives.either", "FStar.Set.singleton", "FStar.Pervasives.Inr", "FStar.Pervasives.Native.tuple2", "GEXN.gex" ]
[]
false
false
false
true
false
let raise0 (a: Type) (e: exn) : gex a =
fun _ -> singleton e, Inr e
false
GEXN.fst
GEXN.exn_wp
val exn_wp : a: Type -> Type
let exn_wp (a:Type) = (either a exn -> Type0) -> Type0
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 55, "end_line": 58, "start_col": 0, "start_line": 58 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string let gex (a:Type) = unit -> M ((set exn) * either a exn) (* If DM4F would accept it, would prefer to use the more precise spec below *) let gex' (a:Type) = unit -> M (s:set exn & (either a (e:exn{mem e s}))) (* Monad definition *) val return_gex : (a:Type) -> (x:a) -> gex a let return_gex a x = fun _ -> empty , Inl x val bind_gex : (a:Type) -> (b:Type) -> (f:gex a) -> (g:a -> gex b) -> gex b let bind_gex a b f g = fun _ -> let (s,r) = f () in match r with | Inr e -> s , Inr e | Inl x -> g x () let raise0 (a:Type) (e:exn) : gex a = fun _ -> singleton e , Inr e reifiable reflectable new_effect { GEXN : (a:Type) -> Effect with repr = gex ; bind = bind_gex ; return = return_gex ; raise (#a:Type) = raise0 a } (* Syntactic sugar packaging an allowed exceptions index and EXN WP *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.either", "GEXN.exn" ]
[]
false
false
false
true
true
let exn_wp (a: Type) =
(either a exn -> Type0) -> Type0
false
GEXN.fst
GEXN.gexn_wp
val gexn_wp : a: Type -> Type
let gexn_wp (a:Type) = unit -> (set exn * either a exn -> Type0) -> Type0
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 73, "end_line": 57, "start_col": 0, "start_line": 57 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string let gex (a:Type) = unit -> M ((set exn) * either a exn) (* If DM4F would accept it, would prefer to use the more precise spec below *) let gex' (a:Type) = unit -> M (s:set exn & (either a (e:exn{mem e s}))) (* Monad definition *) val return_gex : (a:Type) -> (x:a) -> gex a let return_gex a x = fun _ -> empty , Inl x val bind_gex : (a:Type) -> (b:Type) -> (f:gex a) -> (g:a -> gex b) -> gex b let bind_gex a b f g = fun _ -> let (s,r) = f () in match r with | Inr e -> s , Inr e | Inl x -> g x () let raise0 (a:Type) (e:exn) : gex a = fun _ -> singleton e , Inr e reifiable reflectable new_effect { GEXN : (a:Type) -> Effect with repr = gex ; bind = bind_gex ; return = return_gex ; raise (#a:Type) = raise0 a } (* Syntactic sugar packaging an allowed exceptions index and EXN WP *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "FStar.Pervasives.Native.tuple2", "FStar.Set.set", "GEXN.exn", "FStar.Pervasives.either" ]
[]
false
false
false
true
true
let gexn_wp (a: Type) =
unit -> ((set exn * either a exn) -> Type0) -> Type0
false
Vale.AES.AES_common_s.fst
Vale.AES.AES_common_s.nr
val nr : alg: Vale.AES.AES_common_s.algorithm -> Prims.int
let nr(alg:algorithm) = match alg with | AES_128 -> 10 | AES_192 -> 12 | AES_256 -> 14
{ "file_name": "vale/specs/crypto/Vale.AES.AES_common_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 17, "end_line": 50, "start_col": 7, "start_line": 46 }
module Vale.AES.AES_common_s // IMPORTANT: This specification is written assuming a little-endian mapping from bytes to quad32s // This is explicit in key_schedule_to_round_keys when we construct the round_key rk, // but it also applies implicitly to the input quad32 open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Words.Four_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open FStar.Seq open FStar.Mul // substitution is endian-neutral; assume val sub_bytes (q:quad32) : quad32 assume val inv_sub_bytes (q:quad32) : quad32 assume val sub_word (w:nat32) : nat32 type algorithm:eqtype = | AES_128 | AES_192 | AES_256 let aes_rcon (i:int) : nat32 = if i = 0 then 0x01 else if i = 1 then 0x02 else if i = 2 then 0x04 else if i = 3 then 0x08 else if i = 4 then 0x10 else if i = 5 then 0x20 else if i = 6 then 0x40 else if i = 7 then 0x80 else if i = 8 then 0x1b else 0x36 // AES fixes Rijndael's block size at 4 32-bit words let nb = 4 // Number of key words unfold let nk(alg:algorithm) = match alg with | AES_128 -> 4 | AES_192 -> 6 | AES_256 -> 8
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.AES_common_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "Vale.AES.AES_common_s.algorithm", "Prims.int" ]
[]
false
false
false
true
false
let nr (alg: algorithm) =
match alg with | AES_128 -> 10 | AES_192 -> 12 | AES_256 -> 14
false
Huffman.fst
Huffman.leq_trie
val leq_trie (t1 t2: trie) : Tot bool
val leq_trie (t1 t2: trie) : Tot bool
let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 24, "end_line": 36, "start_col": 0, "start_line": 35 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> t2: Huffman.trie -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Huffman.trie", "Prims.op_LessThanOrEqual", "Huffman.weight", "Prims.bool" ]
[]
false
false
false
true
false
let leq_trie (t1 t2: trie) : Tot bool =
weight t1 <= weight t2
false
GEXN.fst
GEXN.bind_gex
val bind_gex : (a:Type) -> (b:Type) -> (f:gex a) -> (g:a -> gex b) -> gex b
val bind_gex : (a:Type) -> (b:Type) -> (f:gex a) -> (g:a -> gex b) -> gex b
let bind_gex a b f g = fun _ -> let (s,r) = f () in match r with | Inr e -> s , Inr e | Inl x -> g x ()
{ "file_name": "examples/indexed_effects/GEXN.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 42, "start_col": 0, "start_line": 38 }
(* 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 GEXN (* A proof-of-concept example of a Graded Dijkstra Monad---the EXN monad graded by the set of allowed exception names *) open FStar.Set let exn = string let gex (a:Type) = unit -> M ((set exn) * either a exn) (* If DM4F would accept it, would prefer to use the more precise spec below *) let gex' (a:Type) = unit -> M (s:set exn & (either a (e:exn{mem e s}))) (* Monad definition *) val return_gex : (a:Type) -> (x:a) -> gex a let return_gex a x = fun _ -> empty , Inl x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Set.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "GEXN.fst" }
[ { "abbrev": false, "full_module": "FStar.Set", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
a: Type -> b: Type -> f: GEXN.gex a -> g: (g: a -> GEXN.gex b) -> GEXN.gex b
Prims.Tot
[ "total" ]
[]
[ "GEXN.gex", "Prims.unit", "FStar.Set.set", "GEXN.exn", "FStar.Pervasives.either", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Inr", "FStar.Pervasives.Native.tuple2" ]
[]
false
false
false
true
false
let bind_gex a b f g =
fun _ -> let s, r = f () in match r with | Inr e -> s, Inr e | Inl x -> g x ()
false
BugWhileInv.fst
BugWhileInv.workaround
val workaround (b: bool) (v: nat) : vprop
val workaround (b: bool) (v: nat) : vprop
let workaround (b:bool) (v:nat) : vprop = pure (not b ==> v == 0)
{ "file_name": "share/steel/examples/pulse/bug-reports/BugWhileInv.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 27, "end_line": 21, "start_col": 0, "start_line": 20 }
(* Copyright 2023 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 BugWhileInv open Pulse.Lib.Pervasives
{ "checked_file": "/", "dependencies": [ "Pulse.Lib.Pervasives.fst.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "BugWhileInv.fst" }
[ { "abbrev": false, "full_module": "Pulse.Lib.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
b: Prims.bool -> v: Prims.nat -> Pulse.Lib.Core.vprop
Prims.Tot
[ "total" ]
[]
[ "Prims.bool", "Prims.nat", "Pulse.Lib.Core.pure", "Prims.l_imp", "Prims.b2t", "Prims.op_Negation", "Prims.eq2", "Prims.int", "Pulse.Lib.Core.vprop" ]
[]
false
false
false
true
false
let workaround (b: bool) (v: nat) : vprop =
pure (not b ==> v == 0)
false
Vale.AES.AES_common_s.fst
Vale.AES.AES_common_s.nk
val nk : alg: Vale.AES.AES_common_s.algorithm -> Prims.int
let nk(alg:algorithm) = match alg with | AES_128 -> 4 | AES_192 -> 6 | AES_256 -> 8
{ "file_name": "vale/specs/crypto/Vale.AES.AES_common_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 43, "start_col": 7, "start_line": 39 }
module Vale.AES.AES_common_s // IMPORTANT: This specification is written assuming a little-endian mapping from bytes to quad32s // This is explicit in key_schedule_to_round_keys when we construct the round_key rk, // but it also applies implicitly to the input quad32 open Vale.Def.Prop_s open Vale.Def.Opaque_s open Vale.Def.Words_s open Vale.Def.Words.Four_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open FStar.Seq open FStar.Mul // substitution is endian-neutral; assume val sub_bytes (q:quad32) : quad32 assume val inv_sub_bytes (q:quad32) : quad32 assume val sub_word (w:nat32) : nat32 type algorithm:eqtype = | AES_128 | AES_192 | AES_256 let aes_rcon (i:int) : nat32 = if i = 0 then 0x01 else if i = 1 then 0x02 else if i = 2 then 0x04 else if i = 3 then 0x08 else if i = 4 then 0x10 else if i = 5 then 0x20 else if i = 6 then 0x40 else if i = 7 then 0x80 else if i = 8 then 0x1b else 0x36 // AES fixes Rijndael's block size at 4 32-bit words let nb = 4
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.AES.AES_common_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
alg: Vale.AES.AES_common_s.algorithm -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "Vale.AES.AES_common_s.algorithm", "Prims.int" ]
[]
false
false
false
true
false
let nk (alg: algorithm) =
match alg with | AES_128 -> 4 | AES_192 -> 6 | AES_256 -> 8
false
Huffman.fst
Huffman.sorted
val sorted (ts: list trie) : Tot bool
val sorted (ts: list trie) : Tot bool
let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts')
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 53, "end_line": 44, "start_col": 0, "start_line": 41 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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 Huffman.trie -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Prims.list", "Huffman.trie", "Prims.op_AmpAmp", "Huffman.leq_trie", "Huffman.sorted", "Prims.Cons", "Prims.bool" ]
[ "recursion" ]
false
false
false
true
false
let rec sorted (ts: list trie) : Tot bool =
match ts with | [] | [_] -> true | t1 :: t2 :: ts' -> leq_trie t1 t2 && sorted (t2 :: ts')
false
Hacl.Bignum25519.fsti
Hacl.Bignum25519.felem
val felem : Type0
let felem = lbuffer uint64 5ul
{ "file_name": "code/ed25519/Hacl.Bignum25519.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 19, "start_col": 0, "start_line": 19 }
module Hacl.Bignum25519 module ST = FStar.HyperStack.ST open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer module BSeq = Lib.ByteSequence module S51 = Hacl.Spec.Curve25519.Field51.Definition module F51 = Hacl.Impl.Ed25519.Field51 module SC = Spec.Curve25519 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (* Type abbreviations *)
{ "checked_file": "/", "dependencies": [ "Spec.Ed25519.fst.checked", "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Curve25519.Finv.fst.checked", "Hacl.Spec.Curve25519.Field51.Definition.fst.checked", "Hacl.Impl.Ed25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum25519.fsti" }
[ { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "SC" }, { "abbrev": true, "full_module": "Hacl.Impl.Ed25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field51.Definition", "short_module": "S51" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
true
let felem =
lbuffer uint64 5ul
false
Hacl.Bignum25519.fsti
Hacl.Bignum25519.point
val point : Type0
let point = lbuffer uint64 20ul
{ "file_name": "code/ed25519/Hacl.Bignum25519.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 23, "start_col": 0, "start_line": 23 }
module Hacl.Bignum25519 module ST = FStar.HyperStack.ST open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer module BSeq = Lib.ByteSequence module S51 = Hacl.Spec.Curve25519.Field51.Definition module F51 = Hacl.Impl.Ed25519.Field51 module SC = Spec.Curve25519 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (* Type abbreviations *) inline_for_extraction noextract let felem = lbuffer uint64 5ul (* A point is buffer of size 20, that is 4 consecutive buffers of size 5 *)
{ "checked_file": "/", "dependencies": [ "Spec.Ed25519.fst.checked", "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Curve25519.Finv.fst.checked", "Hacl.Spec.Curve25519.Field51.Definition.fst.checked", "Hacl.Impl.Ed25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum25519.fsti" }
[ { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "SC" }, { "abbrev": true, "full_module": "Hacl.Impl.Ed25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field51.Definition", "short_module": "S51" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
true
let point =
lbuffer uint64 20ul
false
Huffman.fst
Huffman.weight
val weight (t: trie) : Tot pos
val weight (t: trie) : Tot pos
let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 33, "start_col": 0, "start_line": 30 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> Prims.pos
Prims.Tot
[ "total" ]
[]
[ "Huffman.trie", "Prims.pos", "Huffman.symbol" ]
[]
false
false
false
true
false
let weight (t: trie) : Tot pos =
match t with | Leaf w _ -> w | Node w _ _ -> w
false
Huffman.fst
Huffman.insert_in_sorted
val insert_in_sorted (x: trie) (xs: list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x :: xs) ys))
val insert_in_sorted (x: trie) (xs: list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x :: xs) ys))
let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl)
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 32, "end_line": 67, "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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> xs: Prims.list Huffman.trie -> Prims.Pure (Prims.list Huffman.trie)
Prims.Pure
[]
[]
[ "Huffman.trie", "Prims.list", "Prims.Cons", "Prims.Nil", "Huffman.leq_trie", "Prims.bool", "Huffman.insert_in_sorted", "Prims.b2t", "Huffman.sorted", "Prims.l_and", "Huffman.permutation" ]
[ "recursion" ]
false
false
false
false
false
let rec insert_in_sorted (x: trie) (xs: list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x :: xs) ys)) =
match xs with | [] -> [x] | x' :: xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let z :: _ = i_tl in x' :: i_tl)
false
Huffman.fst
Huffman.encode_one
val encode_one (t: trie) (s: symbol) : Tot (option (list bool))
val encode_one (t: trie) (s: symbol) : Tot (option (list bool))
let rec encode_one (t:trie) (s:symbol) : Tot (option (list bool)) = match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 30, "end_line": 112, "start_col": 0, "start_line": 104 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *) let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> s: Huffman.symbol -> FStar.Pervasives.Native.option (Prims.list Prims.bool)
Prims.Tot
[ "total" ]
[]
[ "Huffman.trie", "Huffman.symbol", "Prims.pos", "Prims.op_Equality", "FStar.Pervasives.Native.Some", "Prims.list", "Prims.bool", "Prims.Nil", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Huffman.encode_one", "Prims.Cons" ]
[ "recursion" ]
false
false
false
true
false
let rec encode_one (t: trie) (s: symbol) : Tot (option (list bool)) =
match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None
false
StatefulLens.fst
StatefulLens.compose_hlens
val compose_hlens (#a #b #c: _) (l: hlens a b) (m: hlens b c) : hlens a c
val compose_hlens (#a #b #c: _) (l: hlens a b) (m: hlens b c) : hlens a c
let compose_hlens #a #b #c (l:hlens a b) (m:hlens b c) : hlens a c = { get = (fun (h0, x) -> m.get (h0, l.get (h0, x))); put = (fun (z:c) (h0, x) -> let h1, b = m.put z (h0, (l.get (h0, x))) in l.put b (h1, x)) }
{ "file_name": "examples/data_structures/StatefulLens.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 53, "start_col": 0, "start_line": 50 }
(* 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. *) /// Lenses for accessing and mutating in-place references holding datatypes in a heap /// /// The basic idea is to write stateful lenses indexed by a "ghost" lens /// where the ghost lens is a full specification of the stateful lens' /// behavior on the heap module StatefulLens open Lens // Pure lenses open FStar.Heap open FStar.Ref /// Rather than (:=), it's more convenient here to describe the effect of lens /// using Heap.upd, instead of a combination of Heap.modifies and Heap.sel assume val upd_ref (#a:Type) (r:ref a) (v:a) : ST unit (requires (fun h -> True)) (ensures (fun h0 _ h1 -> h1 == upd h0 r v)) /// `hlens a b`: is a lens from a `(heap * a) ` to `b` /// It is purely specificational. /// In the blog post, we gloss over this detail, treating /// hlens as pure lenses, rather than ghost lenses noeq type hlens a b = { get: (heap * a) -> GTot b; put: b -> (heap * a) -> GTot (heap * a) } /// `hlens a b` is just like `Lens.lens (heap * a) b`, except it uses the GTot effect. /// Indeed, it is easy to turn a `lens a b` into an `hlens a b` let as_hlens (l:lens 'a 'b) : hlens 'a 'b = { get = (fun (h, x) -> x.[l]); put = (fun y (h, x) -> h, (x.[l] <- y)); }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lens.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "StatefulLens.fst" }
[ { "abbrev": false, "full_module": "Lens // Pure lenses", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "Lens", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
l: StatefulLens.hlens a b -> m: StatefulLens.hlens b c -> StatefulLens.hlens a c
Prims.Tot
[ "total" ]
[]
[ "StatefulLens.hlens", "StatefulLens.Mkhlens", "FStar.Pervasives.Native.tuple2", "FStar.Monotonic.Heap.heap", "StatefulLens.__proj__Mkhlens__item__get", "FStar.Pervasives.Native.Mktuple2", "StatefulLens.__proj__Mkhlens__item__put" ]
[]
false
false
false
true
false
let compose_hlens #a #b #c (l: hlens a b) (m: hlens b c) : hlens a c =
{ get = (fun (h0, x) -> m.get (h0, l.get (h0, x))); put = (fun (z: c) (h0, x) -> let h1, b = m.put z (h0, (l.get (h0, x))) in l.put b (h1, x)) }
false
StatefulLens.fst
StatefulLens.as_hlens
val as_hlens (l: lens 'a 'b) : hlens 'a 'b
val as_hlens (l: lens 'a 'b) : hlens 'a 'b
let as_hlens (l:lens 'a 'b) : hlens 'a 'b = { get = (fun (h, x) -> x.[l]); put = (fun y (h, x) -> h, (x.[l] <- y)); }
{ "file_name": "examples/data_structures/StatefulLens.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 47, "start_col": 0, "start_line": 44 }
(* 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. *) /// Lenses for accessing and mutating in-place references holding datatypes in a heap /// /// The basic idea is to write stateful lenses indexed by a "ghost" lens /// where the ghost lens is a full specification of the stateful lens' /// behavior on the heap module StatefulLens open Lens // Pure lenses open FStar.Heap open FStar.Ref /// Rather than (:=), it's more convenient here to describe the effect of lens /// using Heap.upd, instead of a combination of Heap.modifies and Heap.sel assume val upd_ref (#a:Type) (r:ref a) (v:a) : ST unit (requires (fun h -> True)) (ensures (fun h0 _ h1 -> h1 == upd h0 r v)) /// `hlens a b`: is a lens from a `(heap * a) ` to `b` /// It is purely specificational. /// In the blog post, we gloss over this detail, treating /// hlens as pure lenses, rather than ghost lenses noeq type hlens a b = { get: (heap * a) -> GTot b; put: b -> (heap * a) -> GTot (heap * a) } /// `hlens a b` is just like `Lens.lens (heap * a) b`, except it uses the GTot effect.
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lens.fst.checked", "FStar.Ref.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Heap.fst.checked" ], "interface_file": false, "source_file": "StatefulLens.fst" }
[ { "abbrev": false, "full_module": "Lens // Pure lenses", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ref", "short_module": null }, { "abbrev": false, "full_module": "FStar.Heap", "short_module": null }, { "abbrev": false, "full_module": "Lens", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
l: Lens.lens 'a 'b -> StatefulLens.hlens 'a 'b
Prims.Tot
[ "total" ]
[]
[ "Lens.lens", "StatefulLens.Mkhlens", "FStar.Pervasives.Native.tuple2", "FStar.Monotonic.Heap.heap", "Lens.op_String_Access", "FStar.Pervasives.Native.Mktuple2", "Lens.op_String_Assignment", "StatefulLens.hlens" ]
[]
false
false
false
true
false
let as_hlens (l: lens 'a 'b) : hlens 'a 'b =
{ get = (fun (h, x) -> x.[ l ]); put = (fun y (h, x) -> h, (x.[ l ] <- y)) }
false
Huffman.fst
Huffman.sorted_smaller
val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)]
val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)]
let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 56, "end_line": 57, "start_col": 0, "start_line": 55 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> y: Huffman.trie -> l: Prims.list Huffman.trie -> FStar.Pervasives.Lemma (requires Huffman.sorted (x :: l) /\ FStar.List.Tot.Base.mem y l) (ensures Huffman.leq_trie x y) [SMTPat (Huffman.sorted (x :: l)); SMTPat (FStar.List.Tot.Base.mem y l)]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Huffman.trie", "Prims.list", "Prims.op_Equality", "Prims.bool", "Huffman.sorted_smaller", "Prims.unit" ]
[ "recursion" ]
false
false
true
false
false
let rec sorted_smaller x y l =
match l with | [] -> () | z :: zs -> if z = y then () else sorted_smaller x y zs
false
Huffman.fst
Huffman.decode
val decode (t: trie) (bs: list bool) : Pure (option (list symbol)) (requires (b2t (Node? t))) (ensures (fun _ -> True))
val decode (t: trie) (bs: list bool) : Pure (option (list symbol)) (requires (b2t (Node? t))) (ensures (fun _ -> True))
let decode (t:trie) (bs:list bool) : Pure (option (list symbol)) (requires (b2t (Node? t))) (ensures (fun _ -> True)) = decode_aux t t bs
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 169, "start_col": 0, "start_line": 167 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *) let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws)) let rec encode_one (t:trie) (s:symbol) : Tot (option (list bool)) = match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None // Modulo the option this is flatten (map (encode_one t) ss) let rec encode (t:trie) (ss:list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs))) = match ss with | [] -> None (* can't encode the empty string *) | [s] -> encode_one t s | s::ss' -> match encode_one t s, encode t ss' with | Some bs, Some bs' -> Some (bs @ bs') | _, _ -> None // A more complex decode I originally wrote let rec decode_one (t:trie) (bs:list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs)))) = match t, bs with | Node _ t1 t2, b::bs' -> decode_one (if b then t2 else t1) bs' | Leaf _ s, _ -> Some (s, bs) | Node _ _ _, [] -> None (* out of symbols *) let rec decode' (t:trie) (bs:list bool) : Tot (option (list symbol)) (decreases (List.Tot.length bs)) = match t, bs with | Leaf _ s, [] -> Some [s] (* degenerate case, case omitted below *) | Leaf _ _, _::_ -> None (* too many symbols, case omitted below *) | Node _ _ _, [] -> Some [] | Node _ _ _, _::_ -> match decode_one t bs with | Some (s, bs') -> (match decode' t bs' with | Some ss -> Some (s :: ss) | None -> None) | _ -> None // Simplified decode using idea from Bird and Wadler's book // (it has more complex termination condition though) let rec decode_aux (t':trie{Node? t'}) (t:trie) (bs:list bool) : Pure (option (list symbol)) (requires (True)) (ensures (fun ss -> Some? ss ==> List.Tot.length (Some?.v ss) > 0)) (decreases (%[bs; if Leaf? t && Cons? bs then 1 else 0])) = match t, bs with | Leaf _ s, [] -> Some [s] | Leaf _ s, _::_ -> (match decode_aux t' t' bs with | Some ss -> Some (s :: ss) | None -> None) | Node _ t1 t2, b :: bs' -> decode_aux t' (if b then t2 else t1) bs' | Node _ _ _, [] -> None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> bs: Prims.list Prims.bool -> Prims.Pure (FStar.Pervasives.Native.option (Prims.list Huffman.symbol))
Prims.Pure
[]
[]
[ "Huffman.trie", "Prims.list", "Prims.bool", "Huffman.decode_aux", "FStar.Pervasives.Native.option", "Huffman.symbol", "Prims.b2t", "Huffman.uu___is_Node", "Prims.l_True" ]
[]
false
false
false
false
false
let decode (t: trie) (bs: list bool) : Pure (option (list symbol)) (requires (b2t (Node? t))) (ensures (fun _ -> True)) =
decode_aux t t bs
false
Huffman.fst
Huffman.insertion_sort
val insertion_sort (ts: list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts'))
val insertion_sort (ts: list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts'))
let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts')
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 53, "end_line": 73, "start_col": 0, "start_line": 69 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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 Huffman.trie -> Prims.Pure (Prims.list Huffman.trie)
Prims.Pure
[]
[]
[ "Prims.list", "Huffman.trie", "Prims.Nil", "Huffman.insert_in_sorted", "Huffman.insertion_sort", "Prims.l_True", "Prims.l_and", "Prims.b2t", "Huffman.sorted", "Huffman.permutation" ]
[ "recursion" ]
false
false
false
false
false
let rec insertion_sort (ts: list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) =
match ts with | [] -> [] | t :: ts' -> insert_in_sorted t (insertion_sort ts')
false
Huffman.fst
Huffman.huffman_trie
val huffman_trie (ts: list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts))
val huffman_trie (ts: list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts))
let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 14, "end_line": 97, "start_col": 0, "start_line": 75 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts')
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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 Huffman.trie -> Prims.Pure Huffman.trie
Prims.Pure
[ "" ]
[]
[ "Prims.list", "Huffman.trie", "Prims.unit", "Prims._assert", "Prims.b2t", "Huffman.uu___is_Node", "Prims.uu___is_Nil", "FStar.List.Tot.Base.existsb", "Huffman.insert_in_sorted", "Huffman.Node", "Prims.bool", "Prims.op_GreaterThan", "FStar.List.Tot.Base.length", "Huffman.huffman_trie", "Prims.int", "Prims.op_Addition", "Huffman.weight", "Prims.l_and", "Huffman.sorted", "Prims.l_imp", "Prims.l_or" ]
[ "recursion" ]
false
false
false
false
false
let rec huffman_trie (ts: list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) =
match ts with | t1 :: t2 :: ts' -> assert (List.Tot.length ts > 1); let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in if Nil? ts' then assert (existsb Node? ((Node w t1 t2) `insert_in_sorted` ts')) else assert (length ((Node w t1 t2) `insert_in_sorted` ts') > 1); assert (Node? t); t | [t1] -> t1
false
Huffman.fst
Huffman.encode
val encode (t: trie) (ss: list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs)))
val encode (t: trie) (ss: list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs)))
let rec encode (t:trie) (ss:list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs))) = match ss with | [] -> None (* can't encode the empty string *) | [s] -> encode_one t s | s::ss' -> match encode_one t s, encode t ss' with | Some bs, Some bs' -> Some (bs @ bs') | _, _ -> None
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 28, "end_line": 124, "start_col": 0, "start_line": 115 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *) let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws)) let rec encode_one (t:trie) (s:symbol) : Tot (option (list bool)) = match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> ss: Prims.list Huffman.symbol -> Prims.Pure (FStar.Pervasives.Native.option (Prims.list Prims.bool))
Prims.Pure
[]
[]
[ "Huffman.trie", "Prims.list", "Huffman.symbol", "FStar.Pervasives.Native.None", "Prims.bool", "Huffman.encode_one", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.option", "Huffman.encode", "FStar.Pervasives.Native.Some", "FStar.List.Tot.Base.op_At", "Prims.l_True", "Prims.l_imp", "Prims.l_and", "Prims.b2t", "Huffman.uu___is_Node", "Prims.uu___is_Cons", "FStar.Pervasives.Native.uu___is_Some", "FStar.Pervasives.Native.__proj__Some__item__v" ]
[ "recursion" ]
false
false
false
false
false
let rec encode (t: trie) (ss: list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs))) =
match ss with | [] -> None | [s] -> encode_one t s | s :: ss' -> match encode_one t s, encode t ss' with | Some bs, Some bs' -> Some (bs @ bs') | _, _ -> None
false
Huffman.fst
Huffman.decode_one
val decode_one (t: trie) (bs: list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs))))
val decode_one (t: trie) (bs: list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs))))
let rec decode_one (t:trie) (bs:list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs)))) = match t, bs with | Node _ t1 t2, b::bs' -> decode_one (if b then t2 else t1) bs' | Leaf _ s, _ -> Some (s, bs) | Node _ _ _, [] -> None
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 136, "start_col": 0, "start_line": 128 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *) let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws)) let rec encode_one (t:trie) (s:symbol) : Tot (option (list bool)) = match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None // Modulo the option this is flatten (map (encode_one t) ss) let rec encode (t:trie) (ss:list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs))) = match ss with | [] -> None (* can't encode the empty string *) | [s] -> encode_one t s | s::ss' -> match encode_one t s, encode t ss' with | Some bs, Some bs' -> Some (bs @ bs') | _, _ -> None // A more complex decode I originally wrote
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> bs: Prims.list Prims.bool -> Prims.Pure (FStar.Pervasives.Native.option (Huffman.symbol * Prims.list Prims.bool))
Prims.Pure
[]
[]
[ "Huffman.trie", "Prims.list", "Prims.bool", "FStar.Pervasives.Native.Mktuple2", "Prims.pos", "Huffman.decode_one", "Huffman.symbol", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Prims.l_True", "Prims.l_imp", "Prims.b2t", "FStar.Pervasives.Native.uu___is_Some", "Prims.l_and", "Prims.op_LessThanOrEqual", "FStar.List.Tot.Base.length", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.__proj__Some__item__v", "Huffman.uu___is_Node", "Prims.op_LessThan" ]
[ "recursion" ]
false
false
false
false
false
let rec decode_one (t: trie) (bs: list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs)))) =
match t, bs with | Node _ t1 t2, b :: bs' -> decode_one (if b then t2 else t1) bs' | Leaf _ s, _ -> Some (s, bs) | Node _ _ _, [] -> None
false
Hacl.Spec.K256.MathLemmas.fst
Hacl.Spec.K256.MathLemmas.lemma_as_nat64_horner
val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0)
val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0)
let lemma_as_nat64_horner r0 r1 r2 r3 = calc (==) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); (==) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; (==) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; (==) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; (==) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; (==) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; }
{ "file_name": "code/k256/Hacl.Spec.K256.MathLemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 150, "start_col": 0, "start_line": 137 }
module Hacl.Spec.K256.MathLemmas open FStar.Mul #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b) let lemma_swap_mul3 a b c = calc (==) { a * b * c; (==) { Math.Lemmas.paren_mul_right a b c } a * (b * c); (==) { Math.Lemmas.swap_mul b c } a * (c * b); (==) { Math.Lemmas.paren_mul_right a c b } a * c * b; } val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n) let lemma_mod_mul_distr a b n = Math.Lemmas.lemma_mod_mul_distr_l a b n; Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n val lemma_mod_sub_distr (a b:int) (n:pos) : Lemma ((a - b) % n = (a % n - b % n) % n) let lemma_mod_sub_distr a b n = Math.Lemmas.lemma_mod_plus_distr_l a (- b) n; Math.Lemmas.lemma_mod_sub_distr (a % n) b n val lemma_ab_le_cd (a b c d:nat) : Lemma (requires a <= c /\ b <= d) (ensures a * b <= c * d) let lemma_ab_le_cd a b c d = Math.Lemmas.lemma_mult_le_left a b d; Math.Lemmas.lemma_mult_le_right d a c val lemma_ab_lt_cd (a b c d:pos) : Lemma (requires a < c /\ b < d) (ensures a * b < c * d) let lemma_ab_lt_cd a b c d = Math.Lemmas.lemma_mult_lt_left a b d; Math.Lemmas.lemma_mult_lt_right d a c val lemma_bound_mul64_wide (ma mb:nat) (mma mmb:nat) (a b:nat) : Lemma (requires a <= ma * mma /\ b <= mb * mmb) (ensures a * b <= ma * mb * (mma * mmb)) let lemma_bound_mul64_wide ma mb mma mmb a b = calc (<=) { a * b; (<=) { lemma_ab_le_cd a b (ma * mma) (mb * mmb) } (ma * mma) * (mb * mmb); (==) { Math.Lemmas.paren_mul_right ma mma (mb * mmb) } ma * (mma * (mb * mmb)); (==) { Math.Lemmas.paren_mul_right mma mb mmb; Math.Lemmas.swap_mul mma mb; Math.Lemmas.paren_mul_right mb mma mmb } ma * (mb * (mma * mmb)); (==) { Math.Lemmas.paren_mul_right ma mb (mma * mmb) } ma * mb * (mma * mmb); } val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d)) let lemma_distr_pow a b c d = calc (==) { (a + b * pow2 c) * pow2 d; (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) } a * pow2 d + b * pow2 c * pow2 d; (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d } a * pow2 d + b * pow2 (c + d); } val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) : Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e)) let lemma_distr_pow_pow a b c d e = calc (==) { (a * pow2 b + c * pow2 d) * pow2 e; (==) { lemma_distr_pow (a * pow2 b) c d e } a * pow2 b * pow2 e + c * pow2 (d + e); (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e } a * pow2 (b + e) + c * pow2 (d + e); } val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a) let lemma_distr_eucl_mul r a b = calc (==) { r * (a % b) + r * (a / b) * b; (==) { Math.Lemmas.paren_mul_right r (a / b) b } r * (a % b) + r * ((a / b) * b); (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) } r * (a % b + a / b * b); (==) { Math.Lemmas.euclidean_division_definition a b } r * a; } val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b) let lemma_distr_eucl_mul_add r a c b = calc (==) { r * (a % b) + r * (a / b + c) * b; (==) { Math.Lemmas.paren_mul_right r (a / b + c) b } r * (a % b) + r * ((a / b + c) * b); (==) { Math.Lemmas.distributivity_add_left (a / b) c b } r * (a % b) + r * ((a / b * b) + c * b); (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) } r * (a % b) + r * (a / b * b) + r * (c * b); (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b } r * (a % b) + r * (a / b) * b + r * c * b; (==) { lemma_distr_eucl_mul r a b } r * a + r * c * b; } val lemma_distr_eucl (a b:int) : Lemma ((a / pow2 52 + b) * pow2 52 + a % pow2 52 = a + b * pow2 52) let lemma_distr_eucl a b = lemma_distr_eucl_mul_add 1 a b (pow2 52) val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2) let lemma_a_plus_b_pow2_mod2 a b c = assert_norm (pow2 1 = 2); Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2; Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c val lemma_as_nat64_horner (r0 r1 r2 r3:int) : Lemma (r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192 == ((r3 * pow2 64 + r2) * pow2 64 + r1) * pow2 64 + r0)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.MathLemmas.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
r0: Prims.int -> r1: Prims.int -> r2: Prims.int -> r3: Prims.int -> FStar.Pervasives.Lemma (ensures r0 + r1 * Prims.pow2 64 + r2 * Prims.pow2 128 + r3 * Prims.pow2 192 == ((r3 * Prims.pow2 64 + r2) * Prims.pow2 64 + r1) * Prims.pow2 64 + r0)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "FStar.Calc.calc_finish", "Prims.eq2", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.pow2", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "FStar.Math.Lemmas.swap_mul", "Prims.squash", "Hacl.Spec.K256.MathLemmas.lemma_distr_pow" ]
[]
false
false
true
false
false
let lemma_as_nat64_horner r0 r1 r2 r3 =
calc ( == ) { r0 + pow2 64 * (r1 + pow2 64 * (r2 + pow2 64 * r3)); ( == ) { Math.Lemmas.swap_mul (pow2 64) (r1 + pow2 64 * (r2 + pow2 64 * r3)) } r0 + (r1 + pow2 64 * (r2 + pow2 64 * r3)) * pow2 64; ( == ) { Math.Lemmas.swap_mul (pow2 64) (r2 + pow2 64 * r3) } r0 + (r1 + (r2 + pow2 64 * r3) * pow2 64) * pow2 64; ( == ) { lemma_distr_pow r1 (r2 + pow2 64 * r3) 64 64 } r0 + r1 * pow2 64 + (r2 + pow2 64 * r3) * pow2 128; ( == ) { Math.Lemmas.swap_mul (pow2 64) r3 } r0 + r1 * pow2 64 + (r2 + r3 * pow2 64) * pow2 128; ( == ) { lemma_distr_pow r2 r3 64 128 } r0 + r1 * pow2 64 + r2 * pow2 128 + r3 * pow2 192; }
false
Huffman.fst
Huffman.decode'
val decode' (t: trie) (bs: list bool) : Tot (option (list symbol)) (decreases (List.Tot.length bs))
val decode' (t: trie) (bs: list bool) : Tot (option (list symbol)) (decreases (List.Tot.length bs))
let rec decode' (t:trie) (bs:list bool) : Tot (option (list symbol)) (decreases (List.Tot.length bs)) = match t, bs with | Leaf _ s, [] -> Some [s] (* degenerate case, case omitted below *) | Leaf _ _, _::_ -> None (* too many symbols, case omitted below *) | Node _ _ _, [] -> Some [] | Node _ _ _, _::_ -> match decode_one t bs with | Some (s, bs') -> (match decode' t bs' with | Some ss -> Some (s :: ss) | None -> None) | _ -> None
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 35, "end_line": 148, "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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *) let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws)) let rec encode_one (t:trie) (s:symbol) : Tot (option (list bool)) = match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None // Modulo the option this is flatten (map (encode_one t) ss) let rec encode (t:trie) (ss:list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs))) = match ss with | [] -> None (* can't encode the empty string *) | [s] -> encode_one t s | s::ss' -> match encode_one t s, encode t ss' with | Some bs, Some bs' -> Some (bs @ bs') | _, _ -> None // A more complex decode I originally wrote let rec decode_one (t:trie) (bs:list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs)))) = match t, bs with | Node _ t1 t2, b::bs' -> decode_one (if b then t2 else t1) bs' | Leaf _ s, _ -> Some (s, bs) | Node _ _ _, [] -> None (* out of symbols *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Huffman.trie -> bs: Prims.list Prims.bool -> Prims.Tot (FStar.Pervasives.Native.option (Prims.list Huffman.symbol))
Prims.Tot
[ "total", "" ]
[]
[ "Huffman.trie", "Prims.list", "Prims.bool", "FStar.Pervasives.Native.Mktuple2", "Prims.pos", "Huffman.symbol", "FStar.Pervasives.Native.Some", "Prims.Cons", "Prims.Nil", "FStar.Pervasives.Native.None", "Huffman.decode_one", "Huffman.decode'", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2" ]
[ "recursion" ]
false
false
false
true
false
let rec decode' (t: trie) (bs: list bool) : Tot (option (list symbol)) (decreases (List.Tot.length bs)) =
match t, bs with | Leaf _ s, [] -> Some [s] | Leaf _ _, _ :: _ -> None | Node _ _ _, [] -> Some [] | Node _ _ _, _ :: _ -> match decode_one t bs with | Some (s, bs') -> (match decode' t bs' with | Some ss -> Some (s :: ss) | None -> None) | _ -> None
false
Huffman.fst
Huffman.huffman
val huffman (sws: list (symbol * pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t))
val huffman (sws: list (symbol * pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t))
let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws))
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 74, "end_line": 102, "start_col": 0, "start_line": 99 }
(* 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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
sws: Prims.list (Huffman.symbol * Prims.pos) -> Prims.Pure Huffman.trie
Prims.Pure
[]
[]
[ "Prims.list", "FStar.Pervasives.Native.tuple2", "Huffman.symbol", "Prims.pos", "Huffman.huffman_trie", "Huffman.insertion_sort", "FStar.List.Tot.Base.map", "Huffman.trie", "Huffman.Leaf", "Prims.b2t", "Prims.op_GreaterThan", "FStar.List.Tot.Base.length", "Prims.l_imp", "Huffman.uu___is_Node" ]
[]
false
false
false
false
false
let huffman (sws: list (symbol * pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) =
huffman_trie (insertion_sort (List.Tot.map (fun (s, w) -> Leaf w s) sws))
false
Huffman.fst
Huffman.decode_aux
val decode_aux (t': trie{Node? t'}) (t: trie) (bs: list bool) : Pure (option (list symbol)) (requires (True)) (ensures (fun ss -> Some? ss ==> List.Tot.length (Some?.v ss) > 0)) (decreases (%[bs;if Leaf? t && Cons? bs then 1 else 0]))
val decode_aux (t': trie{Node? t'}) (t: trie) (bs: list bool) : Pure (option (list symbol)) (requires (True)) (ensures (fun ss -> Some? ss ==> List.Tot.length (Some?.v ss) > 0)) (decreases (%[bs;if Leaf? t && Cons? bs then 1 else 0]))
let rec decode_aux (t':trie{Node? t'}) (t:trie) (bs:list bool) : Pure (option (list symbol)) (requires (True)) (ensures (fun ss -> Some? ss ==> List.Tot.length (Some?.v ss) > 0)) (decreases (%[bs; if Leaf? t && Cons? bs then 1 else 0])) = match t, bs with | Leaf _ s, [] -> Some [s] | Leaf _ s, _::_ -> (match decode_aux t' t' bs with | Some ss -> Some (s :: ss) | None -> None) | Node _ t1 t2, b :: bs' -> decode_aux t' (if b then t2 else t1) bs' | Node _ _ _, [] -> None
{ "file_name": "examples/algorithms/Huffman.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 26, "end_line": 165, "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 Huffman open FStar.Char open FStar.List.Tot type symbol = char // could consider moving weights away from the nodes, // only need one weight per each trie in the forest type trie = | Leaf : w:pos -> s:symbol -> trie | Node : w:pos -> l:trie -> r:trie -> trie let weight (t:trie) : Tot pos = match t with | Leaf w _ -> w | Node w _ _ -> w let leq_trie (t1:trie) (t2:trie) : Tot bool = weight t1 <= weight t2 (* Copied and adapted some part about sorted int lists, this should really be generic in the library *) let rec sorted (ts:list trie) : Tot bool = match ts with | [] | [_] -> true | t1::t2::ts' -> leq_trie t1 t2 && sorted (t2::ts') type permutation (l1:list trie) (l2:list trie) = length l1 = length l2 /\ (forall n. mem n l1 = mem n l2) val sorted_smaller: x:trie -> y:trie -> l:list trie -> Lemma (requires (sorted (x::l) /\ mem y l)) (ensures (leq_trie x y)) [SMTPat (sorted (x::l)); SMTPat (mem y l)] let rec sorted_smaller x y l = match l with | [] -> () | z::zs -> if z=y then () else sorted_smaller x y zs let rec insert_in_sorted (x:trie) (xs:list trie) : Pure (list trie) (requires (b2t (sorted xs))) (ensures (fun ys -> sorted ys /\ permutation (x::xs) ys)) = match xs with | [] -> [x] | x'::xs' -> if leq_trie x x' then x :: xs else (let i_tl = insert_in_sorted x xs' in let (z::_) = i_tl in (* <-- needed for triggering patterns? *) x' :: i_tl) let rec insertion_sort (ts : list trie) : Pure (list trie) (requires (True)) (ensures (fun ts' -> sorted ts' /\ permutation ts ts')) = match ts with | [] -> [] | t::ts' -> insert_in_sorted t (insertion_sort ts') let rec huffman_trie (ts:list trie) : Pure trie (requires (sorted ts /\ List.Tot.length ts > 0)) (ensures (fun t -> ((List.Tot.length ts > 1 \/ existsb Node? ts) ==> Node? t))) (decreases (List.Tot.length ts)) = match ts with | t1::t2::ts' -> assert(List.Tot.length ts > 1); (* so it needs to prove Node? t *) let w = weight t1 + weight t2 in let t = huffman_trie ((Node w t1 t2) `insert_in_sorted` ts') in (* by the recursive call we know: (List.Tot.length (Node w t1 t2 `insert_in_sorted` ts') > 1 \/ existsb Node? (Node w t1 t2 `insert_in_sorted` ts') ==> Node? t) *) (* Since ts' could be empty, I thought that the only way we can use this is by proving: existsb Node? (Node w t1 t2 `insert_in_sorted` ts'), which requires induction. But F* was smarter! *) if Nil? ts' then assert(existsb Node? (Node w t1 t2 `insert_in_sorted` ts')) else assert(length (Node w t1 t2 `insert_in_sorted` ts') > 1); assert(Node? t); t | [t1] -> t1 (* this uses `existsb Node? [t] ==> Node? t` fact *) let huffman (sws:list (symbol*pos)) : Pure trie (requires (b2t (List.Tot.length sws > 0))) (ensures (fun t -> List.Tot.length sws > 1 ==> Node? t)) = huffman_trie (insertion_sort (List.Tot.map (fun (s,w) -> Leaf w s) sws)) let rec encode_one (t:trie) (s:symbol) : Tot (option (list bool)) = match t with | Leaf _ s' -> if s = s' then Some [] else None | Node _ t1 t2 -> match encode_one t1 s with | Some bs -> Some (false :: bs) | None -> match encode_one t2 s with | Some bs -> Some (true :: bs) | None -> None // Modulo the option this is flatten (map (encode_one t) ss) let rec encode (t:trie) (ss:list symbol) : Pure (option (list bool)) (requires (True)) (ensures (fun bs -> Node? t /\ Cons? ss /\ Some? bs ==> Cons? (Some?.v bs))) = match ss with | [] -> None (* can't encode the empty string *) | [s] -> encode_one t s | s::ss' -> match encode_one t s, encode t ss' with | Some bs, Some bs' -> Some (bs @ bs') | _, _ -> None // A more complex decode I originally wrote let rec decode_one (t:trie) (bs:list bool) : Pure (option (symbol * list bool)) (requires (True)) (ensures (fun r -> Some? r ==> (List.Tot.length (snd (Some?.v r)) <= List.Tot.length bs /\ (Node? t ==> List.Tot.length (snd (Some?.v r)) < List.Tot.length bs)))) = match t, bs with | Node _ t1 t2, b::bs' -> decode_one (if b then t2 else t1) bs' | Leaf _ s, _ -> Some (s, bs) | Node _ _ _, [] -> None (* out of symbols *) let rec decode' (t:trie) (bs:list bool) : Tot (option (list symbol)) (decreases (List.Tot.length bs)) = match t, bs with | Leaf _ s, [] -> Some [s] (* degenerate case, case omitted below *) | Leaf _ _, _::_ -> None (* too many symbols, case omitted below *) | Node _ _ _, [] -> Some [] | Node _ _ _, _::_ -> match decode_one t bs with | Some (s, bs') -> (match decode' t bs' with | Some ss -> Some (s :: ss) | None -> None) | _ -> None // Simplified decode using idea from Bird and Wadler's book // (it has more complex termination condition though)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "Huffman.fst" }
[ { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Char", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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': Huffman.trie{Node? t'} -> t: Huffman.trie -> bs: Prims.list Prims.bool -> Prims.Pure (FStar.Pervasives.Native.option (Prims.list Huffman.symbol))
Prims.Pure
[ "" ]
[]
[ "Huffman.trie", "Prims.b2t", "Huffman.uu___is_Node", "Prims.list", "Prims.bool", "FStar.Pervasives.Native.Mktuple2", "Prims.pos", "Huffman.symbol", "FStar.Pervasives.Native.Some", "Prims.Cons", "Prims.Nil", "Huffman.decode_aux", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Prims.l_True", "Prims.l_imp", "FStar.Pervasives.Native.uu___is_Some", "Prims.op_GreaterThan", "FStar.List.Tot.Base.length", "FStar.Pervasives.Native.__proj__Some__item__v" ]
[ "recursion" ]
false
false
false
false
false
let rec decode_aux (t': trie{Node? t'}) (t: trie) (bs: list bool) : Pure (option (list symbol)) (requires (True)) (ensures (fun ss -> Some? ss ==> List.Tot.length (Some?.v ss) > 0)) (decreases (%[bs;if Leaf? t && Cons? bs then 1 else 0])) =
match t, bs with | Leaf _ s, [] -> Some [s] | Leaf _ s, _ :: _ -> (match decode_aux t' t' bs with | Some ss -> Some (s :: ss) | None -> None) | Node _ t1 t2, b :: bs' -> decode_aux t' (if b then t2 else t1) bs' | Node _ _ _, [] -> None
false