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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.instantiate_term_implicits | val instantiate_term_implicits (g:env) (t:term)
: T.Tac (term & term) | val instantiate_term_implicits (g:env) (t:term)
: T.Tac (term & term) | let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 51,
"end_line": 226,
"start_col": 0,
"start_line": 194
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac (Pulse.Syntax.Base.term * Pulse.Syntax.Base.term) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple3",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Stubs.Reflection.Types.namedv",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Tactics.Types.issues",
"Pulse.Checker.Pure.maybe_fail_doc",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"FStar.Stubs.Pprint.document",
"Prims.Cons",
"Prims.Nil",
"FStar.Stubs.Pprint.prefix",
"Pulse.PP.text",
"Pulse.PP.pp",
"Pulse.PP.uu___44",
"Prims.op_disEquality",
"Prims.int",
"FStar.List.Tot.Base.length",
"FStar.Issue.issue",
"Prims.bool",
"FStar.Pervasives.Native.Mktuple2",
"Prims.eq2",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Prims.string",
"Pulse.Checker.Pure.readback_failure",
"Pulse.Readback.readback_ty",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.log_issues",
"Pulse.Checker.Pure.catch_all",
"Pulse.Checker.Pure.rtb_instantiate_implicits",
"FStar.Stubs.Reflection.Types.env",
"Pulse.RuntimeUtils.env_set_range",
"FStar.Range.range",
"Pulse.Typing.Env.get_range",
"Pulse.Typing.elab_env"
] | [] | false | true | false | false | false | let instantiate_term_implicits (g: env) (t0: term) =
| let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None ->
(let open Pulse.PP in
maybe_fail_doc issues
g
t0.range
[prefix 4 1 (text "Could not infer implicit arguments in") (pp t0)])
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g
t0.range
[prefix 4 1 (text "check_term: could not infer implicit arguments in") (pp t0)]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None -> fail g (Some t0.range) (readback_failure ty)
| None, _ -> fail g (Some t0.range) (readback_failure t) | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.check_vprop | val check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) | val check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) | let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 73,
"end_line": 459,
"start_col": 0,
"start_line": 456
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(Prims.dtuple2 Pulse.Syntax.Base.term
(fun t -> Pulse.Typing.tot_typing g t Pulse.Syntax.Base.tm_vprop)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Pure.check_term",
"Pulse.Typing.Env.push_context_no_range",
"FStar.Stubs.TypeChecker.Core.E_Total",
"Pulse.Syntax.Base.tm_vprop",
"Prims.dtuple2",
"Pulse.Typing.typing",
"Pulse.Typing.tot_typing"
] | [] | false | true | false | false | false | let check_vprop (g: env) (t: term) : T.Tac (t: term & tot_typing g t tm_vprop) =
| check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.get_non_informative_witness | val get_non_informative_witness (g:env) (u:universe) (t:term)
: T.Tac (non_informative_t g u t) | val get_non_informative_witness (g:env) (u:universe) (t:term)
: T.Tac (non_informative_t g u t) | let get_non_informative_witness g u t
: T.Tac (non_informative_t g u t)
= match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some e -> e | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 17,
"end_line": 531,
"start_col": 0,
"start_line": 522
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref"
let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> u229: Pulse.Syntax.Base.universe -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac (Pulse.Typing.non_informative_t g u229 t) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.term",
"Pulse.Typing.Env.fail_doc",
"Pulse.Typing.non_informative_t",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Prims.list",
"FStar.Stubs.Pprint.document",
"Prims.Cons",
"Prims.Nil",
"FStar.Stubs.Pprint.op_Hat_Slash_Hat",
"Pulse.PP.text",
"Pulse.PP.pp",
"Pulse.PP.uu___44",
"FStar.Pervasives.Native.option",
"Pulse.Checker.Pure.try_get_non_informative_witness"
] | [] | false | true | false | false | false | let get_non_informative_witness g u t : T.Tac (non_informative_t g u t) =
| match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g
(Some t.range)
[text "Expected a term with a non-informative (e.g., erased) type; got" ^/^ pp t]
| Some e -> e | false |
EverCrypt.Chacha20Poly1305.fst | EverCrypt.Chacha20Poly1305.aead_decrypt | val aead_decrypt:
k:lbuffer uint8 32ul -> // key
n:lbuffer uint8 12ul -> // nonce
aadlen:size_t ->
aad:lbuffer uint8 aadlen ->
(mlen:size_t{v mlen + 16 <= max_size_t /\ v aadlen + v mlen / 64 <= max_size_t}) ->
m:lbuffer uint8 mlen -> // output: buffer for decrypted plaintext
c:lbuffer uint8 mlen -> // input: cipher
mac:lbuffer uint8 16ul -> // input: mac
Stack UInt32.t
(requires (fun h ->
eq_or_disjoint m c /\
live h k /\ live h n /\ live h aad /\ live h m /\ live h c /\ live h mac))
(ensures (fun h0 z h1 -> modifies (loc m) h0 h1 /\
(let plain = Spec.aead_decrypt (as_seq h0 k) (as_seq h0 n) (as_seq h0 c) (as_seq h0 mac) (as_seq h0 aad) in
match z with
| 0ul -> Some? plain /\ as_seq h1 m == Some?.v plain // decryption succeeded
| 1ul -> None? plain
| _ -> false) // decryption failed
)
) | val aead_decrypt:
k:lbuffer uint8 32ul -> // key
n:lbuffer uint8 12ul -> // nonce
aadlen:size_t ->
aad:lbuffer uint8 aadlen ->
(mlen:size_t{v mlen + 16 <= max_size_t /\ v aadlen + v mlen / 64 <= max_size_t}) ->
m:lbuffer uint8 mlen -> // output: buffer for decrypted plaintext
c:lbuffer uint8 mlen -> // input: cipher
mac:lbuffer uint8 16ul -> // input: mac
Stack UInt32.t
(requires (fun h ->
eq_or_disjoint m c /\
live h k /\ live h n /\ live h aad /\ live h m /\ live h c /\ live h mac))
(ensures (fun h0 z h1 -> modifies (loc m) h0 h1 /\
(let plain = Spec.aead_decrypt (as_seq h0 k) (as_seq h0 n) (as_seq h0 c) (as_seq h0 mac) (as_seq h0 aad) in
match z with
| 0ul -> Some? plain /\ as_seq h1 m == Some?.v plain // decryption succeeded
| 1ul -> None? plain
| _ -> false) // decryption failed
)
) | let aead_decrypt k n aadlen aad mlen m cipher tag =
let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256 then begin
LowStar.Ignore.ignore vec128;
Hacl.Chacha20Poly1305_256.decrypt m cipher mlen aad aadlen k n tag
end else if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128 then begin
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_128.decrypt m cipher mlen aad aadlen k n tag
end else begin
LowStar.Ignore.ignore vec128;
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_32.decrypt m cipher mlen aad aadlen k n tag
end | {
"file_name": "providers/evercrypt/fst/EverCrypt.Chacha20Poly1305.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 48,
"start_col": 0,
"start_line": 32
} | module EverCrypt.Chacha20Poly1305
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
module Seq = Lib.Sequence
open FStar.Mul
module Spec = Spec.Chacha20Poly1305
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20"
let aead_encrypt k n aadlen aad mlen m cipher tag =
let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256 then begin
LowStar.Ignore.ignore vec128;
Hacl.Chacha20Poly1305_256.encrypt cipher tag m mlen aad aadlen k n
end else if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128 then begin
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_128.encrypt cipher tag m mlen aad aadlen k n
end else begin
LowStar.Ignore.ignore vec128;
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_32.encrypt cipher tag m mlen aad aadlen k n
end | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Chacha20Poly1305_32.fst.checked",
"Hacl.Chacha20Poly1305_256.fst.checked",
"Hacl.Chacha20Poly1305_128.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Chacha20Poly1305.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"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": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"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": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
aadlen: Lib.IntTypes.size_t ->
aad: Lib.Buffer.lbuffer Lib.IntTypes.uint8 aadlen ->
mlen:
Lib.IntTypes.size_t
{ Lib.IntTypes.v mlen + 16 <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v aadlen + Lib.IntTypes.v mlen / 64 <= Lib.IntTypes.max_size_t } ->
m: Lib.Buffer.lbuffer Lib.IntTypes.uint8 mlen ->
c: Lib.Buffer.lbuffer Lib.IntTypes.uint8 mlen ->
mac: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul
-> FStar.HyperStack.ST.Stack FStar.UInt32.t | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Prims.op_Division",
"Prims.op_AmpAmp",
"EverCrypt.TargetConfig.hacl_can_compile_vec256",
"Hacl.Chacha20Poly1305_256.decrypt",
"FStar.UInt32.t",
"Prims.unit",
"LowStar.Ignore.ignore",
"Prims.bool",
"EverCrypt.TargetConfig.hacl_can_compile_vec128",
"Hacl.Chacha20Poly1305_128.decrypt",
"Hacl.Chacha20Poly1305_32.decrypt",
"EverCrypt.AutoConfig2.has_vec128",
"EverCrypt.AutoConfig2.has_vec256"
] | [] | false | true | false | false | false | let aead_decrypt k n aadlen aad mlen m cipher tag =
| let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256
then
(LowStar.Ignore.ignore vec128;
Hacl.Chacha20Poly1305_256.decrypt m cipher mlen aad aadlen k n tag)
else
if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128
then
(LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_128.decrypt m cipher mlen aad aadlen k n tag)
else
(LowStar.Ignore.ignore vec128;
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_32.decrypt m cipher mlen aad aadlen k n tag) | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.check_prop_validity | val check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p) | val check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p) | let check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p)
= let t_opt, issues = rtb_check_prop_validity g false (elab_env g) (elab_term p) in
T.log_issues issues;
match t_opt with
| None ->
let open Pulse.PP in
maybe_fail_doc issues g p.range
[text "Failed to prove property:" ^/^ pp p]
| Some tok -> tok | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 21,
"end_line": 548,
"start_col": 0,
"start_line": 539
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref"
let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok
let get_non_informative_witness g u t
: T.Tac (non_informative_t g u t)
= match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some e -> e
let try_check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (option (Pulse.Typing.prop_validity g p))
= let t_opt, issues = rtb_check_prop_validity g true (elab_env g) (elab_term p) in
t_opt | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 |
g: Pulse.Typing.Env.env ->
p: Pulse.Syntax.Base.term ->
_: Pulse.Typing.tot_typing g p Pulse.Typing.tm_prop
-> FStar.Tactics.Effect.Tac (Pulse.Typing.prop_validity g p) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"Pulse.Typing.tm_prop",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Tactics.V2.Builtins.prop_validity_token",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Stubs.Tactics.Types.issues",
"Pulse.Checker.Pure.maybe_fail_doc",
"Pulse.Typing.prop_validity",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Prims.list",
"FStar.Stubs.Pprint.document",
"Prims.Cons",
"Prims.Nil",
"FStar.Stubs.Pprint.op_Hat_Slash_Hat",
"Pulse.PP.text",
"Pulse.PP.pp",
"Pulse.PP.uu___44",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.log_issues",
"FStar.Pervasives.Native.tuple2",
"Pulse.Checker.Pure.rtb_check_prop_validity"
] | [] | false | true | false | false | false | let check_prop_validity (g: env) (p: term) (_: tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p) =
| let t_opt, issues = rtb_check_prop_validity g false (elab_env g) (elab_term p) in
T.log_issues issues;
match t_opt with
| None ->
let open Pulse.PP in maybe_fail_doc issues g p.range [text "Failed to prove property:" ^/^ pp p]
| Some tok -> tok | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.compute_tot_term_type_and_u | val compute_tot_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
u:universe &
ty:typ &
universe_of g ty u &
tot_typing g t ty) | val compute_tot_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
u:universe &
ty:typ &
universe_of g ty u &
tot_typing g t ty) | let compute_tot_term_type_and_u g t =
let (| t, eff, ty, (| u, ty_typing |), t_typing |) = compute_term_type_and_u g t in
if eff = T.E_Total then (| t, u, ty, ty_typing, t_typing |)
else fail_expected_tot_found_ghost g t | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 562,
"start_col": 0,
"start_line": 559
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref"
let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok
let get_non_informative_witness g u t
: T.Tac (non_informative_t g u t)
= match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some e -> e
let try_check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (option (Pulse.Typing.prop_validity g p))
= let t_opt, issues = rtb_check_prop_validity g true (elab_env g) (elab_term p) in
t_opt
let check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p)
= let t_opt, issues = rtb_check_prop_validity g false (elab_env g) (elab_term p) in
T.log_issues issues;
match t_opt with
| None ->
let open Pulse.PP in
maybe_fail_doc issues g p.range
[text "Failed to prove property:" ^/^ pp p]
| Some tok -> tok
let fail_expected_tot_found_ghost (g:env) (t:term) =
fail g (Some t.range)
(Printf.sprintf "Expected a total term, found ghost term %s" (P.term_to_string t))
let compute_tot_term_type g t =
let (| t, eff, ty, t_typing |) = compute_term_type g t in
if eff = T.E_Total then (| t, ty, t_typing |)
else fail_expected_tot_found_ghost g t | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple5 Pulse.Syntax.Base.term
(fun _ -> Pulse.Syntax.Base.universe)
(fun _ _ -> Pulse.Syntax.Base.typ)
(fun _ u274 ty -> Pulse.Typing.universe_of g ty u274)
(fun t _ ty _ -> Pulse.Typing.tot_typing g t ty)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.universe_of",
"Pulse.Typing.typing",
"Prims.op_Equality",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Pervasives.Mkdtuple5",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.tot_typing",
"FStar.Pervasives.dtuple5",
"Prims.bool",
"Pulse.Checker.Pure.fail_expected_tot_found_ghost",
"Prims.dtuple2",
"Pulse.Checker.Pure.compute_term_type_and_u"
] | [] | false | true | false | false | false | let compute_tot_term_type_and_u g t =
| let (| t , eff , ty , (| u , ty_typing |) , t_typing |) = compute_term_type_and_u g t in
if eff = T.E_Total then (| t, u, ty, ty_typing, t_typing |) else fail_expected_tot_found_ghost g t | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.check_subtyping | val check_subtyping (g:env) (t1 t2 : term)
: T.Tac (subtyping_token g t1 t2) | val check_subtyping (g:env) (t1 t2 : term)
: T.Tac (subtyping_token g t1 t2) | let check_subtyping g t1 t2 =
T.with_policy SMTSync (fun () ->
let res, issues = rtb_check_subtyping g t1 t2 in
T.log_issues issues;
match res with
| Some tok -> tok
| None ->
let open Pulse.PP in
maybe_fail_doc issues g t1.range
[ text "Could not prove subtyping of "
^/^ pp t1 ^/^ text "and" ^/^ pp t2]
) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 591,
"start_col": 0,
"start_line": 580
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref"
let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok
let get_non_informative_witness g u t
: T.Tac (non_informative_t g u t)
= match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some e -> e
let try_check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (option (Pulse.Typing.prop_validity g p))
= let t_opt, issues = rtb_check_prop_validity g true (elab_env g) (elab_term p) in
t_opt
let check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p)
= let t_opt, issues = rtb_check_prop_validity g false (elab_env g) (elab_term p) in
T.log_issues issues;
match t_opt with
| None ->
let open Pulse.PP in
maybe_fail_doc issues g p.range
[text "Failed to prove property:" ^/^ pp p]
| Some tok -> tok
let fail_expected_tot_found_ghost (g:env) (t:term) =
fail g (Some t.range)
(Printf.sprintf "Expected a total term, found ghost term %s" (P.term_to_string t))
let compute_tot_term_type g t =
let (| t, eff, ty, t_typing |) = compute_term_type g t in
if eff = T.E_Total then (| t, ty, t_typing |)
else fail_expected_tot_found_ghost g t
let compute_tot_term_type_and_u g t =
let (| t, eff, ty, (| u, ty_typing |), t_typing |) = compute_term_type_and_u g t in
if eff = T.E_Total then (| t, u, ty, ty_typing, t_typing |)
else fail_expected_tot_found_ghost g t
let check_tot_term g e t =
check_term g e T.E_Total t
let core_compute_tot_term_type g t =
let (| eff, ty, d |) = core_compute_term_type g t in
if eff = T.E_Total then (| ty, d |)
else fail_expected_tot_found_ghost g t
let core_check_tot_term g e t =
core_check_term g e T.E_Total t
let is_non_informative g c =
let ropt, issues = catch_all (fun _ -> T.is_non_informative (elab_env g) (elab_comp c)) in
T.log_issues issues;
ropt | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t1: Pulse.Syntax.Base.term -> t2: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac (Pulse.Typing.subtyping_token g t1 t2) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Tactics.V2.Derived.with_policy",
"Pulse.Typing.subtyping_token",
"FStar.Stubs.Tactics.Types.SMTSync",
"Prims.unit",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Tactics.Types.issues",
"Pulse.Checker.Pure.maybe_fail_doc",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Prims.list",
"FStar.Stubs.Pprint.document",
"Prims.Cons",
"Prims.Nil",
"FStar.Stubs.Pprint.op_Hat_Slash_Hat",
"Pulse.PP.text",
"Pulse.PP.pp",
"Pulse.PP.uu___44",
"FStar.Stubs.Tactics.V2.Builtins.log_issues",
"FStar.Pervasives.Native.tuple2",
"Pulse.Checker.Pure.rtb_check_subtyping",
"FStar.Stubs.Tactics.V2.Builtins.ret_t"
] | [] | false | true | false | false | false | let check_subtyping g t1 t2 =
| T.with_policy SMTSync
(fun () ->
let res, issues = rtb_check_subtyping g t1 t2 in
T.log_issues issues;
match res with
| Some tok -> tok
| None ->
let open Pulse.PP in
maybe_fail_doc issues
g
t1.range
[text "Could not prove subtyping of " ^/^ pp t1 ^/^ text "and" ^/^ pp t2]) | false |
Hacl.Spec.Bignum.AlmostMontgomery.fst | Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_sqr | val bn_almost_mont_sqr:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen ->
lbignum t nLen | val bn_almost_mont_sqr:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen ->
lbignum t nLen | let bn_almost_mont_sqr #t #nLen n mu aM =
let c = BN.bn_mul aM aM in // c = aM * aM
bn_almost_mont_reduction n mu c | {
"file_name": "code/bignum/Hacl.Spec.Bignum.AlmostMontgomery.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 33,
"start_col": 0,
"start_line": 31
} | module Hacl.Spec.Bignum.AlmostMontgomery
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BN = Hacl.Spec.Bignum
module BM = Hacl.Spec.Bignum.Montgomery
friend Hacl.Spec.Bignum.Montgomery
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
/// Low-level specification of Almost Montgomery Multiplication
let bn_almost_mont_reduction #t #nLen n mu c =
let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res
let bn_almost_mont_mul #t #nLen n mu aM bM =
let c = BN.bn_mul aM bM in // c = aM * bM
bn_almost_mont_reduction n mu c // resM = c % n | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.AlmostMontgomery.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.AlmostMontgomery.Lemmas",
"short_module": "AM"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
mu: Hacl.Spec.Bignum.Definitions.limb t ->
aM: Hacl.Spec.Bignum.Definitions.lbignum t nLen
-> Hacl.Spec.Bignum.Definitions.lbignum t nLen | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_reduction",
"Hacl.Spec.Bignum.bn_mul"
] | [] | false | false | false | false | false | let bn_almost_mont_sqr #t #nLen n mu aM =
| let c = BN.bn_mul aM aM in
bn_almost_mont_reduction n mu c | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.compute_tot_term_type | val compute_tot_term_type (g:env) (t:term)
: T.Tac (t:term & ty:typ & tot_typing g t ty) | val compute_tot_term_type (g:env) (t:term)
: T.Tac (t:term & ty:typ & tot_typing g t ty) | let compute_tot_term_type g t =
let (| t, eff, ty, t_typing |) = compute_term_type g t in
if eff = T.E_Total then (| t, ty, t_typing |)
else fail_expected_tot_found_ghost g t | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 557,
"start_col": 0,
"start_line": 554
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref"
let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok
let get_non_informative_witness g u t
: T.Tac (non_informative_t g u t)
= match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some e -> e
let try_check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (option (Pulse.Typing.prop_validity g p))
= let t_opt, issues = rtb_check_prop_validity g true (elab_env g) (elab_term p) in
t_opt
let check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p)
= let t_opt, issues = rtb_check_prop_validity g false (elab_env g) (elab_term p) in
T.log_issues issues;
match t_opt with
| None ->
let open Pulse.PP in
maybe_fail_doc issues g p.range
[text "Failed to prove property:" ^/^ pp p]
| Some tok -> tok
let fail_expected_tot_found_ghost (g:env) (t:term) =
fail g (Some t.range)
(Printf.sprintf "Expected a total term, found ghost term %s" (P.term_to_string t)) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple3 Pulse.Syntax.Base.term
(fun _ -> Pulse.Syntax.Base.typ)
(fun t ty -> Pulse.Typing.tot_typing g t ty)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"Pulse.Typing.typing",
"Prims.op_Equality",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.tot_typing",
"FStar.Pervasives.dtuple3",
"Prims.bool",
"Pulse.Checker.Pure.fail_expected_tot_found_ghost",
"FStar.Pervasives.dtuple4",
"Pulse.Checker.Pure.compute_term_type"
] | [] | false | true | false | false | false | let compute_tot_term_type g t =
| let (| t , eff , ty , t_typing |) = compute_term_type g t in
if eff = T.E_Total then (| t, ty, t_typing |) else fail_expected_tot_found_ghost g t | false |
Hacl.Spec.Bignum.AlmostMontgomery.fst | Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_mul | val bn_almost_mont_mul:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen
-> bM:lbignum t nLen ->
lbignum t nLen | val bn_almost_mont_mul:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen
-> bM:lbignum t nLen ->
lbignum t nLen | let bn_almost_mont_mul #t #nLen n mu aM bM =
let c = BN.bn_mul aM bM in // c = aM * bM
bn_almost_mont_reduction n mu c | {
"file_name": "code/bignum/Hacl.Spec.Bignum.AlmostMontgomery.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 29,
"start_col": 0,
"start_line": 27
} | module Hacl.Spec.Bignum.AlmostMontgomery
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BN = Hacl.Spec.Bignum
module BM = Hacl.Spec.Bignum.Montgomery
friend Hacl.Spec.Bignum.Montgomery
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
/// Low-level specification of Almost Montgomery Multiplication
let bn_almost_mont_reduction #t #nLen n mu c =
let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.AlmostMontgomery.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.AlmostMontgomery.Lemmas",
"short_module": "AM"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
mu: Hacl.Spec.Bignum.Definitions.limb t ->
aM: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
bM: Hacl.Spec.Bignum.Definitions.lbignum t nLen
-> Hacl.Spec.Bignum.Definitions.lbignum t nLen | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_reduction",
"Hacl.Spec.Bignum.bn_mul"
] | [] | false | false | false | false | false | let bn_almost_mont_mul #t #nLen n mu aM bM =
| let c = BN.bn_mul aM bM in
bn_almost_mont_reduction n mu c | false |
EverCrypt.Chacha20Poly1305.fst | EverCrypt.Chacha20Poly1305.aead_encrypt | val aead_encrypt:
k:lbuffer uint8 32ul -> // key
n:lbuffer uint8 12ul -> // nonce
aadlen:size_t ->
aad:lbuffer uint8 aadlen ->
(mlen:size_t{v mlen + 16 <= max_size_t /\ v aadlen + v mlen / 64 <= max_size_t}) ->
m:lbuffer uint8 mlen -> // input: plaintext
cipher:lbuffer uint8 mlen -> // output: buffer for cipher + mac
tag:lbuffer uint8 16ul -> // output: buffer for cipher + mac
Stack unit
(requires (fun h ->
disjoint k cipher /\ disjoint n cipher /\
disjoint k tag /\ disjoint n tag /\
disjoint cipher tag /\
eq_or_disjoint m cipher /\
disjoint aad cipher /\
live h k /\ live h n /\ live h aad /\ live h m /\ live h cipher /\ live h tag))
(ensures (fun h0 _ h1 -> modifies (loc cipher |+| loc tag) h0 h1 /\
Seq.equal
(Seq.concat (as_seq h1 cipher) (as_seq h1 tag))
(Spec.aead_encrypt (as_seq h0 k) (as_seq h0 n) (as_seq h0 m) (as_seq h0 aad)))) | val aead_encrypt:
k:lbuffer uint8 32ul -> // key
n:lbuffer uint8 12ul -> // nonce
aadlen:size_t ->
aad:lbuffer uint8 aadlen ->
(mlen:size_t{v mlen + 16 <= max_size_t /\ v aadlen + v mlen / 64 <= max_size_t}) ->
m:lbuffer uint8 mlen -> // input: plaintext
cipher:lbuffer uint8 mlen -> // output: buffer for cipher + mac
tag:lbuffer uint8 16ul -> // output: buffer for cipher + mac
Stack unit
(requires (fun h ->
disjoint k cipher /\ disjoint n cipher /\
disjoint k tag /\ disjoint n tag /\
disjoint cipher tag /\
eq_or_disjoint m cipher /\
disjoint aad cipher /\
live h k /\ live h n /\ live h aad /\ live h m /\ live h cipher /\ live h tag))
(ensures (fun h0 _ h1 -> modifies (loc cipher |+| loc tag) h0 h1 /\
Seq.equal
(Seq.concat (as_seq h1 cipher) (as_seq h1 tag))
(Spec.aead_encrypt (as_seq h0 k) (as_seq h0 n) (as_seq h0 m) (as_seq h0 aad)))) | let aead_encrypt k n aadlen aad mlen m cipher tag =
let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256 then begin
LowStar.Ignore.ignore vec128;
Hacl.Chacha20Poly1305_256.encrypt cipher tag m mlen aad aadlen k n
end else if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128 then begin
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_128.encrypt cipher tag m mlen aad aadlen k n
end else begin
LowStar.Ignore.ignore vec128;
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_32.encrypt cipher tag m mlen aad aadlen k n
end | {
"file_name": "providers/evercrypt/fst/EverCrypt.Chacha20Poly1305.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 30,
"start_col": 0,
"start_line": 16
} | module EverCrypt.Chacha20Poly1305
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
module Seq = Lib.Sequence
open FStar.Mul
module Spec = Spec.Chacha20Poly1305
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 20" | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Chacha20Poly1305_32.fst.checked",
"Hacl.Chacha20Poly1305_256.fst.checked",
"Hacl.Chacha20Poly1305_128.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked",
"EverCrypt.TargetConfig.fsti.checked",
"EverCrypt.AutoConfig2.fsti.checked"
],
"interface_file": true,
"source_file": "EverCrypt.Chacha20Poly1305.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"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": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Spec.Chacha20Poly1305",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"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": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
aadlen: Lib.IntTypes.size_t ->
aad: Lib.Buffer.lbuffer Lib.IntTypes.uint8 aadlen ->
mlen:
Lib.IntTypes.size_t
{ Lib.IntTypes.v mlen + 16 <= Lib.IntTypes.max_size_t /\
Lib.IntTypes.v aadlen + Lib.IntTypes.v mlen / 64 <= Lib.IntTypes.max_size_t } ->
m: Lib.Buffer.lbuffer Lib.IntTypes.uint8 mlen ->
cipher: Lib.Buffer.lbuffer Lib.IntTypes.uint8 mlen ->
tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Prims.op_Division",
"Prims.op_AmpAmp",
"EverCrypt.TargetConfig.hacl_can_compile_vec256",
"Hacl.Chacha20Poly1305_256.encrypt",
"Prims.unit",
"LowStar.Ignore.ignore",
"Prims.bool",
"EverCrypt.TargetConfig.hacl_can_compile_vec128",
"Hacl.Chacha20Poly1305_128.encrypt",
"Hacl.Chacha20Poly1305_32.encrypt",
"EverCrypt.AutoConfig2.has_vec128",
"EverCrypt.AutoConfig2.has_vec256"
] | [] | false | true | false | false | false | let aead_encrypt k n aadlen aad mlen m cipher tag =
| let vec256 = EverCrypt.AutoConfig2.has_vec256 () in
let vec128 = EverCrypt.AutoConfig2.has_vec128 () in
if EverCrypt.TargetConfig.hacl_can_compile_vec256 && vec256
then
(LowStar.Ignore.ignore vec128;
Hacl.Chacha20Poly1305_256.encrypt cipher tag m mlen aad aadlen k n)
else
if EverCrypt.TargetConfig.hacl_can_compile_vec128 && vec128
then
(LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_128.encrypt cipher tag m mlen aad aadlen k n)
else
(LowStar.Ignore.ignore vec128;
LowStar.Ignore.ignore vec256;
Hacl.Chacha20Poly1305_32.encrypt cipher tag m mlen aad aadlen k n) | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.compute_term_type_and_u | val compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty) | val compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty) | let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 45,
"end_line": 347,
"start_col": 0,
"start_line": 326
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple5 Pulse.Syntax.Base.term
(fun _ -> FStar.Stubs.TypeChecker.Core.tot_or_ghost)
(fun _ _ -> Pulse.Syntax.Base.term)
(fun _ _ ty ->
Prims.dtuple2 Pulse.Syntax.Base.universe
(fun u148 -> Pulse.Typing.universe_of g ty u148))
(fun t eff ty _ -> Pulse.Typing.typing g t eff ty)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.dtuple4",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Reflection.Typing.typing",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Tactics.Types.issues",
"Pulse.Checker.Pure.maybe_fail_doc",
"FStar.Pervasives.dtuple5",
"Prims.dtuple2",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.universe_of",
"Pulse.Typing.typing",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Prims.list",
"FStar.Stubs.Pprint.document",
"Pulse.Checker.Pure.ill_typed_term",
"FStar.Pervasives.Native.None",
"Prims.eq2",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Readback.readback_ty",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Prims.string",
"Pulse.Checker.Pure.readback_failure",
"FStar.Pervasives.Mkdtuple5",
"Prims.Mkdtuple2",
"Pulse.Typing.E",
"Pulse.Typing.elab_env",
"Pulse.Checker.Pure.check_universe",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.log_issues",
"FStar.Pervasives.Native.tuple2",
"Pulse.Checker.Pure.tc_meta_callback",
"FStar.Stubs.Reflection.Types.env"
] | [] | false | true | false | false | false | let compute_term_type_and_u (g: env) (t: term)
: T.Tac
(t: term &
eff: T.tot_or_ghost &
ty: term &
(u: universe & universe_of g ty u) &
typing g t eff ty) =
| let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None -> maybe_fail_doc issues g t.range (ill_typed_term t None None)
| Some (| rt , eff , ty' , tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u , uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |) | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.check_vprop_with_core | val check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) | val check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) | let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 74,
"end_line": 466,
"start_col": 0,
"start_line": 461
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac (Pulse.Typing.tot_typing g t Pulse.Syntax.Base.tm_vprop) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Pure.core_check_term",
"Pulse.Typing.Env.push_context_no_range",
"FStar.Stubs.TypeChecker.Core.E_Total",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.typing",
"Pulse.Typing.tot_typing"
] | [] | false | true | false | false | false | let check_vprop_with_core (g: env) (t: term) : T.Tac (tot_typing g t tm_vprop) =
| core_check_term (push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop | false |
Spec.Loops.fst | Spec.Loops.repeat | val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n) | val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n) | let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x) | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 43,
"end_line": 35,
"start_col": 0,
"start_line": 34
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s'' | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat -> f: (f: a -> a) -> x: a -> Prims.Tot a | Prims.Tot | [
"total",
""
] | [] | [
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Spec.Loops.repeat",
"Prims.op_Subtraction"
] | [
"recursion"
] | false | false | false | true | false | let rec repeat #a n f x =
| if n = 0 then x else repeat (n - 1) f (f x) | false |
Hacl.Spec.Bignum.AlmostMontgomery.fst | Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_reduction | val bn_almost_mont_reduction:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> c:lbignum t (nLen + nLen) ->
lbignum t nLen | val bn_almost_mont_reduction:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> c:lbignum t (nLen + nLen) ->
lbignum t nLen | let bn_almost_mont_reduction #t #nLen n mu c =
let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res | {
"file_name": "code/bignum/Hacl.Spec.Bignum.AlmostMontgomery.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 25,
"start_col": 0,
"start_line": 21
} | module Hacl.Spec.Bignum.AlmostMontgomery
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BN = Hacl.Spec.Bignum
module BM = Hacl.Spec.Bignum.Montgomery
friend Hacl.Spec.Bignum.Montgomery
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
/// Low-level specification of Almost Montgomery Multiplication | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.AlmostMontgomery.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.AlmostMontgomery.Lemmas",
"short_module": "AM"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
mu: Hacl.Spec.Bignum.Definitions.limb t ->
c: Hacl.Spec.Bignum.Definitions.lbignum t (nLen + nLen)
-> Hacl.Spec.Bignum.Definitions.lbignum t nLen | Prims.Tot | [
"total"
] | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.Base.carry",
"Lib.Sequence.map2",
"Hacl.Spec.Bignum.Base.mask_select",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.bn_sub",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Lib.IntTypes.op_Subtraction_Dot",
"Lib.IntTypes.uint",
"Hacl.Spec.Bignum.Montgomery.bn_mont_reduction_loop_div_r"
] | [] | false | false | false | false | false | let bn_almost_mont_reduction #t #nLen n mu c =
| let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.try_get_non_informative_witness | val try_get_non_informative_witness (g:env) (u:universe) (t:term)
: T.Tac (option (non_informative_t g u t)) | val try_get_non_informative_witness (g:env) (u:universe) (t:term)
: T.Tac (option (non_informative_t g u t)) | let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 14,
"end_line": 520,
"start_col": 0,
"start_line": 477
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref" | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> u220: Pulse.Syntax.Base.universe -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.Native.option (Pulse.Typing.non_informative_t g u220 t)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.None",
"Pulse.Typing.non_informative_t",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.Some",
"Prims.dtuple2",
"Pulse.Typing.typing",
"Pulse.Typing.Env.push_context_no_range",
"FStar.Stubs.TypeChecker.Core.E_Total",
"Pulse.Typing.non_informative_witness_t",
"Pulse.Checker.Pure.check_term",
"FStar.Stubs.Reflection.Types.name",
"Prims.list",
"Pulse.Syntax.Base.qualifier",
"Prims.op_Equality",
"Prims.string",
"FStar.Reflection.Const.unit_lid",
"Pulse.Syntax.Pure.tm_fvar",
"Pulse.Syntax.Base.as_fv",
"Pulse.Reflection.Util.mk_pulse_lib_core_lid",
"Prims.bool",
"FStar.Reflection.Const.prop_qn",
"Prims.op_AmpAmp",
"FStar.Reflection.Const.squash_qn",
"FStar.Pervasives.Native.uu___is_Some",
"Pulse.Syntax.Pure.tm_pureapp",
"Pulse.Syntax.Pure.tm_uinst",
"FStar.Pervasives.Native.__proj__Some__item__v",
"Pulse.Reflection.Util.erased_lid",
"Pulse.Checker.Pure.gref_lid",
"Pulse.Checker.Pure.mk_pulse_lib_gref_lid",
"Pulse.Checker.Pure.higher_gref_lid",
"Pulse.Checker.Pure.mk_pulse_lib_higher_gref_lid",
"FStar.Pervasives.Native.tuple4",
"Pulse.Syntax.Pure.is_fvar_app"
] | [] | false | true | false | false | false | let try_get_non_informative_witness g u t : T.Tac (option (non_informative_t g u t)) =
| let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else
if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else
if l = R.squash_qn && Some? arg_opt
then
Some
(tm_pureapp (tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else
if l = erased_lid && Some? arg_opt
then
Some
(tm_pureapp (tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else
if l = gref_lid && Some? arg_opt
then
Some
(tm_pureapp (tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else
if l = higher_gref_lid && Some? arg_opt
then
Some
(tm_pureapp (tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative"))
us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term (push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok | false |
Spec.Loops.fst | Spec.Loops.lemma_repeat_0 | val lemma_repeat_0 : n: Prims.nat{n = 0} -> f: (_: _ -> _) -> x: _
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat n f x == x) | let lemma_repeat_0 = repeat_base | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 32,
"end_line": 81,
"start_col": 0,
"start_line": 81
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min))
let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min)
#reset-options "--max_fuel 0"
[@(deprecated "Spec.Loops.repeat")]
unfold
let repeat_spec = repeat
[@(deprecated "Spec.Loops.repeat_base")] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat{n = 0} -> f: (_: _ -> _) -> x: _
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat n f x == x) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Loops.repeat_base",
"Prims.nat",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Spec.Loops.repeat",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let lemma_repeat_0 =
| repeat_base | false |
|
Spec.Loops.fst | Spec.Loops.seq_map | val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s)) | val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s)) | let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s' | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 6,
"end_line": 17,
"start_col": 0,
"start_line": 12
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))}) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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: (_: a -> b) -> s: FStar.Seq.Base.seq a
-> Prims.Tot
(s':
FStar.Seq.Base.seq b
{ FStar.Seq.Base.length s = FStar.Seq.Base.length s' /\
(forall (i: Prims.nat). {:pattern FStar.Seq.Base.index s' i}
i < FStar.Seq.Base.length s' ==>
FStar.Seq.Base.index s' i == f (FStar.Seq.Base.index s i)) }) | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Seq.Base.seq",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Seq.Base.cons",
"FStar.Seq.Properties.head",
"Spec.Loops.seq_map",
"FStar.Seq.Properties.tail",
"Prims.l_and",
"Prims.b2t",
"Prims.nat",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.op_LessThan",
"Prims.eq2",
"FStar.Seq.Base.index"
] | [
"recursion"
] | false | false | false | false | false | let rec seq_map #a #b f s =
| if Seq.length s = 0
then Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s' | false |
Hacl.Spec.Bignum.AlmostMontgomery.fst | Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_sqr_lemma | val bn_almost_mont_sqr_lemma:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen -> Lemma
(requires BM.bn_mont_pre n mu)
(ensures
bn_v (bn_almost_mont_sqr n mu aM) ==
AM.almost_mont_mul (bits t) nLen (bn_v n) (v mu) (bn_v aM) (bn_v aM)) | val bn_almost_mont_sqr_lemma:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen -> Lemma
(requires BM.bn_mont_pre n mu)
(ensures
bn_v (bn_almost_mont_sqr n mu aM) ==
AM.almost_mont_mul (bits t) nLen (bn_v n) (v mu) (bn_v aM) (bn_v aM)) | let bn_almost_mont_sqr_lemma #t #nLen n mu aM =
bn_almost_mont_mul_lemma #t #nLen n mu aM aM | {
"file_name": "code/bignum/Hacl.Spec.Bignum.AlmostMontgomery.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 77,
"start_col": 0,
"start_line": 76
} | module Hacl.Spec.Bignum.AlmostMontgomery
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BN = Hacl.Spec.Bignum
module BM = Hacl.Spec.Bignum.Montgomery
friend Hacl.Spec.Bignum.Montgomery
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
/// Low-level specification of Almost Montgomery Multiplication
let bn_almost_mont_reduction #t #nLen n mu c =
let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res
let bn_almost_mont_mul #t #nLen n mu aM bM =
let c = BN.bn_mul aM bM in // c = aM * bM
bn_almost_mont_reduction n mu c // resM = c % n
let bn_almost_mont_sqr #t #nLen n mu aM =
let c = BN.bn_mul aM aM in // c = aM * aM
bn_almost_mont_reduction n mu c // resM = c % n
let bn_almost_mont_reduction_lemma #t #nLen n mu res0 =
let pbits = bits t in
let r = pow2 (pbits * nLen) in
let r2 = pow2 (pbits * (nLen + nLen)) in
Math.Lemmas.pow2_plus (pbits * nLen) (pbits * nLen);
assert (r2 == r * r);
let c0, res1 = BM.bn_mont_reduction_loop_div_r #t #nLen n mu res0 in
let resM1 = M.mont_reduction_loop_div_r (bits t) nLen (bn_v n) (v mu) (bn_v res0) in
BM.bn_mont_reduction_loop_div_r_lemma #t #nLen n mu res0;
assert (v c0 * r + bn_v res1 == resM1);
let resM = if resM1 < r then resM1 else resM1 - bn_v n in
//assert (resM == AM.almost_mont_reduction (bits t) nLen (bn_v n) (v mu) (bn_v res0));
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res1 n in
BN.bn_sub_lemma res1 n;
assert (bn_v tmp - v c1 * r == bn_v res1 - bn_v n);
let res = map2 (mask_select mask) tmp res1 in
lseq_mask_select_lemma tmp res1 mask;
assert (res == (if v mask = 0 then res1 else tmp));
bn_eval_bound res1 nLen;
M.mont_reduction_loop_div_r_fits_lemma (bits t) nLen (bn_v n) (v mu) (bn_v res0);
assert (v c0 * r + bn_v res1 <= (bn_v res0 - bn_v n) / r + bn_v n);
bn_eval_bound res0 (nLen + nLen);
AM.lemma_fits_c_lt_rr (bn_v res0) r (bn_v n);
assert (resM1 < r + bn_v n)
let bn_almost_mont_mul_lemma #t #nLen n mu aM bM =
let r = pow2 (bits t * nLen) in
let c = BN.bn_mul aM bM in
BN.bn_mul_lemma aM bM;
assert (bn_v c == bn_v aM * bn_v bM);
bn_almost_mont_reduction_lemma n mu c | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.AlmostMontgomery.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.AlmostMontgomery.Lemmas",
"short_module": "AM"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
mu: Hacl.Spec.Bignum.Definitions.limb t ->
aM: Hacl.Spec.Bignum.Definitions.lbignum t nLen
-> FStar.Pervasives.Lemma (requires Hacl.Spec.Bignum.Montgomery.bn_mont_pre n mu)
(ensures
Hacl.Spec.Bignum.Definitions.bn_v (Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_sqr n
mu
aM) ==
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul (Lib.IntTypes.bits t)
nLen
(Hacl.Spec.Bignum.Definitions.bn_v n)
(Lib.IntTypes.v mu)
(Hacl.Spec.Bignum.Definitions.bn_v aM)
(Hacl.Spec.Bignum.Definitions.bn_v aM)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_mul_lemma",
"Prims.unit"
] | [] | true | false | true | false | false | let bn_almost_mont_sqr_lemma #t #nLen n mu aM =
| bn_almost_mont_mul_lemma #t #nLen n mu aM aM | false |
Spec.Loops.fst | Spec.Loops.seq_map2 | val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s)) | val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s)) | let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s'' | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 7,
"end_line": 31,
"start_col": 0,
"start_line": 27
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))}) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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: (_: a -> _: b -> c) ->
s: FStar.Seq.Base.seq a ->
s': FStar.Seq.Base.seq b {FStar.Seq.Base.length s = FStar.Seq.Base.length s'}
-> Prims.Tot
(s'':
FStar.Seq.Base.seq c
{ FStar.Seq.Base.length s = FStar.Seq.Base.length s'' /\
(forall (i: Prims.nat). {:pattern FStar.Seq.Base.index s'' i}
i < FStar.Seq.Base.length s'' ==>
FStar.Seq.Base.index s'' i == f (FStar.Seq.Base.index s i) (FStar.Seq.Base.index s' i)
) }) | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Seq.Base.seq",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"FStar.Seq.Base.length",
"Prims.int",
"FStar.Seq.Base.empty",
"Prims.bool",
"FStar.Seq.Base.cons",
"FStar.Seq.Properties.head",
"Spec.Loops.seq_map2",
"FStar.Seq.Properties.tail",
"Prims.l_and",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.op_LessThan",
"Prims.eq2",
"FStar.Seq.Base.index"
] | [
"recursion"
] | false | false | false | false | false | let rec seq_map2 #a #b #c f s s' =
| if Seq.length s = 0
then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s'' | false |
Spec.Loops.fst | Spec.Loops.repeat_spec | val repeat_spec : n: Prims.nat -> f: (f: _ -> _) -> x: _ -> Prims.Tot _ | let repeat_spec = repeat | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 24,
"end_line": 78,
"start_col": 0,
"start_line": 78
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min))
let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min)
#reset-options "--max_fuel 0"
[@(deprecated "Spec.Loops.repeat")] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat -> f: (f: _ -> _) -> x: _ -> Prims.Tot _ | Prims.Tot | [
"total",
""
] | [] | [
"Spec.Loops.repeat",
"Prims.nat"
] | [] | false | false | false | true | false | let repeat_spec =
| repeat | false |
|
Spec.Loops.fst | Spec.Loops.repeat_induction | val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x)) | val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x)) | let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x) | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 37,
"end_line": 43,
"start_col": 0,
"start_line": 41
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat{n > 0} -> f: (_: a -> a) -> x: a
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat n f x == f (Spec.Loops.repeat (n - 1) f x)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Spec.Loops.repeat_induction",
"Prims.op_Subtraction",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec repeat_induction #a n f x =
| if n = 1 then () else repeat_induction (n - 1) f (f x) | false |
Spec.Loops.fst | Spec.Loops.lemma_repeat_range_0 | val lemma_repeat_range_0 : min: Prims.nat -> f: (_: _ -> i: Prims.nat{i < min} -> _) -> x: _
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat_range min min f x == x) | let lemma_repeat_range_0 = repeat_range_base | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 44,
"end_line": 91,
"start_col": 0,
"start_line": 91
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min))
let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min)
#reset-options "--max_fuel 0"
[@(deprecated "Spec.Loops.repeat")]
unfold
let repeat_spec = repeat
[@(deprecated "Spec.Loops.repeat_base")]
unfold
let lemma_repeat_0 = repeat_base
[@(deprecated "Spec.Loops.repeat_induction")]
unfold
let lemma_repeat = repeat_induction
[@(deprecated "Spec.Loops.repeat_range")]
unfold
let repeat_range_spec = repeat_range
[@(deprecated "Spec.Loops.repeat_range_base")] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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 | min: Prims.nat -> f: (_: _ -> i: Prims.nat{i < min} -> _) -> x: _
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat_range min min f x == x) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Loops.repeat_range_base",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Spec.Loops.repeat_range",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let lemma_repeat_range_0 =
| repeat_range_base | false |
|
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.compute_term_type | val compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty) | val compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty) | let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 50,
"end_line": 323,
"start_col": 0,
"start_line": 302
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple4 Pulse.Syntax.Base.term
(fun _ -> FStar.Stubs.TypeChecker.Core.tot_or_ghost)
(fun _ _ -> Pulse.Syntax.Base.term)
(fun t eff ty -> Pulse.Typing.typing g t eff ty)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.dtuple4",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Reflection.Typing.typing",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Tactics.Types.issues",
"Pulse.Checker.Pure.maybe_fail_doc",
"Pulse.Typing.typing",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Prims.list",
"FStar.Stubs.Pprint.document",
"Pulse.Checker.Pure.ill_typed_term",
"FStar.Pervasives.Native.None",
"Prims.eq2",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Readback.readback_ty",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Prims.string",
"Pulse.Checker.Pure.readback_failure",
"FStar.Pervasives.Mkdtuple4",
"Pulse.Typing.E",
"Pulse.Typing.elab_env",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.log_issues",
"FStar.Pervasives.Native.tuple2",
"Pulse.Checker.Pure.tc_meta_callback",
"Pulse.Checker.Pure.debug",
"FStar.Printf.sprintf",
"Pulse.Syntax.Printer.term_to_string",
"FStar.Stubs.Tactics.V2.Builtins.term_to_string",
"FStar.Stubs.Reflection.Types.env"
] | [] | false | true | false | false | false | let compute_term_type (g: env) (t: term)
: T.Tac (t: term & eff: T.tot_or_ghost & ty: term & typing g t eff ty) =
| let fg = elab_env g in
let rt = elab_term t in
debug g
(fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None -> maybe_fail_doc issues g t.range (ill_typed_term t None None)
| Some (| rt , eff , ty' , tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |) | false |
Spec.Loops.fst | Spec.Loops.lemma_repeat_range_spec | val lemma_repeat_range_spec : min: Prims.nat -> max: Prims.nat{min < max} -> f: (_: _ -> i: Prims.nat{i < max} -> _) -> x: _
-> FStar.Pervasives.Lemma
(ensures
f (Spec.Loops.repeat_range min (max - 1) f x) (max - 1) ==
Spec.Loops.repeat_range min max f x) (decreases max - min) | let lemma_repeat_range_spec = repeat_range_induction | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 52,
"end_line": 94,
"start_col": 0,
"start_line": 94
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min))
let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min)
#reset-options "--max_fuel 0"
[@(deprecated "Spec.Loops.repeat")]
unfold
let repeat_spec = repeat
[@(deprecated "Spec.Loops.repeat_base")]
unfold
let lemma_repeat_0 = repeat_base
[@(deprecated "Spec.Loops.repeat_induction")]
unfold
let lemma_repeat = repeat_induction
[@(deprecated "Spec.Loops.repeat_range")]
unfold
let repeat_range_spec = repeat_range
[@(deprecated "Spec.Loops.repeat_range_base")]
unfold
let lemma_repeat_range_0 = repeat_range_base
[@(deprecated "Spec.Loops.repeat_range_induction")] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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 | min: Prims.nat -> max: Prims.nat{min < max} -> f: (_: _ -> i: Prims.nat{i < max} -> _) -> x: _
-> FStar.Pervasives.Lemma
(ensures
f (Spec.Loops.repeat_range min (max - 1) f x) (max - 1) ==
Spec.Loops.repeat_range min max f x) (decreases max - min) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"Spec.Loops.repeat_range_induction",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.unit",
"Prims.op_Subtraction",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Spec.Loops.repeat_range",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let lemma_repeat_range_spec =
| repeat_range_induction | false |
|
Spec.Loops.fst | Spec.Loops.repeat_range_spec | val repeat_range_spec : min: Prims.nat -> max: Prims.nat{min <= max} -> f: (_: _ -> i: Prims.nat{i < max} -> _) -> x: _
-> Prims.Tot _ | let repeat_range_spec = repeat_range | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 36,
"end_line": 88,
"start_col": 0,
"start_line": 88
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min))
let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min)
#reset-options "--max_fuel 0"
[@(deprecated "Spec.Loops.repeat")]
unfold
let repeat_spec = repeat
[@(deprecated "Spec.Loops.repeat_base")]
unfold
let lemma_repeat_0 = repeat_base
[@(deprecated "Spec.Loops.repeat_induction")]
unfold
let lemma_repeat = repeat_induction
[@(deprecated "Spec.Loops.repeat_range")] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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 | min: Prims.nat -> max: Prims.nat{min <= max} -> f: (_: _ -> i: Prims.nat{i < max} -> _) -> x: _
-> Prims.Tot _ | Prims.Tot | [
"total",
""
] | [] | [
"Spec.Loops.repeat_range",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Subtraction"
] | [] | false | false | false | false | false | let repeat_range_spec =
| repeat_range | false |
|
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.core_compute_tot_term_type | val core_compute_tot_term_type (g:env) (t:term)
: T.Tac (ty:typ &
tot_typing g t ty) | val core_compute_tot_term_type (g:env) (t:term)
: T.Tac (ty:typ &
tot_typing g t ty) | let core_compute_tot_term_type g t =
let (| eff, ty, d |) = core_compute_term_type g t in
if eff = T.E_Total then (| ty, d |)
else fail_expected_tot_found_ghost g t | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 40,
"end_line": 570,
"start_col": 0,
"start_line": 567
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t)
let check_universe (g:env) (t:term)
: T.Tac (u:universe & universe_of g t u)
= let f = elab_env g in
let rt = elab_term t in
let ru_opt, issues = catch_all (fun _ -> rtb_universe_of g f rt) in
T.log_issues issues;
match ru_opt with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t (Some (tm_type u_unknown)) None)
| Some ru ->
let proof : squash (T.typing_token f rt (E_Total, R.pack_ln (R.Tv_Type ru))) =
FStar.Squash.get_proof _
in
let proof : RT.typing f rt (E_Total, R.pack_ln (R.Tv_Type ru)) = RT.T_Token _ _ _ proof in
(| ru, E proof |)
let tc_meta_callback g (f:R.env) (e:R.term)
: T.Tac (option (e:R.term & eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let res =
match catch_all (fun _ -> rtb_tc_term g f e) with
| None, issues ->
None, issues
| Some (e, (eff, t)), issues ->
Some (| e, eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |),
issues
in
res
let compute_term_type (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
debug g (fun _ ->
Printf.sprintf "check_tot : called on %s elaborated to %s"
(P.term_to_string t)
(T.term_to_string rt));
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty -> (| t, eff, ty, E tok |)
let compute_term_type_and_u (g:env) (t:term)
: T.Tac (t:term &
eff:T.tot_or_ghost &
ty:term &
(u:universe & universe_of g ty u) &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_meta_callback g fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| rt, eff, ty', tok |) ->
match readback_ty rt, readback_ty ty' with
| None, _ -> fail g (Some t.range) (readback_failure rt)
| _, None -> fail g (Some t.range) (readback_failure ty')
| Some t, Some ty ->
let (| u, uty |) = check_universe g ty in
(| t, eff, ty, (| u, uty |), E tok |)
let check_term (g:env) (e:term) (eff:T.tot_or_ghost) (t:term)
: T.Tac (e:term & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "check_term_with_expected_type_and_effect" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> (| e, E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok)) |)
let check_term_at_type (g:env) (e:term) (t:term)
: T.Tac (e:term & eff:T.tot_or_ghost & typing g e eff t) =
let e, _ = instantiate_term_implicits g e in
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "check_term_with_expected_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| e, eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let tc_with_core g (f:R.env) (e:R.term)
: T.Tac (option (eff:T.tot_or_ghost & t:R.term & RT.typing f e (eff, t)) & issues)
= let ropt, issues = catch_all (fun _ -> rtb_core_compute_term_type (push_context g "tc_with_core" (range_of_term e)) f e) in
match ropt with
| None -> None, issues
| Some (eff, t) ->
Some (| eff, t, RT.T_Token _ _ _ (FStar.Squash.get_proof _) |), issues
let core_compute_term_type (g:env) (t:term)
: T.Tac (eff:T.tot_or_ghost &
ty:term &
typing g t eff ty)
= let fg = elab_env g in
let rt = elab_term t in
let res, issues = tc_with_core (push_context g "core_check_term" (range_of_term rt)) fg rt in
T.log_issues issues;
match res with
| None ->
maybe_fail_doc
issues
g t.range (ill_typed_term t None None)
| Some (| eff, ty', tok |) ->
match readback_ty ty' with
| None ->
fail g (Some t.range) (readback_failure ty')
| Some ty ->
(| eff, ty, E tok |)
let core_check_term g e eff t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let topt, issues =
catch_all (fun _ ->
rtb_core_check_term
(push_context g "core_check_term" (range_of_term rt))
fg re eff rt) in
T.log_issues issues;
match topt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some tok -> E (RT.T_Token _ _ _ (FStar.Squash.return_squash tok))
let core_check_term_at_type g e t =
let fg = elab_env g in
let re = elab_term e in
let rt = elab_term t in
let effopt, issues =
catch_all (fun _ ->
rtb_core_check_term_at_type
(push_context g "core_check_term_at_type" (range_of_term rt))
fg re rt) in
T.log_issues issues;
match effopt with
| None ->
maybe_fail_doc
issues
g e.range (ill_typed_term e (Some t) None)
| Some eff ->
(| eff, E (RT.T_Token _ _ _ (FStar.Squash.get_proof _)) |)
let check_vprop (g:env)
(t:term)
: T.Tac (t:term & tot_typing g t tm_vprop) =
check_term (push_context_no_range g "check_vprop") t T.E_Total tm_vprop
let check_vprop_with_core (g:env)
(t:term)
: T.Tac (tot_typing g t tm_vprop) =
core_check_term
(push_context_no_range g "check_vprop_with_core") t T.E_Total tm_vprop
let pulse_lib_gref = ["Pulse"; "Lib"; "GhostReference"]
let mk_pulse_lib_gref_lid s = pulse_lib_gref@[s]
let gref_lid = mk_pulse_lib_gref_lid "ref"
let pulse_lib_higher_gref = ["Pulse"; "Lib"; "HigherGhostReference"]
let mk_pulse_lib_higher_gref_lid s = pulse_lib_higher_gref@[s]
let higher_gref_lid = mk_pulse_lib_higher_gref_lid "ref"
let try_get_non_informative_witness g u t
: T.Tac (option (non_informative_t g u t))
= let eopt =
let ropt = is_fvar_app t in
match ropt with
| Some (l, us, _, arg_opt) ->
if l = R.unit_lid
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "unit_non_informative")))
else if l = R.prop_qn
then Some (tm_fvar (as_fv (mk_pulse_lib_core_lid "prop_non_informative")))
else if l = R.squash_qn && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "squash_non_informative")) us)
None
(Some?.v arg_opt))
else if l = erased_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_core_lid "erased_non_informative")) us)
None
(Some?.v arg_opt))
else if l = gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else if l = higher_gref_lid && Some? arg_opt
then Some (tm_pureapp
(tm_uinst (as_fv (mk_pulse_lib_higher_gref_lid "gref_non_informative")) us)
None
(Some?.v arg_opt))
else None
| _ -> None
in
match eopt with
| None -> None
| Some e ->
let tok =
check_term
(push_context_no_range g "get_noninformative_witness")
e
T.E_Total
(non_informative_witness_t u t)
in
Some tok
let get_non_informative_witness g u t
: T.Tac (non_informative_t g u t)
= match try_get_non_informative_witness g u t with
| None ->
let open Pulse.PP in
fail_doc g (Some t.range) [
text "Expected a term with a non-informative (e.g., erased) type; got"
^/^ pp t
]
| Some e -> e
let try_check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (option (Pulse.Typing.prop_validity g p))
= let t_opt, issues = rtb_check_prop_validity g true (elab_env g) (elab_term p) in
t_opt
let check_prop_validity (g:env) (p:term) (_:tot_typing g p tm_prop)
: T.Tac (Pulse.Typing.prop_validity g p)
= let t_opt, issues = rtb_check_prop_validity g false (elab_env g) (elab_term p) in
T.log_issues issues;
match t_opt with
| None ->
let open Pulse.PP in
maybe_fail_doc issues g p.range
[text "Failed to prove property:" ^/^ pp p]
| Some tok -> tok
let fail_expected_tot_found_ghost (g:env) (t:term) =
fail g (Some t.range)
(Printf.sprintf "Expected a total term, found ghost term %s" (P.term_to_string t))
let compute_tot_term_type g t =
let (| t, eff, ty, t_typing |) = compute_term_type g t in
if eff = T.E_Total then (| t, ty, t_typing |)
else fail_expected_tot_found_ghost g t
let compute_tot_term_type_and_u g t =
let (| t, eff, ty, (| u, ty_typing |), t_typing |) = compute_term_type_and_u g t in
if eff = T.E_Total then (| t, u, ty, ty_typing, t_typing |)
else fail_expected_tot_found_ghost g t
let check_tot_term g e t =
check_term g e T.E_Total t | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(Prims.dtuple2 Pulse.Syntax.Base.typ (fun ty -> Pulse.Typing.tot_typing g t ty)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"Pulse.Typing.typing",
"Prims.op_Equality",
"FStar.Stubs.TypeChecker.Core.E_Total",
"Prims.Mkdtuple2",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.tot_typing",
"Prims.dtuple2",
"Prims.bool",
"Pulse.Checker.Pure.fail_expected_tot_found_ghost",
"FStar.Pervasives.dtuple3",
"Pulse.Checker.Pure.core_compute_term_type"
] | [] | false | true | false | false | false | let core_compute_tot_term_type g t =
| let (| eff , ty , d |) = core_compute_term_type g t in
if eff = T.E_Total then (| ty, d |) else fail_expected_tot_found_ghost g t | false |
Spec.Loops.fst | Spec.Loops.lemma_repeat | val lemma_repeat : n: Prims.nat{n > 0} -> f: (_: _ -> _) -> x: _
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat n f x == f (Spec.Loops.repeat (n - 1) f x)) | let lemma_repeat = repeat_induction | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 35,
"end_line": 84,
"start_col": 0,
"start_line": 84
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min))
let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min)
#reset-options "--max_fuel 0"
[@(deprecated "Spec.Loops.repeat")]
unfold
let repeat_spec = repeat
[@(deprecated "Spec.Loops.repeat_base")]
unfold
let lemma_repeat_0 = repeat_base
[@(deprecated "Spec.Loops.repeat_induction")] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat{n > 0} -> f: (_: _ -> _) -> x: _
-> FStar.Pervasives.Lemma (ensures Spec.Loops.repeat n f x == f (Spec.Loops.repeat (n - 1) f x)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Loops.repeat_induction",
"Prims.nat",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Spec.Loops.repeat",
"Prims.op_Subtraction",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let lemma_repeat =
| repeat_induction | false |
|
Spec.Loops.fst | Spec.Loops.repeat_range | val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min)) | val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min)) | let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min) | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 43,
"end_line": 55,
"start_col": 0,
"start_line": 53
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) -> | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"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 | min: Prims.nat -> max: Prims.nat{min <= max} -> f: (_: a -> i: Prims.nat{i < max} -> a) -> x: a
-> Prims.Tot a | Prims.Tot | [
"total",
""
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Equality",
"Prims.bool",
"Spec.Loops.repeat_range",
"Prims.op_Addition"
] | [
"recursion"
] | false | false | false | false | false | let rec repeat_range #a min max f x =
| if min = max then x else repeat_range (min + 1) max f (f x min) | false |
Hacl.Spec.Bignum.AlmostMontgomery.fst | Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_mul_lemma | val bn_almost_mont_mul_lemma:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen
-> bM:lbignum t nLen -> Lemma
(requires BM.bn_mont_pre n mu)
(ensures
bn_v (bn_almost_mont_mul n mu aM bM) ==
AM.almost_mont_mul (bits t) nLen (bn_v n) (v mu) (bn_v aM) (bn_v bM)) | val bn_almost_mont_mul_lemma:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> aM:lbignum t nLen
-> bM:lbignum t nLen -> Lemma
(requires BM.bn_mont_pre n mu)
(ensures
bn_v (bn_almost_mont_mul n mu aM bM) ==
AM.almost_mont_mul (bits t) nLen (bn_v n) (v mu) (bn_v aM) (bn_v bM)) | let bn_almost_mont_mul_lemma #t #nLen n mu aM bM =
let r = pow2 (bits t * nLen) in
let c = BN.bn_mul aM bM in
BN.bn_mul_lemma aM bM;
assert (bn_v c == bn_v aM * bn_v bM);
bn_almost_mont_reduction_lemma n mu c | {
"file_name": "code/bignum/Hacl.Spec.Bignum.AlmostMontgomery.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 73,
"start_col": 0,
"start_line": 68
} | module Hacl.Spec.Bignum.AlmostMontgomery
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BN = Hacl.Spec.Bignum
module BM = Hacl.Spec.Bignum.Montgomery
friend Hacl.Spec.Bignum.Montgomery
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
/// Low-level specification of Almost Montgomery Multiplication
let bn_almost_mont_reduction #t #nLen n mu c =
let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res
let bn_almost_mont_mul #t #nLen n mu aM bM =
let c = BN.bn_mul aM bM in // c = aM * bM
bn_almost_mont_reduction n mu c // resM = c % n
let bn_almost_mont_sqr #t #nLen n mu aM =
let c = BN.bn_mul aM aM in // c = aM * aM
bn_almost_mont_reduction n mu c // resM = c % n
let bn_almost_mont_reduction_lemma #t #nLen n mu res0 =
let pbits = bits t in
let r = pow2 (pbits * nLen) in
let r2 = pow2 (pbits * (nLen + nLen)) in
Math.Lemmas.pow2_plus (pbits * nLen) (pbits * nLen);
assert (r2 == r * r);
let c0, res1 = BM.bn_mont_reduction_loop_div_r #t #nLen n mu res0 in
let resM1 = M.mont_reduction_loop_div_r (bits t) nLen (bn_v n) (v mu) (bn_v res0) in
BM.bn_mont_reduction_loop_div_r_lemma #t #nLen n mu res0;
assert (v c0 * r + bn_v res1 == resM1);
let resM = if resM1 < r then resM1 else resM1 - bn_v n in
//assert (resM == AM.almost_mont_reduction (bits t) nLen (bn_v n) (v mu) (bn_v res0));
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res1 n in
BN.bn_sub_lemma res1 n;
assert (bn_v tmp - v c1 * r == bn_v res1 - bn_v n);
let res = map2 (mask_select mask) tmp res1 in
lseq_mask_select_lemma tmp res1 mask;
assert (res == (if v mask = 0 then res1 else tmp));
bn_eval_bound res1 nLen;
M.mont_reduction_loop_div_r_fits_lemma (bits t) nLen (bn_v n) (v mu) (bn_v res0);
assert (v c0 * r + bn_v res1 <= (bn_v res0 - bn_v n) / r + bn_v n);
bn_eval_bound res0 (nLen + nLen);
AM.lemma_fits_c_lt_rr (bn_v res0) r (bn_v n);
assert (resM1 < r + bn_v n) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.AlmostMontgomery.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.AlmostMontgomery.Lemmas",
"short_module": "AM"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
mu: Hacl.Spec.Bignum.Definitions.limb t ->
aM: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
bM: Hacl.Spec.Bignum.Definitions.lbignum t nLen
-> FStar.Pervasives.Lemma (requires Hacl.Spec.Bignum.Montgomery.bn_mont_pre n mu)
(ensures
Hacl.Spec.Bignum.Definitions.bn_v (Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_mul n
mu
aM
bM) ==
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul (Lib.IntTypes.bits t)
nLen
(Hacl.Spec.Bignum.Definitions.bn_v n)
(Lib.IntTypes.v mu)
(Hacl.Spec.Bignum.Definitions.bn_v aM)
(Hacl.Spec.Bignum.Definitions.bn_v bM)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_reduction_lemma",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Hacl.Spec.Bignum.Definitions.bn_v",
"FStar.Mul.op_Star",
"Hacl.Spec.Bignum.bn_mul_lemma",
"Hacl.Spec.Bignum.bn_mul",
"Prims.pos",
"Prims.pow2",
"Lib.IntTypes.bits"
] | [] | true | false | true | false | false | let bn_almost_mont_mul_lemma #t #nLen n mu aM bM =
| let r = pow2 (bits t * nLen) in
let c = BN.bn_mul aM bM in
BN.bn_mul_lemma aM bM;
assert (bn_v c == bn_v aM * bn_v bM);
bn_almost_mont_reduction_lemma n mu c | false |
Vale.SHA.PPC64LE.Rounds.Core.fst | Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_0_59_d | val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | val va_lemma_Loop_rounds_0_59_d : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_d i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (i == 12) (i == 28)) (i == 44) /\ va_get_reg 6 va_s0 + 16 < pow2_64 /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
(i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | let va_lemma_Loop_rounds_0_59_d va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_d va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_d i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 464 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 500 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 501 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 510 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 511 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1446,
"start_col": 0,
"start_line": 1404
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_3_7_11_body i msg =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_CNil ()))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_3_7_11_body i msg =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_3_7_11_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (in_b:buffer128)
(offset:nat) : (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(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 79 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg (va_op_reg_opr_reg 4) Secret
in_b offset) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 4) 16) (va_QEmpty (())))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_3_7_11_body va_b0 va_s0 i msg in_b offset =
let (va_mods:va_mods_t) = [va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg] in
let va_qc = va_qcode_Loop_rounds_3_7_11_body va_mods i msg in_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_3_7_11_body i msg) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 55 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 76 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 77 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 16))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_3_7_11_body (va_code_Loop_rounds_3_7_11_body i msg)
va_s0 i msg in_b offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok va_sM (va_update_operand_vec_opr
msg va_sM va_s0))));
va_lemma_norm_mods ([va_Mod_reg 4; va_mod_vec_opr msg]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_1_15_shift_body
val va_code_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 1) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1
msg1 4) (va_CNil ())) else va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block
(va_CCons (va_code_Vsldoi msg0 msg1 msg1 8) (va_CNil ())) else va_Block (va_CCons (if (i
`op_Modulus` 4 = 3) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1 msg1 12) (va_CNil ()))
else va_Block (va_CNil ())) (va_CNil ()))) (va_CNil ()))) (va_CNil ())))
val va_codegen_success_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_pbool_and (if (i `op_Modulus` 4 = 1) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1
msg1 4) (va_ttrue ()) else va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Vsldoi msg0 msg1 msg1 8) (va_ttrue ()) else va_pbool_and (if (i
`op_Modulus` 4 = 3) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1 msg1 12) (va_ttrue
()) else va_ttrue ()) (va_ttrue ())) (va_ttrue ())) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_1_15_shift_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(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 100 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 1) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 102 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 4) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 104 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 106 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 8) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 108 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 3) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 110 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 12) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) (fun (va_s:va_state) va_g ->
va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_rounds_1_15_shift_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_1_15_shift_body va_b0 va_s0 i msg0 msg1 block =
let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_1_15_shift_body va_mods i msg0 msg1 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 83 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 98 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (forall (va_x_msg0:va_value_vec_opr) . let
va_sM = va_upd_operand_vec_opr msg0 va_x_msg0 va_s0 in va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_1_15_shift_body (va_code_Loop_rounds_1_15_shift_body i
msg0 msg1) va_s0 i msg0 msg1 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)));
va_lemma_norm_mods ([va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr)
(msg1:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(va_QProc (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) ([va_mod_vec_opr msg0])
(va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block) (va_wpProof_Loop_rounds_1_15_shift_body i
msg0 msg1 block))
//--
//-- Loop_rounds_16_63_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_Block (va_CCons (va_code_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1) (va_CCons
(va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_CCons (va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vadduwm msg0 msg0 msg2) (va_CNil ())))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)
(va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_codegen_success_Vadduwm msg0
msg0 (va_op_vec_opr_vec 25))) (va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_codegen_success_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3))
(va_pbool_and (va_pbool_and (va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 msg2) (va_codegen_success_Vadduwm msg0 msg0 msg2))
(va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_63_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(msg2:vec_opr) (msg3:vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(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 145 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 146 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_0_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 147 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 148 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 149 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_1_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 150 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 151 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 msg2) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_ws_opaque block i) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_63_body va_b0 va_s0 i msg0 msg1 msg2 msg3 block =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_16_63_body va_mods i msg0 msg1 msg2 msg3 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2
msg3) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 114 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 140 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i -
16)) sigma0) sigma1) (ws_opaque block (i - 7))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 143 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_63_body (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) va_s0 i msg0 msg1 msg2 msg3 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_63_body
val va_code_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr ->
b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_Block (va_CCons (va_code_Vadduwm h_vec h_vec msg) (va_CCons (va_code_Vsel (va_op_vec_opr_vec
25) g_vec f_vec e_vec) (va_CCons (if op_disEquality i 63 then va_Block (va_CCons
(va_code_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_CNil ())) else va_Block (va_CNil ()))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_Sigma1
(va_op_vec_opr_vec 26) e_vec) (va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_CCons (va_code_Vsel
(va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_Vadduwm d_vec
d_vec h_vec) (va_CCons (va_code_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_CCons
(va_code_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_CCons (if (i = 63) then
va_Block (va_CNil ()) else va_Block (va_CNil ())) (va_CNil ())))))))))))))))
val va_codegen_success_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr ->
a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr ->
d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr ->
g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec msg) (va_pbool_and (va_codegen_success_Vsel
(va_op_vec_opr_vec 25) g_vec f_vec e_vec) (va_pbool_and (if op_disEquality i 63 then
va_pbool_and (va_codegen_success_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_ttrue ()) else
va_ttrue ()) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec) (va_pbool_and
(va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_pbool_and
(va_codegen_success_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_Vadduwm d_vec d_vec h_vec) (va_pbool_and
(va_codegen_success_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_pbool_and
(va_codegen_success_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec
25)) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_pbool_and (if (i = 63) then va_ttrue () else va_ttrue ()) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_63_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (a_vec:vec_opr)
(b_vec:vec_opr) (c_vec:vec_opr) (d_vec:vec_opr) (e_vec:vec_opr) (f_vec:vec_opr) (g_vec:vec_opr)
(h_vec:vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode unit
(va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(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 227 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec msg) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 228 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) g_vec f_vec e_vec) (fun (va_s:va_state) _ -> let
(va_arg53:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s e_vec) in let (va_arg52:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s g_vec) in let
(va_arg51:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s f_vec) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_vsel32 va_arg51 va_arg52 va_arg53)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 230 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (op_disEquality i 63) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 232 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 234 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg50:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg49:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg48:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 236 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_1_partial va_arg48 va_arg49
va_arg50) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 238 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 239 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (fun (va_s:va_state)
_ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 240 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg47:Vale.Def.Words_s.nat32)
= Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s c_vec) in let
(va_arg46:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s b_vec) in let (va_arg45:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s a_vec) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 241 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_eq_maj_xvsel32 va_arg45 va_arg46 va_arg47)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 242 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm d_vec d_vec h_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 243 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg44:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg43:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg42:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 244 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_0_partial va_arg42 va_arg43
va_arg44) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 245 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 246 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (fun (va_s:va_state) _ -> let
(va_arg41:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg40:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg39:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 247 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_shuffle_core_properties va_arg39 va_arg40
va_arg41) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i = 63) (qblock va_mods (fun (va_s:va_state) -> let
(va_arg38:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s g_vec in let
(va_arg37:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s f_vec in let
(va_arg36:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s e_vec in let
(va_arg35:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s d_vec in let
(va_arg34:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s c_vec in let
(va_arg33:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s b_vec in let
(va_arg32:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s a_vec in let
(va_arg31:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s h_vec in let
(va_arg30:Vale.SHA.PPC64LE.SHA_helpers.hash256) =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 250 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_make_seperated_hash va_arg30 va_arg31
va_arg32 va_arg33 va_arg34 va_arg35 va_arg36 va_arg37 va_arg38) (va_QEmpty (())))) (qblock
va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Loop_rounds_0_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr ->
c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr ->
f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> k_b:buffer128
-> block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec
e_vec f_vec g_vec h_vec) va_s0 /\ va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0
/\ va_is_src_vec_opr b_vec va_s0 /\ va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec
va_s0 /\ va_is_src_vec_opr e_vec va_s0 /\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr
g_vec va_s0 /\ va_is_dst_vec_opr h_vec va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\
msg == i `op_Modulus` 16 /\ (i `op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec ==
18 /\ d_vec == 19 /\ e_vec == 20 /\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i
`op_Modulus` 8 == 1 ==> a_vec == 23 /\ b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19
/\ f_vec == 20 /\ g_vec == 21 /\ h_vec == 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\
b_vec == 23 /\ c_vec == 16 /\ d_vec == 17 /\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec
== 21) /\ (i `op_Modulus` 8 == 3 ==> a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16
/\ e_vec == 17 /\ f_vec == 18 /\ g_vec == 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==>
a_vec == 20 /\ b_vec == 21 /\ c_vec == 22 /\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec
== 18 /\ h_vec == 19) /\ (i `op_Modulus` 8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21
/\ d_vec == 22 /\ e_vec == 23 /\ f_vec == 16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus`
8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\ c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec ==
23 /\ g_vec == 16 /\ h_vec == 17) /\ (i `op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\
c_vec == 19 /\ d_vec == 20 /\ e_vec == 21 /\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let
ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in let h_k =
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_63_body va_b0 va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec
h_vec k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec] in
let va_qc = va_qcode_Loop_rounds_0_63_body va_mods i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_63_body i msg a_vec b_vec
c_vec d_vec e_vec f_vec g_vec h_vec) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 205 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in label va_range1
"***** POSTCONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let h_k = Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in label va_range1
"***** POSTCONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in label va_range1
"***** POSTCONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let maj = Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 212 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0_maj = Vale.Arch.Types.add_wrap32 sigma0 maj in label va_range1
"***** POSTCONDITION NOT MET AT line 213 column 137 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM d_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 214 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 215 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 225 column 145 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i == 63 ==> Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM
h_vec) (va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM
c_vec) (va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM
f_vec) (va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0 /\ va_is_src_vec_opr b_vec va_s0 /\
va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec va_s0 /\ va_is_src_vec_opr e_vec va_s0
/\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr g_vec va_s0 /\ va_is_dst_vec_opr h_vec
va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\ msg == i `op_Modulus` 16 /\ (i
`op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec == 18 /\ d_vec == 19 /\ e_vec == 20
/\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i `op_Modulus` 8 == 1 ==> a_vec == 23 /\
b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19 /\ f_vec == 20 /\ g_vec == 21 /\ h_vec
== 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\ b_vec == 23 /\ c_vec == 16 /\ d_vec == 17
/\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec == 21) /\ (i `op_Modulus` 8 == 3 ==>
a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16 /\ e_vec == 17 /\ f_vec == 18 /\ g_vec
== 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==> a_vec == 20 /\ b_vec == 21 /\ c_vec == 22
/\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec == 18 /\ h_vec == 19) /\ (i `op_Modulus`
8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21 /\ d_vec == 22 /\ e_vec == 23 /\ f_vec ==
16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus` 8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\
c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec == 23 /\ g_vec == 16 /\ h_vec == 17) /\ (i
`op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\ c_vec == 19 /\ d_vec == 20 /\ e_vec == 21
/\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))))) /\ (forall (va_x_d_vec:va_value_vec_opr)
(va_x_g_vec:va_value_vec_opr) (va_x_h_vec:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32)
. let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr h_vec
va_x_h_vec (va_upd_operand_vec_opr g_vec va_x_g_vec (va_upd_operand_vec_opr d_vec va_x_d_vec
va_s0)))) in va_get_ok va_sM /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i
block hash_orig in let h_k = Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr
-> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec
f_vec g_vec h_vec k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr
h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_63_body (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec;
va_mod_vec_opr d_vec]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode
unit (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(va_QProc (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)
([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr
d_vec]) (va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig) (va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig))
//--
//-- Loop_round_0_61_body
val va_code_Loop_round_0_61_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_round_0_61_body i =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block (va_CCons
(va_code_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_CNil ()))) else va_Block (va_CCons (va_code_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_CNil ()))) (va_CNil
())))
val va_codegen_success_Loop_round_0_61_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_round_0_61_body i =
(va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_ttrue ())) else va_pbool_and (va_codegen_success_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_ttrue ()))
(va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_round_0_61_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(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 276 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 278 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret k_b ((i + 2) `op_Division` 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 16) (va_QEmpty (()))))) (qblock
va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 283 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4)
(va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_round_0_61_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_round_0_61_body i) va_s0 /\ va_get_ok va_s0 /\
(l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2)
`op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) /\
va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM va_s0)))))
[@"opaque_to_smt"]
let va_lemma_Loop_round_0_61_body va_b0 va_s0 i k_b =
let (va_mods:va_mods_t) = [va_Mod_vec 24; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_round_0_61_body va_mods i k_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_round_0_61_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 254 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 270 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 271 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 272 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 273 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 274 column 97 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ 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_vec 24; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_round_0_61_body (i:nat) (k_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b
((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==>
(va_get_vec 24 va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24
va_s0).hi2 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks))) /\ (forall (va_x_r6:nat64) (va_x_v24:quad32) .
let va_sM = va_upd_vec 24 va_x_v24 (va_upd_reg 6 va_x_r6 va_s0) in va_get_ok va_sM /\ (let ks =
Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_sM) in
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) ==>
va_k va_sM (())))
val va_wpProof_Loop_round_0_61_body : i:nat -> k_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_Loop_round_0_61_body i k_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_round_0_61_body i) ([va_Mod_vec
24; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_round_0_61_body i k_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_round_0_61_body (va_code_Loop_round_0_61_body i) va_s0 i k_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM
va_s0))));
va_lemma_norm_mods ([va_Mod_vec 24; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_round_0_61_body (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(va_QProc (va_code_Loop_round_0_61_body i) ([va_Mod_vec 24; va_Mod_reg 6])
(va_wp_Loop_round_0_61_body i k_b) (va_wpProof_Loop_round_0_61_body i k_b))
//--
//-- Loop_rounds_0_59_a
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_a i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_a i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_a (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(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 336 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 337 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 338 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 339 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 340 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 341 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 342 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 343 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_59_a va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_a va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_a i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_59_a (va_code_Loop_rounds_0_59_a i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_59_b
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_b i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_b i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_b (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(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 395 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 396 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 397 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 398 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 399 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 400 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 401 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 402 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_59_b va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_b va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_b i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 346 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 382 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 383 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 392 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 393 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_59_b (va_code_Loop_rounds_0_59_b i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_59_c
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_c i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_c i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_c (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(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 454 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 455 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 456 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 457 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 458 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 459 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 460 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 461 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_59_c va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_c va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_c i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 405 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 441 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 442 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 451 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_59_c i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_59_c (va_code_Loop_rounds_0_59_c i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_59_d
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_d i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 12) (va_op_vec_opr_vec
20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 13) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 15) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_d i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 12)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_d (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_d i)) =
(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 513 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 12) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 514 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 515 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 13) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 516 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 517 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 14) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 518 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 519 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 15) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 520 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (()))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.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.SHA.PPC64LE.Rounds.Core.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": 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": 2000,
"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 ->
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"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_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d",
"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",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Addition",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.SHA.PPC64LE.Rounds.Core.va_qcode_Loop_rounds_0_59_d"
] | [] | false | false | false | false | false | let va_lemma_Loop_rounds_0_59_d va_b0 va_s0 i k_b block hash_orig =
| let va_mods:va_mods_t =
[
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
]
in
let va_qc = va_qcode_Loop_rounds_0_59_d va_mods i k_b block hash_orig in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Loop_rounds_0_59_d i)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 464 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\
(label va_range1
"***** POSTCONDITION NOT MET AT line 500 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 501 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
label va_range1
"***** POSTCONDITION NOT MET AT line 510 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig
in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 511 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7))))
))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Hacl.Spec.Bignum.AlmostMontgomery.fst | Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_reduction_lemma | val bn_almost_mont_reduction_lemma:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> c:lbignum t (nLen + nLen) -> Lemma
(requires BM.bn_mont_pre n mu)
(ensures
bn_v (bn_almost_mont_reduction n mu c) ==
AM.almost_mont_reduction (bits t) nLen (bn_v n) (v mu) (bn_v c)) | val bn_almost_mont_reduction_lemma:
#t:limb_t
-> #nLen:size_pos{nLen + nLen <= max_size_t}
-> n:lbignum t nLen
-> mu:limb t
-> c:lbignum t (nLen + nLen) -> Lemma
(requires BM.bn_mont_pre n mu)
(ensures
bn_v (bn_almost_mont_reduction n mu c) ==
AM.almost_mont_reduction (bits t) nLen (bn_v n) (v mu) (bn_v c)) | let bn_almost_mont_reduction_lemma #t #nLen n mu res0 =
let pbits = bits t in
let r = pow2 (pbits * nLen) in
let r2 = pow2 (pbits * (nLen + nLen)) in
Math.Lemmas.pow2_plus (pbits * nLen) (pbits * nLen);
assert (r2 == r * r);
let c0, res1 = BM.bn_mont_reduction_loop_div_r #t #nLen n mu res0 in
let resM1 = M.mont_reduction_loop_div_r (bits t) nLen (bn_v n) (v mu) (bn_v res0) in
BM.bn_mont_reduction_loop_div_r_lemma #t #nLen n mu res0;
assert (v c0 * r + bn_v res1 == resM1);
let resM = if resM1 < r then resM1 else resM1 - bn_v n in
//assert (resM == AM.almost_mont_reduction (bits t) nLen (bn_v n) (v mu) (bn_v res0));
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res1 n in
BN.bn_sub_lemma res1 n;
assert (bn_v tmp - v c1 * r == bn_v res1 - bn_v n);
let res = map2 (mask_select mask) tmp res1 in
lseq_mask_select_lemma tmp res1 mask;
assert (res == (if v mask = 0 then res1 else tmp));
bn_eval_bound res1 nLen;
M.mont_reduction_loop_div_r_fits_lemma (bits t) nLen (bn_v n) (v mu) (bn_v res0);
assert (v c0 * r + bn_v res1 <= (bn_v res0 - bn_v n) / r + bn_v n);
bn_eval_bound res0 (nLen + nLen);
AM.lemma_fits_c_lt_rr (bn_v res0) r (bn_v n);
assert (resM1 < r + bn_v n) | {
"file_name": "code/bignum/Hacl.Spec.Bignum.AlmostMontgomery.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 65,
"start_col": 0,
"start_line": 36
} | module Hacl.Spec.Bignum.AlmostMontgomery
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module M = Hacl.Spec.Montgomery.Lemmas
module BN = Hacl.Spec.Bignum
module BM = Hacl.Spec.Bignum.Montgomery
friend Hacl.Spec.Bignum.Montgomery
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
/// Low-level specification of Almost Montgomery Multiplication
let bn_almost_mont_reduction #t #nLen n mu c =
let c0, res = BM.bn_mont_reduction_loop_div_r #t #nLen n mu c in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res n in
map2 (mask_select mask) tmp res
let bn_almost_mont_mul #t #nLen n mu aM bM =
let c = BN.bn_mul aM bM in // c = aM * bM
bn_almost_mont_reduction n mu c // resM = c % n
let bn_almost_mont_sqr #t #nLen n mu aM =
let c = BN.bn_mul aM aM in // c = aM * aM
bn_almost_mont_reduction n mu c // resM = c % n | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Spec.Montgomery.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Spec.Bignum.AlmostMontgomery.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Montgomery.Lemmas",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.AlmostMontgomery.Lemmas",
"short_module": "AM"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Hacl.Spec.Bignum.Definitions.lbignum t nLen ->
mu: Hacl.Spec.Bignum.Definitions.limb t ->
c: Hacl.Spec.Bignum.Definitions.lbignum t (nLen + nLen)
-> FStar.Pervasives.Lemma (requires Hacl.Spec.Bignum.Montgomery.bn_mont_pre n mu)
(ensures
Hacl.Spec.Bignum.Definitions.bn_v (Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_reduction
n
mu
c) ==
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction (Lib.IntTypes.bits t)
nLen
(Hacl.Spec.Bignum.Definitions.bn_v n)
(Lib.IntTypes.v mu)
(Hacl.Spec.Bignum.Definitions.bn_v c)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Hacl.Spec.Bignum.Definitions.limb",
"Hacl.Spec.Bignum.Base.carry",
"Prims._assert",
"Prims.op_LessThan",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Prims.unit",
"Hacl.Spec.AlmostMontgomery.Lemmas.lemma_fits_c_lt_rr",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.SEC",
"Prims.op_Division",
"Prims.op_Subtraction",
"Hacl.Spec.Montgomery.Lemmas.mont_reduction_loop_div_r_fits_lemma",
"Lib.IntTypes.bits",
"Prims.eq2",
"Lib.Sequence.lseq",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Hacl.Spec.Bignum.Base.lseq_mask_select_lemma",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_imp",
"Lib.Sequence.index",
"Hacl.Spec.Bignum.Base.mask_select",
"Lib.Sequence.map2",
"Hacl.Spec.Bignum.bn_sub_lemma",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.bn_sub",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Subtraction_Dot",
"Lib.IntTypes.uint",
"Hacl.Spec.Bignum.Montgomery.bn_mont_reduction_loop_div_r_lemma",
"Hacl.Spec.Montgomery.Lemmas.mont_reduction_loop_div_r",
"Hacl.Spec.Bignum.Montgomery.bn_mont_reduction_loop_div_r",
"FStar.Math.Lemmas.pow2_plus",
"Prims.pos",
"Prims.pow2"
] | [] | false | false | true | false | false | let bn_almost_mont_reduction_lemma #t #nLen n mu res0 =
| let pbits = bits t in
let r = pow2 (pbits * nLen) in
let r2 = pow2 (pbits * (nLen + nLen)) in
Math.Lemmas.pow2_plus (pbits * nLen) (pbits * nLen);
assert (r2 == r * r);
let c0, res1 = BM.bn_mont_reduction_loop_div_r #t #nLen n mu res0 in
let resM1 = M.mont_reduction_loop_div_r (bits t) nLen (bn_v n) (v mu) (bn_v res0) in
BM.bn_mont_reduction_loop_div_r_lemma #t #nLen n mu res0;
assert (v c0 * r + bn_v res1 == resM1);
let resM = if resM1 < r then resM1 else resM1 - bn_v n in
let mask = uint #t 0 -. c0 in
let c1, tmp = BN.bn_sub res1 n in
BN.bn_sub_lemma res1 n;
assert (bn_v tmp - v c1 * r == bn_v res1 - bn_v n);
let res = map2 (mask_select mask) tmp res1 in
lseq_mask_select_lemma tmp res1 mask;
assert (res == (if v mask = 0 then res1 else tmp));
bn_eval_bound res1 nLen;
M.mont_reduction_loop_div_r_fits_lemma (bits t) nLen (bn_v n) (v mu) (bn_v res0);
assert (v c0 * r + bn_v res1 <= (bn_v res0 - bn_v n) / r + bn_v n);
bn_eval_bound res0 (nLen + nLen);
AM.lemma_fits_c_lt_rr (bn_v res0) r (bn_v n);
assert (resM1 < r + bn_v n) | false |
Vale.SHA.PPC64LE.Rounds.Core.fst | Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_0_59_c | val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | val va_lemma_Loop_rounds_0_59_c : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_c i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 8) (i == 24)) (i == 40)) (i == 56) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 8 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 9 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 10 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 11 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | let va_lemma_Loop_rounds_0_59_c va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_c va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_c i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 405 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 441 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 442 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 451 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1313,
"start_col": 0,
"start_line": 1271
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_3_7_11_body i msg =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_CNil ()))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_3_7_11_body i msg =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_3_7_11_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (in_b:buffer128)
(offset:nat) : (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(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 79 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg (va_op_reg_opr_reg 4) Secret
in_b offset) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 4) 16) (va_QEmpty (())))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_3_7_11_body va_b0 va_s0 i msg in_b offset =
let (va_mods:va_mods_t) = [va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg] in
let va_qc = va_qcode_Loop_rounds_3_7_11_body va_mods i msg in_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_3_7_11_body i msg) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 55 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 76 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 77 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 16))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_3_7_11_body (va_code_Loop_rounds_3_7_11_body i msg)
va_s0 i msg in_b offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok va_sM (va_update_operand_vec_opr
msg va_sM va_s0))));
va_lemma_norm_mods ([va_Mod_reg 4; va_mod_vec_opr msg]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_1_15_shift_body
val va_code_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 1) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1
msg1 4) (va_CNil ())) else va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block
(va_CCons (va_code_Vsldoi msg0 msg1 msg1 8) (va_CNil ())) else va_Block (va_CCons (if (i
`op_Modulus` 4 = 3) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1 msg1 12) (va_CNil ()))
else va_Block (va_CNil ())) (va_CNil ()))) (va_CNil ()))) (va_CNil ())))
val va_codegen_success_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_pbool_and (if (i `op_Modulus` 4 = 1) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1
msg1 4) (va_ttrue ()) else va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Vsldoi msg0 msg1 msg1 8) (va_ttrue ()) else va_pbool_and (if (i
`op_Modulus` 4 = 3) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1 msg1 12) (va_ttrue
()) else va_ttrue ()) (va_ttrue ())) (va_ttrue ())) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_1_15_shift_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(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 100 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 1) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 102 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 4) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 104 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 106 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 8) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 108 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 3) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 110 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 12) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) (fun (va_s:va_state) va_g ->
va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_rounds_1_15_shift_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_1_15_shift_body va_b0 va_s0 i msg0 msg1 block =
let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_1_15_shift_body va_mods i msg0 msg1 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 83 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 98 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (forall (va_x_msg0:va_value_vec_opr) . let
va_sM = va_upd_operand_vec_opr msg0 va_x_msg0 va_s0 in va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_1_15_shift_body (va_code_Loop_rounds_1_15_shift_body i
msg0 msg1) va_s0 i msg0 msg1 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)));
va_lemma_norm_mods ([va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr)
(msg1:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(va_QProc (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) ([va_mod_vec_opr msg0])
(va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block) (va_wpProof_Loop_rounds_1_15_shift_body i
msg0 msg1 block))
//--
//-- Loop_rounds_16_63_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_Block (va_CCons (va_code_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1) (va_CCons
(va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_CCons (va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vadduwm msg0 msg0 msg2) (va_CNil ())))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)
(va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_codegen_success_Vadduwm msg0
msg0 (va_op_vec_opr_vec 25))) (va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_codegen_success_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3))
(va_pbool_and (va_pbool_and (va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 msg2) (va_codegen_success_Vadduwm msg0 msg0 msg2))
(va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_63_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(msg2:vec_opr) (msg3:vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(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 145 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 146 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_0_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 147 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 148 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 149 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_1_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 150 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 151 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 msg2) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_ws_opaque block i) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_63_body va_b0 va_s0 i msg0 msg1 msg2 msg3 block =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_16_63_body va_mods i msg0 msg1 msg2 msg3 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2
msg3) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 114 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 140 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i -
16)) sigma0) sigma1) (ws_opaque block (i - 7))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 143 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_63_body (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) va_s0 i msg0 msg1 msg2 msg3 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_63_body
val va_code_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr ->
b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_Block (va_CCons (va_code_Vadduwm h_vec h_vec msg) (va_CCons (va_code_Vsel (va_op_vec_opr_vec
25) g_vec f_vec e_vec) (va_CCons (if op_disEquality i 63 then va_Block (va_CCons
(va_code_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_CNil ())) else va_Block (va_CNil ()))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_Sigma1
(va_op_vec_opr_vec 26) e_vec) (va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_CCons (va_code_Vsel
(va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_Vadduwm d_vec
d_vec h_vec) (va_CCons (va_code_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_CCons
(va_code_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_CCons (if (i = 63) then
va_Block (va_CNil ()) else va_Block (va_CNil ())) (va_CNil ())))))))))))))))
val va_codegen_success_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr ->
a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr ->
d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr ->
g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec msg) (va_pbool_and (va_codegen_success_Vsel
(va_op_vec_opr_vec 25) g_vec f_vec e_vec) (va_pbool_and (if op_disEquality i 63 then
va_pbool_and (va_codegen_success_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_ttrue ()) else
va_ttrue ()) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec) (va_pbool_and
(va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_pbool_and
(va_codegen_success_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_Vadduwm d_vec d_vec h_vec) (va_pbool_and
(va_codegen_success_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_pbool_and
(va_codegen_success_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec
25)) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_pbool_and (if (i = 63) then va_ttrue () else va_ttrue ()) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_63_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (a_vec:vec_opr)
(b_vec:vec_opr) (c_vec:vec_opr) (d_vec:vec_opr) (e_vec:vec_opr) (f_vec:vec_opr) (g_vec:vec_opr)
(h_vec:vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode unit
(va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(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 227 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec msg) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 228 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) g_vec f_vec e_vec) (fun (va_s:va_state) _ -> let
(va_arg53:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s e_vec) in let (va_arg52:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s g_vec) in let
(va_arg51:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s f_vec) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_vsel32 va_arg51 va_arg52 va_arg53)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 230 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (op_disEquality i 63) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 232 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 234 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg50:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg49:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg48:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 236 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_1_partial va_arg48 va_arg49
va_arg50) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 238 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 239 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (fun (va_s:va_state)
_ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 240 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg47:Vale.Def.Words_s.nat32)
= Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s c_vec) in let
(va_arg46:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s b_vec) in let (va_arg45:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s a_vec) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 241 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_eq_maj_xvsel32 va_arg45 va_arg46 va_arg47)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 242 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm d_vec d_vec h_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 243 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg44:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg43:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg42:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 244 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_0_partial va_arg42 va_arg43
va_arg44) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 245 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 246 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (fun (va_s:va_state) _ -> let
(va_arg41:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg40:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg39:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 247 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_shuffle_core_properties va_arg39 va_arg40
va_arg41) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i = 63) (qblock va_mods (fun (va_s:va_state) -> let
(va_arg38:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s g_vec in let
(va_arg37:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s f_vec in let
(va_arg36:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s e_vec in let
(va_arg35:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s d_vec in let
(va_arg34:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s c_vec in let
(va_arg33:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s b_vec in let
(va_arg32:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s a_vec in let
(va_arg31:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s h_vec in let
(va_arg30:Vale.SHA.PPC64LE.SHA_helpers.hash256) =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 250 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_make_seperated_hash va_arg30 va_arg31
va_arg32 va_arg33 va_arg34 va_arg35 va_arg36 va_arg37 va_arg38) (va_QEmpty (())))) (qblock
va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Loop_rounds_0_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr ->
c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr ->
f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> k_b:buffer128
-> block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec
e_vec f_vec g_vec h_vec) va_s0 /\ va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0
/\ va_is_src_vec_opr b_vec va_s0 /\ va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec
va_s0 /\ va_is_src_vec_opr e_vec va_s0 /\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr
g_vec va_s0 /\ va_is_dst_vec_opr h_vec va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\
msg == i `op_Modulus` 16 /\ (i `op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec ==
18 /\ d_vec == 19 /\ e_vec == 20 /\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i
`op_Modulus` 8 == 1 ==> a_vec == 23 /\ b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19
/\ f_vec == 20 /\ g_vec == 21 /\ h_vec == 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\
b_vec == 23 /\ c_vec == 16 /\ d_vec == 17 /\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec
== 21) /\ (i `op_Modulus` 8 == 3 ==> a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16
/\ e_vec == 17 /\ f_vec == 18 /\ g_vec == 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==>
a_vec == 20 /\ b_vec == 21 /\ c_vec == 22 /\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec
== 18 /\ h_vec == 19) /\ (i `op_Modulus` 8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21
/\ d_vec == 22 /\ e_vec == 23 /\ f_vec == 16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus`
8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\ c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec ==
23 /\ g_vec == 16 /\ h_vec == 17) /\ (i `op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\
c_vec == 19 /\ d_vec == 20 /\ e_vec == 21 /\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let
ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in let h_k =
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_63_body va_b0 va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec
h_vec k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec] in
let va_qc = va_qcode_Loop_rounds_0_63_body va_mods i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_63_body i msg a_vec b_vec
c_vec d_vec e_vec f_vec g_vec h_vec) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 205 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in label va_range1
"***** POSTCONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let h_k = Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in label va_range1
"***** POSTCONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in label va_range1
"***** POSTCONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let maj = Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 212 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0_maj = Vale.Arch.Types.add_wrap32 sigma0 maj in label va_range1
"***** POSTCONDITION NOT MET AT line 213 column 137 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM d_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 214 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 215 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 225 column 145 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i == 63 ==> Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM
h_vec) (va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM
c_vec) (va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM
f_vec) (va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0 /\ va_is_src_vec_opr b_vec va_s0 /\
va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec va_s0 /\ va_is_src_vec_opr e_vec va_s0
/\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr g_vec va_s0 /\ va_is_dst_vec_opr h_vec
va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\ msg == i `op_Modulus` 16 /\ (i
`op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec == 18 /\ d_vec == 19 /\ e_vec == 20
/\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i `op_Modulus` 8 == 1 ==> a_vec == 23 /\
b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19 /\ f_vec == 20 /\ g_vec == 21 /\ h_vec
== 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\ b_vec == 23 /\ c_vec == 16 /\ d_vec == 17
/\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec == 21) /\ (i `op_Modulus` 8 == 3 ==>
a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16 /\ e_vec == 17 /\ f_vec == 18 /\ g_vec
== 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==> a_vec == 20 /\ b_vec == 21 /\ c_vec == 22
/\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec == 18 /\ h_vec == 19) /\ (i `op_Modulus`
8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21 /\ d_vec == 22 /\ e_vec == 23 /\ f_vec ==
16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus` 8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\
c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec == 23 /\ g_vec == 16 /\ h_vec == 17) /\ (i
`op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\ c_vec == 19 /\ d_vec == 20 /\ e_vec == 21
/\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))))) /\ (forall (va_x_d_vec:va_value_vec_opr)
(va_x_g_vec:va_value_vec_opr) (va_x_h_vec:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32)
. let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr h_vec
va_x_h_vec (va_upd_operand_vec_opr g_vec va_x_g_vec (va_upd_operand_vec_opr d_vec va_x_d_vec
va_s0)))) in va_get_ok va_sM /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i
block hash_orig in let h_k = Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr
-> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec
f_vec g_vec h_vec k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr
h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_63_body (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec;
va_mod_vec_opr d_vec]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode
unit (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(va_QProc (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)
([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr
d_vec]) (va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig) (va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig))
//--
//-- Loop_round_0_61_body
val va_code_Loop_round_0_61_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_round_0_61_body i =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block (va_CCons
(va_code_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_CNil ()))) else va_Block (va_CCons (va_code_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_CNil ()))) (va_CNil
())))
val va_codegen_success_Loop_round_0_61_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_round_0_61_body i =
(va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_ttrue ())) else va_pbool_and (va_codegen_success_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_ttrue ()))
(va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_round_0_61_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(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 276 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 278 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret k_b ((i + 2) `op_Division` 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 16) (va_QEmpty (()))))) (qblock
va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 283 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4)
(va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_round_0_61_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_round_0_61_body i) va_s0 /\ va_get_ok va_s0 /\
(l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2)
`op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) /\
va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM va_s0)))))
[@"opaque_to_smt"]
let va_lemma_Loop_round_0_61_body va_b0 va_s0 i k_b =
let (va_mods:va_mods_t) = [va_Mod_vec 24; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_round_0_61_body va_mods i k_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_round_0_61_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 254 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 270 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 271 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 272 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 273 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 274 column 97 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ 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_vec 24; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_round_0_61_body (i:nat) (k_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b
((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==>
(va_get_vec 24 va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24
va_s0).hi2 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks))) /\ (forall (va_x_r6:nat64) (va_x_v24:quad32) .
let va_sM = va_upd_vec 24 va_x_v24 (va_upd_reg 6 va_x_r6 va_s0) in va_get_ok va_sM /\ (let ks =
Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_sM) in
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) ==>
va_k va_sM (())))
val va_wpProof_Loop_round_0_61_body : i:nat -> k_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_Loop_round_0_61_body i k_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_round_0_61_body i) ([va_Mod_vec
24; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_round_0_61_body i k_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_round_0_61_body (va_code_Loop_round_0_61_body i) va_s0 i k_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM
va_s0))));
va_lemma_norm_mods ([va_Mod_vec 24; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_round_0_61_body (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(va_QProc (va_code_Loop_round_0_61_body i) ([va_Mod_vec 24; va_Mod_reg 6])
(va_wp_Loop_round_0_61_body i k_b) (va_wpProof_Loop_round_0_61_body i k_b))
//--
//-- Loop_rounds_0_59_a
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_a i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_a i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_a (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(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 336 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 337 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 338 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 339 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 340 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 341 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 342 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 343 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_59_a va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_a va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_a i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_59_a (va_code_Loop_rounds_0_59_a i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_59_b
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_b i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_b i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_b (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(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 395 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 396 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 397 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 398 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 399 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 400 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 401 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 402 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_59_b va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_b va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_b i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 346 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 382 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 383 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 392 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 393 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_59_b i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_59_b (va_code_Loop_rounds_0_59_b i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_59_c
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_c i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 11) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_c i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 8)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_c (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_c i)) =
(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 454 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 8) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 455 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 456 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 457 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 458 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 10) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 459 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 460 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 11) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 461 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (()))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.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.SHA.PPC64LE.Rounds.Core.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": 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": 2000,
"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 ->
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"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_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"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",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Addition",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.SHA.PPC64LE.Rounds.Core.va_qcode_Loop_rounds_0_59_c"
] | [] | false | false | false | false | false | let va_lemma_Loop_rounds_0_59_c va_b0 va_s0 i k_b block hash_orig =
| let va_mods:va_mods_t =
[
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
]
in
let va_qc = va_qcode_Loop_rounds_0_59_c va_mods i k_b block hash_orig in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Loop_rounds_0_59_c i)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 405 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\
(label va_range1
"***** POSTCONDITION NOT MET AT line 441 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 442 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
label va_range1
"***** POSTCONDITION NOT MET AT line 451 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig
in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7))))
))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Spec.Loops.fst | Spec.Loops.repeat_range_induction | val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min)) | val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x)
(decreases (max - min)) | let rec repeat_range_induction #a min max f x =
if min = max - 1 then ()
else repeat_range_induction (min+1) max f (f x min) | {
"file_name": "krmllib/Spec.Loops.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 53,
"end_line": 72,
"start_col": 0,
"start_line": 70
} | module Spec.Loops
#reset-options "--max_fuel 0"
val seq_map:
#a:Type -> #b:Type ->
f:(a -> Tot b) ->
s:Seq.seq a ->
Tot (s':Seq.seq b{Seq.length s = Seq.length s' /\
(forall (i:nat). {:pattern (Seq.index s' i)} i < Seq.length s' ==> Seq.index s' i == f (Seq.index s i))})
(decreases (Seq.length s))
let rec seq_map #a #b f s =
if Seq.length s = 0 then
Seq.empty
else
let s' = Seq.cons (f (Seq.head s)) (seq_map f (Seq.tail s)) in
s'
val seq_map2:
#a:Type -> #b:Type -> #c:Type ->
f:(a -> b -> Tot c) ->
s:Seq.seq a -> s':Seq.seq b{Seq.length s = Seq.length s'} ->
Tot (s'':Seq.seq c{Seq.length s = Seq.length s'' /\
(forall (i:nat). {:pattern (Seq.index s'' i)} i < Seq.length s'' ==> Seq.index s'' i == f (Seq.index s i) (Seq.index s' i))})
(decreases (Seq.length s))
let rec seq_map2 #a #b #c f s s' =
if Seq.length s = 0 then Seq.empty
else
let s'' = Seq.cons (f (Seq.head s) (Seq.head s')) (seq_map2 f (Seq.tail s) (Seq.tail s')) in
s''
val repeat: #a:Type -> n:nat -> (f: a -> Tot a) -> a -> Tot a (decreases n)
let rec repeat #a n f x =
if n = 0 then x else repeat (n-1) f (f x)
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_induction: #a:Type -> n:nat{n > 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == f (repeat (n-1) f x))
let rec repeat_induction #a n f x =
if n = 1 then ()
else repeat_induction (n-1) f (f x)
val repeat_base: #a:Type -> n:nat{n = 0} -> f:( a -> Tot a) -> x:a -> Lemma
(repeat n f x == x)
let rec repeat_base #a n f x = ()
#reset-options "--max_fuel 0"
val repeat_range: #a:Type -> min:nat -> max:nat{min <= max} -> f:(a -> i:nat{i < max} -> Tot a) ->
x:a -> Tot a (decreases (max - min))
let rec repeat_range #a min max f x =
if min = max then x
else repeat_range (min+1) max f (f x min)
#reset-options "--initial_fuel 1 --max_fuel 1"
val repeat_range_base: #a:Type -> min:nat -> f:(a -> i:nat{i < min} -> Tot a) -> x:a ->
Lemma (ensures (repeat_range min min f x == x))
let repeat_range_base #a min f x = ()
#reset-options "--initial_fuel 2 --max_fuel 2"
val repeat_range_induction:
#a:Type -> min:nat -> max:nat{min < max} -> f:(a -> i:nat{i < max} -> Tot a) -> x:a ->
Lemma (requires (True))
(ensures f (repeat_range min (max-1) f x) (max-1) == repeat_range min max f x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Spec.Loops.fst"
} | [
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 2,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | min: Prims.nat -> max: Prims.nat{min < max} -> f: (_: a -> i: Prims.nat{i < max} -> a) -> x: a
-> FStar.Pervasives.Lemma
(ensures
f (Spec.Loops.repeat_range min (max - 1) f x) (max - 1) ==
Spec.Loops.repeat_range min max f x) (decreases max - min) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Prims.bool",
"Spec.Loops.repeat_range_induction",
"Prims.op_Addition",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec repeat_range_induction #a min max f x =
| if min = max - 1 then () else repeat_range_induction (min + 1) max f (f x min) | false |
Pulse.Checker.Pure.fst | Pulse.Checker.Pure.instantiate_term_implicits_uvs | val instantiate_term_implicits_uvs (g:env) (t:term)
: T.Tac (uvs:env { disjoint g uvs } & term & term) | val instantiate_term_implicits_uvs (g:env) (t:term)
: T.Tac (uvs:env { disjoint g uvs } & term & term) | let instantiate_term_implicits_uvs (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs, t, ty |)
: uvs:env { disjoint g uvs } &
term &
term =
T.fold_left (fun (| uvs, t, ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var {nm_index = x; nm_ppname = ppname})] in
let uvs : uvs:env { disjoint g uvs } = push_binding uvs x ppname xt in
(| uvs,
subst_term t ss,
subst_term ty ss |)) (| mk_env (fstar_env g), t, ty |) namedvs in
(| uvs, t, ty |)
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Pure.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 49,
"end_line": 269,
"start_col": 0,
"start_line": 228
} | (*
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 Pulse.Checker.Pure
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.Tactics.V2
open FStar.Reflection.V2 (* shadow named view *)
open Pulse.PP
open Pulse.Reflection
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
module P = Pulse.Syntax.Printer
module RTB = FStar.Stubs.Tactics.V2.Builtins
module RU = Pulse.RuntimeUtils
module CheckLN = FStar.Tactics.CheckLN
let debug (g:env) (msg: unit -> T.Tac string) =
let tac_debugging = T.debugging () in
if tac_debugging || RU.debug_at_level (fstar_env g) "refl_tc_callbacks"
then T.print (print_context g ^ "\n" ^ msg())
let check_ln (g:env) (label:string) (t:R.term) : Tac unit =
if not (CheckLN.check_ln t) then
fail_doc g (Some (RU.range_of_term t)) [
text "Failure: not locally nameless!";
text "Aborting before calling" ^/^ pp label;
text "term" ^/^ equals ^/^ pp t;
]
let rtb_core_compute_term_type g f e =
check_ln g "rtb_compute_term_type" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_compute_term_type f e) in
res
let rtb_tc_term g f e =
(* WARN: unary dependence, see comment in RU *)
check_ln g "rtb_tc_term" e;
let e = RU.deep_transform_to_unary_applications e in
debug g (fun _ ->
Printf.sprintf "(%s) Calling tc_term on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.tc_term f e) in
res
let rtb_universe_of g f e =
check_ln g "rtb_universe_of" e;
debug g (fun _ ->
Printf.sprintf "(%s) Calling universe_of on %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e));
let res = RU.with_context (get_context g) (fun _ -> RTB.universe_of f e) in
res
let rtb_check_subtyping g (t1 t2:term) : Tac (ret_t (subtyping_token g t1 t2)) =
let e1 = elab_term t1 in
let e2 = elab_term t2 in
check_ln g "rtb_check_subtyping.t1" e1;
check_ln g "rtb_check_subtyping.t2" e2;
debug g (fun _ ->
Printf.sprintf "(%s, %s) Calling check_subtyping on %s <: %s"
(T.range_to_string (t1.range))
(T.range_to_string (t2.range))
(P.term_to_string t1)
(P.term_to_string t2));
let res = RU.with_context (get_context g) (fun _ -> RTB.check_subtyping (elab_env g) e1 e2) in
res
let rtb_instantiate_implicits g f t =
check_ln g "rtb_instantiate_implicits" t;
debug g (fun _ -> Printf.sprintf "Calling instantiate_implicits on %s"
(T.term_to_string t));
(* WARN: unary dependence, see comment in RU *)
let t = RU.deep_transform_to_unary_applications t in
let res, iss = RU.with_context (get_context g) (fun _ -> RTB.instantiate_implicits f t) in
match res with
| None ->
debug g (fun _ -> "Returned from instantiate_implicits: None");
res, iss
| Some (_, t, _) ->
debug g (fun _ -> Printf.sprintf "Returned from instantiate_implicits: %s" (T.term_to_string t));
res, iss
let rtb_core_check_term g f e eff t =
check_ln g "rtb_core_check_term.e" e;
check_ln g "rtb_core_check_term.t" t;
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term f e t eff) in
res
let rtb_core_check_term_at_type g f e t =
debug g (fun _ ->
Printf.sprintf "(%s) Calling core_check_term_at_type on %s and %s"
(T.range_to_string (RU.range_of_term e))
(T.term_to_string e)
(T.term_to_string t));
let res = RU.with_context (get_context g) (fun _ -> RTB.core_check_term_at_type f e t) in
res
let mk_squash t =
let sq : R.term = pack_ln (Tv_UInst (pack_fv squash_qn) [u_zero]) in
mk_e_app sq [t]
let squash_prop_validity_token f p (t:prop_validity_token f (mk_squash p))
: prop_validity_token f p
= admit(); t
let rtb_check_prop_validity (g:env) (sync:bool) (f:_) (p:_) =
check_ln g "rtb_check_prop_validity" p;
debug g (fun _ ->
Printf.sprintf "(%s) Calling check_prop_validity on %s"
(T.range_to_string (RU.range_of_term p))
(T.term_to_string p));
let sp = mk_squash p in
let res, issues =
RU.with_context (get_context g)
(fun _ ->
if sync
then T.with_policy T.SMTSync (fun _ -> RTB.check_prop_validity f sp)
else RTB.check_prop_validity f sp)
in
match res with
| None -> None, issues
| Some tok -> Some (squash_prop_validity_token f p tok), issues
let exn_as_issue (e:exn) : FStar.Issue.issue =
FStar.Issue.mk_issue "Error" (RU.print_exn e) None None []
let catch_all (f:unit -> Tac (option 'a & issues))
: Tac (option 'a & issues)
= match T.catch f with
| Inl exn ->
None, [exn_as_issue exn]
| Inr v -> v
let readback_failure (s:R.term) =
Printf.sprintf "Internal error: failed to readback F* term %s"
(T.term_to_string s)
let ill_typed_term (t:term) (expected_typ:option term) (got_typ:option term) : Tac (list FStar.Stubs.Pprint.document) =
let open Pulse.PP in
match expected_typ, got_typ with
| None, _ ->
[text "Ill-typed term: " ^^ pp t]
| Some ty, None ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t)]
| Some ty, Some ty' ->
[group (text "Expected term of type" ^/^ pp ty) ^/^
group (text "got term" ^/^ pp t) ^/^
group (text "of type" ^/^ pp ty')]
let maybe_fail_doc (issues:list FStar.Issue.issue)
(g:env) (rng:range) (doc:list FStar.Stubs.Pprint.document) =
let has_localized_error =
List.Tot.Base.existsb
(fun i ->
FStar.Issue.level_of_issue i = "Error"
&& Some? (FStar.Issue.range_of_issue i))
issues
in
if has_localized_error
then let message = FStar.Stubs.Pprint.(pretty_string RU.float_one 80 (concat doc)) in
T.fail message (* Would be nice to tag this failure with the provided range *)
else fail_doc g (Some rng) doc
let instantiate_term_implicits (g:env) (t0:term) =
let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None -> (
let open Pulse.PP in
maybe_fail_doc issues
g t0.range [
prefix 4 1 (text "Could not infer implicit arguments in")
(pp t0)
]
)
| Some (namedvs, t, ty) ->
if L.length namedvs <> 0
then
let open Pulse.PP in
maybe_fail_doc []
g t0.range [
prefix 4 1 (text "check_term: could not infer implicit arguments in")
(pp t0)
]
else
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty -> t, ty
| Some _, None ->
fail g (Some t0.range) (readback_failure ty)
| None, _ ->
fail g (Some t0.range) (readback_failure t) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Util.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.Base.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.PP.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.CheckLN.fsti.checked",
"FStar.Stubs.Tactics.V2.Builtins.fsti.checked",
"FStar.Stubs.Pprint.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.Base.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Issue.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Pure.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V2 (* shadow named view *)",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.CheckLN",
"short_module": "CheckLN"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Tactics.V2.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": false,
"full_module": "Pulse.Readback",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple3 (uvs: Pulse.Typing.Env.env{Pulse.Typing.Env.disjoint g uvs})
(fun _ -> Pulse.Syntax.Base.term)
(fun _ _ -> Pulse.Syntax.Base.term)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple3",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Stubs.Reflection.Types.namedv",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Tactics.Types.issues",
"Pulse.Checker.Pure.maybe_fail_doc",
"FStar.Pervasives.dtuple3",
"Pulse.Typing.Env.disjoint",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"FStar.Stubs.Pprint.document",
"Prims.Cons",
"Prims.Nil",
"FStar.Stubs.Pprint.prefix",
"Pulse.PP.text",
"Pulse.PP.pp",
"Pulse.PP.uu___44",
"FStar.Pervasives.Native.Mktuple2",
"Prims.eq2",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Pervasives.Mkdtuple3",
"FStar.Tactics.Util.fold_left",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Prims.string",
"Pulse.Checker.Pure.readback_failure",
"Prims.bool",
"Pulse.Syntax.Naming.subst_term",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Naming.subst_elt",
"Pulse.Syntax.Naming.NT",
"FStar.Stubs.Reflection.V2.Data.__proj__Mknamedv_view__item__uniq",
"Pulse.Syntax.Pure.tm_var",
"Pulse.Syntax.Base.Mknm",
"Pulse.Syntax.Base.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"Pulse.Typing.Env.dom",
"Pulse.Typing.Env.push_env",
"Pulse.Typing.Env.fresh",
"Pulse.Readback.readback_ty",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.Mkppname",
"FStar.Stubs.Reflection.V2.Data.__proj__Mknamedv_view__item__ppname",
"FStar.Stubs.Reflection.V2.Data.namedv_view",
"Prims.precedes",
"FStar.Stubs.Reflection.V2.Builtins.inspect_namedv",
"Pulse.Typing.Env.mk_env",
"Pulse.Typing.Env.fstar_env",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.log_issues",
"Pulse.Checker.Pure.catch_all",
"Pulse.Checker.Pure.rtb_instantiate_implicits",
"FStar.Stubs.Reflection.Types.env",
"Pulse.RuntimeUtils.env_set_range",
"FStar.Range.range",
"Pulse.Typing.Env.get_range",
"Pulse.Typing.elab_env"
] | [] | false | true | false | false | false | let instantiate_term_implicits_uvs (g: env) (t0: term) =
| let f = elab_env g in
let rt = elab_term t0 in
let f = RU.env_set_range f (Pulse.Typing.Env.get_range g (Some t0.range)) in
let topt, issues = catch_all (fun _ -> rtb_instantiate_implicits g f rt) in
T.log_issues issues;
match topt with
| None ->
(let open Pulse.PP in
maybe_fail_doc issues
g
t0.range
[prefix 4 1 (text "Could not infer implicit arguments in") (pp t0)])
| Some (namedvs, t, ty) ->
let topt = readback_ty t in
let tyopt = readback_ty ty in
match topt, tyopt with
| Some t, Some ty ->
let (| uvs , t , ty |):uvs: env{disjoint g uvs} & term & term =
T.fold_left (fun (| uvs , t , ty |) (namedv, namedvt) ->
let nview = R.inspect_namedv namedv in
let ppname = { name = nview.ppname; range = t0.range } <: Pulse.Syntax.Base.ppname in
let xt = readback_ty namedvt in
if None? xt
then fail g (Some t0.range) (readback_failure namedvt)
else
let Some xt = xt in
let x = fresh (push_env g uvs) in
let ss = [NT nview.uniq (tm_var ({ nm_index = x; nm_ppname = ppname }))] in
let uvs:uvs: env{disjoint g uvs} = push_binding uvs x ppname xt in
(| uvs, subst_term t ss, subst_term ty ss |))
(| mk_env (fstar_env g), t, ty |)
namedvs
in
(| uvs, t, ty |)
| Some _, None -> fail g (Some t0.range) (readback_failure ty)
| None, _ -> fail g (Some t0.range) (readback_failure t) | false |
Vale.SHA.PPC64LE.Rounds.Core.fst | Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_0_59_b | val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | val va_lemma_Loop_rounds_0_59_b : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_b i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 4) (i == 20)) (i == 36)) (i == 52) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 20 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 23 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 19 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 4 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 5 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 6 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 7 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | let va_lemma_Loop_rounds_0_59_b va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_b va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_b i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 346 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 382 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 383 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 392 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 393 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1180,
"start_col": 0,
"start_line": 1138
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_3_7_11_body i msg =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_CNil ()))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_3_7_11_body i msg =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_3_7_11_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (in_b:buffer128)
(offset:nat) : (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(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 79 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg (va_op_reg_opr_reg 4) Secret
in_b offset) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 4) 16) (va_QEmpty (())))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_3_7_11_body va_b0 va_s0 i msg in_b offset =
let (va_mods:va_mods_t) = [va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg] in
let va_qc = va_qcode_Loop_rounds_3_7_11_body va_mods i msg in_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_3_7_11_body i msg) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 55 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 76 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 77 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 16))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_3_7_11_body (va_code_Loop_rounds_3_7_11_body i msg)
va_s0 i msg in_b offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok va_sM (va_update_operand_vec_opr
msg va_sM va_s0))));
va_lemma_norm_mods ([va_Mod_reg 4; va_mod_vec_opr msg]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_1_15_shift_body
val va_code_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 1) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1
msg1 4) (va_CNil ())) else va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block
(va_CCons (va_code_Vsldoi msg0 msg1 msg1 8) (va_CNil ())) else va_Block (va_CCons (if (i
`op_Modulus` 4 = 3) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1 msg1 12) (va_CNil ()))
else va_Block (va_CNil ())) (va_CNil ()))) (va_CNil ()))) (va_CNil ())))
val va_codegen_success_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_pbool_and (if (i `op_Modulus` 4 = 1) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1
msg1 4) (va_ttrue ()) else va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Vsldoi msg0 msg1 msg1 8) (va_ttrue ()) else va_pbool_and (if (i
`op_Modulus` 4 = 3) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1 msg1 12) (va_ttrue
()) else va_ttrue ()) (va_ttrue ())) (va_ttrue ())) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_1_15_shift_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(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 100 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 1) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 102 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 4) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 104 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 106 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 8) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 108 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 3) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 110 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 12) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) (fun (va_s:va_state) va_g ->
va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_rounds_1_15_shift_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_1_15_shift_body va_b0 va_s0 i msg0 msg1 block =
let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_1_15_shift_body va_mods i msg0 msg1 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 83 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 98 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (forall (va_x_msg0:va_value_vec_opr) . let
va_sM = va_upd_operand_vec_opr msg0 va_x_msg0 va_s0 in va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_1_15_shift_body (va_code_Loop_rounds_1_15_shift_body i
msg0 msg1) va_s0 i msg0 msg1 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)));
va_lemma_norm_mods ([va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr)
(msg1:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(va_QProc (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) ([va_mod_vec_opr msg0])
(va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block) (va_wpProof_Loop_rounds_1_15_shift_body i
msg0 msg1 block))
//--
//-- Loop_rounds_16_63_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_Block (va_CCons (va_code_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1) (va_CCons
(va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_CCons (va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vadduwm msg0 msg0 msg2) (va_CNil ())))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)
(va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_codegen_success_Vadduwm msg0
msg0 (va_op_vec_opr_vec 25))) (va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_codegen_success_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3))
(va_pbool_and (va_pbool_and (va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 msg2) (va_codegen_success_Vadduwm msg0 msg0 msg2))
(va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_63_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(msg2:vec_opr) (msg3:vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(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 145 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 146 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_0_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 147 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 148 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 149 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_1_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 150 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 151 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 msg2) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_ws_opaque block i) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_63_body va_b0 va_s0 i msg0 msg1 msg2 msg3 block =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_16_63_body va_mods i msg0 msg1 msg2 msg3 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2
msg3) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 114 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 140 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i -
16)) sigma0) sigma1) (ws_opaque block (i - 7))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 143 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_63_body (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) va_s0 i msg0 msg1 msg2 msg3 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_63_body
val va_code_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr ->
b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_Block (va_CCons (va_code_Vadduwm h_vec h_vec msg) (va_CCons (va_code_Vsel (va_op_vec_opr_vec
25) g_vec f_vec e_vec) (va_CCons (if op_disEquality i 63 then va_Block (va_CCons
(va_code_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_CNil ())) else va_Block (va_CNil ()))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_Sigma1
(va_op_vec_opr_vec 26) e_vec) (va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_CCons (va_code_Vsel
(va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_Vadduwm d_vec
d_vec h_vec) (va_CCons (va_code_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_CCons
(va_code_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_CCons (if (i = 63) then
va_Block (va_CNil ()) else va_Block (va_CNil ())) (va_CNil ())))))))))))))))
val va_codegen_success_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr ->
a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr ->
d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr ->
g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec msg) (va_pbool_and (va_codegen_success_Vsel
(va_op_vec_opr_vec 25) g_vec f_vec e_vec) (va_pbool_and (if op_disEquality i 63 then
va_pbool_and (va_codegen_success_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_ttrue ()) else
va_ttrue ()) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec) (va_pbool_and
(va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_pbool_and
(va_codegen_success_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_Vadduwm d_vec d_vec h_vec) (va_pbool_and
(va_codegen_success_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_pbool_and
(va_codegen_success_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec
25)) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_pbool_and (if (i = 63) then va_ttrue () else va_ttrue ()) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_63_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (a_vec:vec_opr)
(b_vec:vec_opr) (c_vec:vec_opr) (d_vec:vec_opr) (e_vec:vec_opr) (f_vec:vec_opr) (g_vec:vec_opr)
(h_vec:vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode unit
(va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(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 227 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec msg) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 228 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) g_vec f_vec e_vec) (fun (va_s:va_state) _ -> let
(va_arg53:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s e_vec) in let (va_arg52:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s g_vec) in let
(va_arg51:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s f_vec) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_vsel32 va_arg51 va_arg52 va_arg53)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 230 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (op_disEquality i 63) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 232 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 234 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg50:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg49:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg48:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 236 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_1_partial va_arg48 va_arg49
va_arg50) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 238 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 239 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (fun (va_s:va_state)
_ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 240 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg47:Vale.Def.Words_s.nat32)
= Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s c_vec) in let
(va_arg46:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s b_vec) in let (va_arg45:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s a_vec) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 241 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_eq_maj_xvsel32 va_arg45 va_arg46 va_arg47)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 242 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm d_vec d_vec h_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 243 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg44:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg43:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg42:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 244 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_0_partial va_arg42 va_arg43
va_arg44) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 245 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 246 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (fun (va_s:va_state) _ -> let
(va_arg41:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg40:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg39:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 247 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_shuffle_core_properties va_arg39 va_arg40
va_arg41) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i = 63) (qblock va_mods (fun (va_s:va_state) -> let
(va_arg38:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s g_vec in let
(va_arg37:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s f_vec in let
(va_arg36:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s e_vec in let
(va_arg35:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s d_vec in let
(va_arg34:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s c_vec in let
(va_arg33:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s b_vec in let
(va_arg32:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s a_vec in let
(va_arg31:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s h_vec in let
(va_arg30:Vale.SHA.PPC64LE.SHA_helpers.hash256) =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 250 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_make_seperated_hash va_arg30 va_arg31
va_arg32 va_arg33 va_arg34 va_arg35 va_arg36 va_arg37 va_arg38) (va_QEmpty (())))) (qblock
va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Loop_rounds_0_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr ->
c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr ->
f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> k_b:buffer128
-> block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec
e_vec f_vec g_vec h_vec) va_s0 /\ va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0
/\ va_is_src_vec_opr b_vec va_s0 /\ va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec
va_s0 /\ va_is_src_vec_opr e_vec va_s0 /\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr
g_vec va_s0 /\ va_is_dst_vec_opr h_vec va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\
msg == i `op_Modulus` 16 /\ (i `op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec ==
18 /\ d_vec == 19 /\ e_vec == 20 /\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i
`op_Modulus` 8 == 1 ==> a_vec == 23 /\ b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19
/\ f_vec == 20 /\ g_vec == 21 /\ h_vec == 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\
b_vec == 23 /\ c_vec == 16 /\ d_vec == 17 /\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec
== 21) /\ (i `op_Modulus` 8 == 3 ==> a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16
/\ e_vec == 17 /\ f_vec == 18 /\ g_vec == 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==>
a_vec == 20 /\ b_vec == 21 /\ c_vec == 22 /\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec
== 18 /\ h_vec == 19) /\ (i `op_Modulus` 8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21
/\ d_vec == 22 /\ e_vec == 23 /\ f_vec == 16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus`
8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\ c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec ==
23 /\ g_vec == 16 /\ h_vec == 17) /\ (i `op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\
c_vec == 19 /\ d_vec == 20 /\ e_vec == 21 /\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let
ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in let h_k =
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_63_body va_b0 va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec
h_vec k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec] in
let va_qc = va_qcode_Loop_rounds_0_63_body va_mods i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_63_body i msg a_vec b_vec
c_vec d_vec e_vec f_vec g_vec h_vec) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 205 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in label va_range1
"***** POSTCONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let h_k = Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in label va_range1
"***** POSTCONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in label va_range1
"***** POSTCONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let maj = Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 212 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0_maj = Vale.Arch.Types.add_wrap32 sigma0 maj in label va_range1
"***** POSTCONDITION NOT MET AT line 213 column 137 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM d_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 214 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 215 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 225 column 145 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i == 63 ==> Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM
h_vec) (va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM
c_vec) (va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM
f_vec) (va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0 /\ va_is_src_vec_opr b_vec va_s0 /\
va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec va_s0 /\ va_is_src_vec_opr e_vec va_s0
/\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr g_vec va_s0 /\ va_is_dst_vec_opr h_vec
va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\ msg == i `op_Modulus` 16 /\ (i
`op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec == 18 /\ d_vec == 19 /\ e_vec == 20
/\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i `op_Modulus` 8 == 1 ==> a_vec == 23 /\
b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19 /\ f_vec == 20 /\ g_vec == 21 /\ h_vec
== 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\ b_vec == 23 /\ c_vec == 16 /\ d_vec == 17
/\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec == 21) /\ (i `op_Modulus` 8 == 3 ==>
a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16 /\ e_vec == 17 /\ f_vec == 18 /\ g_vec
== 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==> a_vec == 20 /\ b_vec == 21 /\ c_vec == 22
/\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec == 18 /\ h_vec == 19) /\ (i `op_Modulus`
8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21 /\ d_vec == 22 /\ e_vec == 23 /\ f_vec ==
16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus` 8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\
c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec == 23 /\ g_vec == 16 /\ h_vec == 17) /\ (i
`op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\ c_vec == 19 /\ d_vec == 20 /\ e_vec == 21
/\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))))) /\ (forall (va_x_d_vec:va_value_vec_opr)
(va_x_g_vec:va_value_vec_opr) (va_x_h_vec:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32)
. let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr h_vec
va_x_h_vec (va_upd_operand_vec_opr g_vec va_x_g_vec (va_upd_operand_vec_opr d_vec va_x_d_vec
va_s0)))) in va_get_ok va_sM /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i
block hash_orig in let h_k = Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr
-> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec
f_vec g_vec h_vec k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr
h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_63_body (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec;
va_mod_vec_opr d_vec]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode
unit (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(va_QProc (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)
([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr
d_vec]) (va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig) (va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig))
//--
//-- Loop_round_0_61_body
val va_code_Loop_round_0_61_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_round_0_61_body i =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block (va_CCons
(va_code_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_CNil ()))) else va_Block (va_CCons (va_code_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_CNil ()))) (va_CNil
())))
val va_codegen_success_Loop_round_0_61_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_round_0_61_body i =
(va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_ttrue ())) else va_pbool_and (va_codegen_success_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_ttrue ()))
(va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_round_0_61_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(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 276 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 278 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret k_b ((i + 2) `op_Division` 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 16) (va_QEmpty (()))))) (qblock
va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 283 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4)
(va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_round_0_61_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_round_0_61_body i) va_s0 /\ va_get_ok va_s0 /\
(l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2)
`op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) /\
va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM va_s0)))))
[@"opaque_to_smt"]
let va_lemma_Loop_round_0_61_body va_b0 va_s0 i k_b =
let (va_mods:va_mods_t) = [va_Mod_vec 24; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_round_0_61_body va_mods i k_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_round_0_61_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 254 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 270 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 271 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 272 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 273 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 274 column 97 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ 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_vec 24; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_round_0_61_body (i:nat) (k_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b
((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==>
(va_get_vec 24 va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24
va_s0).hi2 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks))) /\ (forall (va_x_r6:nat64) (va_x_v24:quad32) .
let va_sM = va_upd_vec 24 va_x_v24 (va_upd_reg 6 va_x_r6 va_s0) in va_get_ok va_sM /\ (let ks =
Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_sM) in
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) ==>
va_k va_sM (())))
val va_wpProof_Loop_round_0_61_body : i:nat -> k_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_Loop_round_0_61_body i k_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_round_0_61_body i) ([va_Mod_vec
24; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_round_0_61_body i k_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_round_0_61_body (va_code_Loop_round_0_61_body i) va_s0 i k_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM
va_s0))));
va_lemma_norm_mods ([va_Mod_vec 24; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_round_0_61_body (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(va_QProc (va_code_Loop_round_0_61_body i) ([va_Mod_vec 24; va_Mod_reg 6])
(va_wp_Loop_round_0_61_body i k_b) (va_wpProof_Loop_round_0_61_body i k_b))
//--
//-- Loop_rounds_0_59_a
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_a i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_a i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_a (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(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 336 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 337 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 338 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 339 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 340 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 341 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 342 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 343 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_59_a va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_a va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_a i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_59_a i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_59_a (va_code_Loop_rounds_0_59_a i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_59_b
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_b i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_b i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_b (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_b i)) =
(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 395 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 396 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 397 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 398 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 399 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 6) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 400 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 401 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 7) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 402 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (()))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.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.SHA.PPC64LE.Rounds.Core.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": 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": 2000,
"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 ->
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"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_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"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",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Addition",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.SHA.PPC64LE.Rounds.Core.va_qcode_Loop_rounds_0_59_b"
] | [] | false | false | false | false | false | let va_lemma_Loop_rounds_0_59_b va_b0 va_s0 i k_b block hash_orig =
| let va_mods:va_mods_t =
[
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
]
in
let va_qc = va_qcode_Loop_rounds_0_59_b va_mods i k_b block hash_orig in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Loop_rounds_0_59_b i)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 346 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\
(label va_range1
"***** POSTCONDITION NOT MET AT line 382 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 383 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
label va_range1
"***** POSTCONDITION NOT MET AT line 392 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig
in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 393 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7))))
))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
FStar.Map.fsti | FStar.Map.const_on | val const_on (#key: eqtype) (#value: Type) (dom: S.set key) (v: value) : t key value | val const_on (#key: eqtype) (#value: Type) (dom: S.set key) (v: value) : t key value | let const_on (#key:eqtype) (#value:Type) (dom:S.set key) (v:value)
: t key value
= restrict dom (const v) | {
"file_name": "ulib/FStar.Map.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 77,
"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.
*)
(**
@summary FStar.Map provides a polymorphic, partial map from keys to
values, where keys support decidable equality.
`m:Map.t key value` is a partial map from `key` to `value`
A distinctive feature of the library is in its model of partiality.
A map can be seen as a pair of:
1. a total map `key -> Tot value`
2. a set of keys that record the domain of the map
*)
module FStar.Map
module S = FStar.Set
(* Map.t key value: The main type provided by this module *)
val t (key:eqtype) ([@@@strictly_positive] value:Type u#a)
: Type u#a
(* sel m k : Look up key `k` in map `m` *)
val sel: #key:eqtype -> #value:Type -> t key value -> key -> Tot value
(* upd m k v : A map identical to `m` except mapping `k` to `v` *)
val upd: #key:eqtype -> #value:Type -> t key value -> key -> value -> Tot (t key value)
(* const v : A constant map mapping all keys to `v` *)
val const: #key:eqtype -> #value:Type -> value -> Tot (t key value)
(* domain m : The set of keys on which this partial map is defined *)
val domain: #key:eqtype -> #value:Type -> t key value -> Tot (S.set key)
(* contains m k: Decides if key `k` is in the map `m` *)
val contains: #key:eqtype -> #value:Type -> t key value -> key -> Tot bool
(* concat m1 m2 :
A map whose domain is the union of the domains of `m1` and `m2`.
Maps every key `k` in the domain of `m1` to `sel m1 k`
and all other keys to `sel m2 k`.
*)
val concat: #key:eqtype -> #value:Type -> t key value -> t key value -> Tot (t key value)
(* map_val f m:
A map whose domain is the same as `m` but all values have
`f` applied to them.
*)
val map_val: #val1:Type -> #val2:Type -> f:(val1 -> val2) -> #key:eqtype -> t key val1 -> Tot (t key val2)
(* restrict s m:
Restricts the domain of `m` to (domain m `intersect` s)
*)
val restrict: #key:eqtype -> #value:Type -> S.set key -> t key value -> Tot (t key value)
(* const_on dom v: A defined notion, for convenience
A partial constant map on dom | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Map.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Set",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | dom: FStar.Set.set key -> v: value -> FStar.Map.t key value | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Set.set",
"FStar.Map.restrict",
"FStar.Map.const",
"FStar.Map.t"
] | [] | false | false | false | false | false | let const_on (#key: eqtype) (#value: Type) (dom: S.set key) (v: value) : t key value =
| restrict dom (const v) | false |
Vale.SHA.PPC64LE.Rounds.Core.fst | Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_0_59_a | val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | val va_lemma_Loop_rounds_0_59_a : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_59_a i) va_s0 /\ va_get_ok va_s0 /\
(l_or (l_or (l_or (i == 0) (i == 16)) (i == 32)) (i == 48) /\ va_get_reg 6 va_s0 + 16 < pow2_64
/\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 1 (va_get_mem_layout va_s0) Secret /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i))) /\
l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
i) ((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 1)))
((va_get_vec 2 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 2)))
((va_get_vec 3 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block (i + 3)) /\ l_and
(l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 2))) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 3))))))
(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 6 va_s0 + 16 /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i
+ 5)) ((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))) /\ va_state_eq
va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23
va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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_reg 6
va_sM (va_update_ok va_sM va_s0))))))))))))))) | let va_lemma_Loop_rounds_0_59_a va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_59_a va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_59_a i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 333 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
4)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6))) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.Core.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1047,
"start_col": 0,
"start_line": 1005
} | module Vale.SHA.PPC64LE.Rounds.Core
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_3_7_11_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_3_7_11_body i msg =
(va_Block (va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_CNil ()))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_3_7_11_body i msg =
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 4) 16) (va_ttrue ())))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_3_7_11_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (in_b:buffer128)
(offset:nat) : (va_quickCode unit (va_code_Loop_rounds_3_7_11_body i msg)) =
(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 79 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) msg (va_op_reg_opr_reg 4) Secret
in_b offset) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 4) 16) (va_QEmpty (())))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_3_7_11_body va_b0 va_s0 i msg in_b offset =
let (va_mods:va_mods_t) = [va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg] in
let va_qc = va_qcode_Loop_rounds_3_7_11_body va_mods i msg in_b offset in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_3_7_11_body i msg) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 55 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 76 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_eval_vec_opr va_sM msg == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read in_b offset (va_get_mem_heaplet 0 va_sM))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 77 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 16))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_reg 4; va_Mod_ok; va_mod_vec_opr msg]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_3_7_11_body i msg in_b offset va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_3_7_11_body (va_code_Loop_rounds_3_7_11_body i msg)
va_s0 i msg in_b offset in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_reg 4 va_sM (va_update_ok va_sM (va_update_operand_vec_opr
msg va_sM va_s0))));
va_lemma_norm_mods ([va_Mod_reg 4; va_mod_vec_opr msg]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_1_15_shift_body
val va_code_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 1) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1
msg1 4) (va_CNil ())) else va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block
(va_CCons (va_code_Vsldoi msg0 msg1 msg1 8) (va_CNil ())) else va_Block (va_CCons (if (i
`op_Modulus` 4 = 3) then va_Block (va_CCons (va_code_Vsldoi msg0 msg1 msg1 12) (va_CNil ()))
else va_Block (va_CNil ())) (va_CNil ()))) (va_CNil ()))) (va_CNil ())))
val va_codegen_success_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_1_15_shift_body i msg0 msg1 =
(va_pbool_and (if (i `op_Modulus` 4 = 1) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1
msg1 4) (va_ttrue ()) else va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Vsldoi msg0 msg1 msg1 8) (va_ttrue ()) else va_pbool_and (if (i
`op_Modulus` 4 = 3) then va_pbool_and (va_codegen_success_Vsldoi msg0 msg1 msg1 12) (va_ttrue
()) else va_ttrue ()) (va_ttrue ())) (va_ttrue ())) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_1_15_shift_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(block:block_w) : (va_quickCode unit (va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(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 100 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 1) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 102 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 4) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 104 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 106 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 8) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 108 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 3) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 110 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi msg0 msg1 msg1 12) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))) (fun (va_s:va_state) va_g ->
va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_rounds_1_15_shift_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> block:block_w
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) va_s0 /\
va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_1_15_shift_body va_b0 va_s0 i msg0 msg1 block =
let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_1_15_shift_body va_mods i msg0 msg1 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 83 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 98 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr) (msg1:va_operand_vec_opr)
(block:block_w) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_vec_opr msg0 va_s0 /\ va_is_src_vec_opr msg1 va_s0 /\ va_get_ok va_s0 /\ l_and (l_and
(0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\ msg0 == i /\ msg1 == i - i `op_Modulus` 4 /\ (i
`op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)
== Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 2 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (i `op_Modulus` 4 == 3 ==>
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\ (forall (va_x_msg0:va_value_vec_opr) . let
va_sM = va_upd_operand_vec_opr msg0 va_x_msg0 va_s0 in va_get_ok va_sM /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_1_15_shift_body : i:nat -> msg0:va_operand_vec_opr ->
msg1:va_operand_vec_opr -> block:block_w -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_1_15_shift_body i msg0
msg1) ([va_mod_vec_opr msg0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_1_15_shift_body i msg0 msg1 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_1_15_shift_body (va_code_Loop_rounds_1_15_shift_body i
msg0 msg1) va_s0 i msg0 msg1 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0)));
va_lemma_norm_mods ([va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_1_15_shift_body (i:nat) (msg0:va_operand_vec_opr)
(msg1:va_operand_vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_1_15_shift_body i msg0 msg1)) =
(va_QProc (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) ([va_mod_vec_opr msg0])
(va_wp_Loop_rounds_1_15_shift_body i msg0 msg1 block) (va_wpProof_Loop_rounds_1_15_shift_body i
msg0 msg1 block))
//--
//-- Loop_rounds_16_63_body
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_Block (va_CCons (va_code_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1) (va_CCons
(va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_CCons (va_code_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vadduwm msg0 msg0 msg2) (va_CNil ())))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 =
(va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)
(va_codegen_success_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1)) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_codegen_success_Vadduwm msg0
msg0 (va_op_vec_opr_vec 25))) (va_pbool_and (va_pbool_and (va_codegen_success_SHA256_sigma1
(va_op_vec_opr_vec 26) msg3) (va_codegen_success_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3))
(va_pbool_and (va_pbool_and (va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))
(va_codegen_success_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26))) (va_pbool_and (va_pbool_and
(va_codegen_success_Vadduwm msg0 msg0 msg2) (va_codegen_success_Vadduwm msg0 msg0 msg2))
(va_ttrue ()))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_63_body (va_mods:va_mods_t) (i:nat) (msg0:vec_opr) (msg1:vec_opr)
(msg2:vec_opr) (msg3:vec_opr) (block:block_w) : (va_quickCode unit
(va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3)) =
(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 145 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma0 (va_op_vec_opr_vec 25) msg1 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 146 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_0_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 147 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 148 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_sigma1 (va_op_vec_opr_vec 26) msg3 i block) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 149 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_sigma_0_1_partial i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 150 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 (va_op_vec_opr_vec 26)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 151 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm msg0 msg0 msg2) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 152 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> lemma_ws_opaque block i) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_63_body va_b0 va_s0 i msg0 msg1 msg2 msg3 block =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0] in
let va_qc = va_qcode_Loop_rounds_16_63_body va_mods i msg0 msg1 msg2 msg3 block in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2
msg3) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 114 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 140 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in label va_range1
"***** POSTCONDITION NOT MET AT line 141 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 142 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i -
16)) sigma0) sigma1) (ws_opaque block (i - 7))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 143 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
((va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i)))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3 block va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_63_body (va_code_Loop_rounds_16_63_body i msg0 msg1
msg2 msg3) va_s0 i msg0 msg1 msg2 msg3 block in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr msg0 va_sM va_s0)))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr msg0]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_0_63_body
val va_code_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr ->
b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_Block (va_CCons (va_code_Vadduwm h_vec h_vec msg) (va_CCons (va_code_Vsel (va_op_vec_opr_vec
25) g_vec f_vec e_vec) (va_CCons (if op_disEquality i 63 then va_Block (va_CCons
(va_code_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_CNil ())) else va_Block (va_CNil ()))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_SHA256_Sigma1
(va_op_vec_opr_vec 26) e_vec) (va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_CCons (va_code_Vsel
(va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (va_CCons (va_code_Vadduwm d_vec
d_vec h_vec) (va_CCons (va_code_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_CCons
(va_code_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_CCons (va_code_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_CCons (if (i = 63) then
va_Block (va_CNil ()) else va_Block (va_CNil ())) (va_CNil ())))))))))))))))
val va_codegen_success_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr ->
a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr ->
d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr ->
g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec =
(va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec msg) (va_pbool_and (va_codegen_success_Vsel
(va_op_vec_opr_vec 25) g_vec f_vec e_vec) (va_pbool_and (if op_disEquality i 63 then
va_pbool_and (va_codegen_success_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_ttrue ()) else
va_ttrue ()) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec) (va_pbool_and
(va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_pbool_and
(va_codegen_success_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25))
(va_pbool_and (va_codegen_success_Vadduwm d_vec d_vec h_vec) (va_pbool_and
(va_codegen_success_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec) (va_pbool_and
(va_codegen_success_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec
25)) (va_pbool_and (va_codegen_success_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26))
(va_pbool_and (if (i = 63) then va_ttrue () else va_ttrue ()) (va_ttrue ()))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_63_body (va_mods:va_mods_t) (i:nat) (msg:vec_opr) (a_vec:vec_opr)
(b_vec:vec_opr) (c_vec:vec_opr) (d_vec:vec_opr) (e_vec:vec_opr) (f_vec:vec_opr) (g_vec:vec_opr)
(h_vec:vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode unit
(va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(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 227 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec msg) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 228 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) g_vec f_vec e_vec) (fun (va_s:va_state) _ -> let
(va_arg53:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s e_vec) in let (va_arg52:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s g_vec) in let
(va_arg51:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s f_vec) in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 229 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_vsel32 va_arg51 va_arg52 va_arg53)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 230 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (op_disEquality i 63) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 232 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm g_vec g_vec (va_op_vec_opr_vec 24)) (va_QEmpty (())))) (qblock va_mods (fun
(va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 234 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 25)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 235 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma1 (va_op_vec_opr_vec 26) e_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg50:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg49:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg48:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 236 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_1_partial va_arg48 va_arg49
va_arg50) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 238 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 25) a_vec b_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 239 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsel (va_op_vec_opr_vec 25) b_vec c_vec (va_op_vec_opr_vec 25)) (fun (va_s:va_state)
_ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 240 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg47:Vale.Def.Words_s.nat32)
= Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s c_vec) in let
(va_arg46:Vale.Def.Words_s.nat32) = Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr
va_old_s b_vec) in let (va_arg45:Vale.Def.Words_s.nat32) =
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_old_s a_vec) in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 241 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_eq_maj_xvsel32 va_arg45 va_arg46 va_arg47)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 242 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm d_vec d_vec h_vec) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 243 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_SHA256_Sigma0 (va_op_vec_opr_vec 26) a_vec i block hash_orig) (fun (va_s:va_state) _
-> let (va_arg44:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg43:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg42:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 244 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_sigma_1_0_partial va_arg42 va_arg43
va_arg44) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 245 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 26) (va_op_vec_opr_vec 25))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 246 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vadduwm h_vec h_vec (va_op_vec_opr_vec 26)) (fun (va_s:va_state) _ -> let
(va_arg41:Vale.SHA.PPC64LE.SHA_helpers.hash256) = hash_orig in let
(va_arg40:Vale.SHA.PPC64LE.SHA_helpers.block_w) = block in let
(va_arg39:Vale.SHA.PPC64LE.SHA_helpers.counter) = i in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 247 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_shuffle_core_properties va_arg39 va_arg40
va_arg41) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 248 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i = 63) (qblock va_mods (fun (va_s:va_state) -> let
(va_arg38:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s g_vec in let
(va_arg37:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s f_vec in let
(va_arg36:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s e_vec in let
(va_arg35:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s d_vec in let
(va_arg34:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s c_vec in let
(va_arg33:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s b_vec in let
(va_arg32:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s a_vec in let
(va_arg31:Vale.Def.Types_s.quad32) = va_eval_vec_opr va_s h_vec in let
(va_arg30:Vale.SHA.PPC64LE.SHA_helpers.hash256) =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 250 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_make_seperated_hash va_arg30 va_arg31
va_arg32 va_arg33 va_arg34 va_arg35 va_arg36 va_arg37 va_arg38) (va_QEmpty (())))) (qblock
va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QEmpty
(()))))))))))))))))))))))
val va_lemma_Loop_rounds_0_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->
msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr -> b_vec:va_operand_vec_opr ->
c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr -> e_vec:va_operand_vec_opr ->
f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr -> h_vec:va_operand_vec_opr -> k_b:buffer128
-> block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec
e_vec f_vec g_vec h_vec) va_s0 /\ va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0
/\ va_is_src_vec_opr b_vec va_s0 /\ va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec
va_s0 /\ va_is_src_vec_opr e_vec va_s0 /\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr
g_vec va_s0 /\ va_is_dst_vec_opr h_vec va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\
msg == i `op_Modulus` 16 /\ (i `op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec ==
18 /\ d_vec == 19 /\ e_vec == 20 /\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i
`op_Modulus` 8 == 1 ==> a_vec == 23 /\ b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19
/\ f_vec == 20 /\ g_vec == 21 /\ h_vec == 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\
b_vec == 23 /\ c_vec == 16 /\ d_vec == 17 /\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec
== 21) /\ (i `op_Modulus` 8 == 3 ==> a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16
/\ e_vec == 17 /\ f_vec == 18 /\ g_vec == 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==>
a_vec == 20 /\ b_vec == 21 /\ c_vec == 22 /\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec
== 18 /\ h_vec == 19) /\ (i `op_Modulus` 8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21
/\ d_vec == 22 /\ e_vec == 23 /\ f_vec == 16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus`
8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\ c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec ==
23 /\ g_vec == 16 /\ h_vec == 17) /\ (i `op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\
c_vec == 19 /\ d_vec == 20 /\ e_vec == 21 /\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let
ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in let h_k =
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) /\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok
va_sM (va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_63_body va_b0 va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec
h_vec k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec] in
let va_qc = va_qcode_Loop_rounds_0_63_body va_mods i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_63_body i msg a_vec b_vec
c_vec d_vec e_vec f_vec g_vec h_vec) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 205 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in label va_range1
"***** POSTCONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let h_k = Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in label va_range1
"***** POSTCONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in label va_range1
"***** POSTCONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma1 = Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0 = Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let maj = Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in label va_range1
"***** POSTCONDITION NOT MET AT line 212 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let sigma0_maj = Vale.Arch.Types.add_wrap32 sigma0 maj in label va_range1
"***** POSTCONDITION NOT MET AT line 213 column 137 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM d_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 214 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 215 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 224 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i =!= 63 ==> (let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block
hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 225 column 145 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i == 63 ==> Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM
h_vec) (va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM
c_vec) (va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM
f_vec) (va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr h_vec;
va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_src_vec_opr msg va_s0 /\ va_is_src_vec_opr a_vec va_s0 /\ va_is_src_vec_opr b_vec va_s0 /\
va_is_src_vec_opr c_vec va_s0 /\ va_is_dst_vec_opr d_vec va_s0 /\ va_is_src_vec_opr e_vec va_s0
/\ va_is_src_vec_opr f_vec va_s0 /\ va_is_dst_vec_opr g_vec va_s0 /\ va_is_dst_vec_opr h_vec
va_s0 /\ va_get_ok va_s0 /\ (l_and (0 <= i) (i < 64) /\ msg == i `op_Modulus` 16 /\ (i
`op_Modulus` 8 == 0 ==> a_vec == 16 /\ b_vec == 17 /\ c_vec == 18 /\ d_vec == 19 /\ e_vec == 20
/\ f_vec == 21 /\ g_vec == 22 /\ h_vec == 23) /\ (i `op_Modulus` 8 == 1 ==> a_vec == 23 /\
b_vec == 16 /\ c_vec == 17 /\ d_vec == 18 /\ e_vec == 19 /\ f_vec == 20 /\ g_vec == 21 /\ h_vec
== 22) /\ (i `op_Modulus` 8 == 2 ==> a_vec == 22 /\ b_vec == 23 /\ c_vec == 16 /\ d_vec == 17
/\ e_vec == 18 /\ f_vec == 19 /\ g_vec == 20 /\ h_vec == 21) /\ (i `op_Modulus` 8 == 3 ==>
a_vec == 21 /\ b_vec == 22 /\ c_vec == 23 /\ d_vec == 16 /\ e_vec == 17 /\ f_vec == 18 /\ g_vec
== 19 /\ h_vec == 20) /\ (i `op_Modulus` 8 == 4 ==> a_vec == 20 /\ b_vec == 21 /\ c_vec == 22
/\ d_vec == 23 /\ e_vec == 16 /\ f_vec == 17 /\ g_vec == 18 /\ h_vec == 19) /\ (i `op_Modulus`
8 == 5 ==> a_vec == 19 /\ b_vec == 20 /\ c_vec == 21 /\ d_vec == 22 /\ e_vec == 23 /\ f_vec ==
16 /\ g_vec == 17 /\ h_vec == 18) /\ (i `op_Modulus` 8 == 6 ==> a_vec == 18 /\ b_vec == 19 /\
c_vec == 20 /\ d_vec == 21 /\ e_vec == 22 /\ f_vec == 23 /\ g_vec == 16 /\ h_vec == 17) /\ (i
`op_Modulus` 8 == 7 ==> a_vec == 17 /\ b_vec == 18 /\ c_vec == 19 /\ d_vec == 20 /\ e_vec == 21
/\ f_vec == 22 /\ g_vec == 23 /\ h_vec == 16) /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i block hash_orig in
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 a_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 0) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 3) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 5) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 g_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6) /\ Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_s0 h_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_s0 msg) ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\ (i =!= 63 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))))) /\ (forall (va_x_d_vec:va_value_vec_opr)
(va_x_g_vec:va_value_vec_opr) (va_x_h_vec:va_value_vec_opr) (va_x_v25:quad32) (va_x_v26:quad32)
. let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_operand_vec_opr h_vec
va_x_h_vec (va_upd_operand_vec_opr g_vec va_x_g_vec (va_upd_operand_vec_opr d_vec va_x_d_vec
va_s0)))) in va_get_ok va_sM /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale i
block hash_orig in let h_k = Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks i) in let
ch = Vale.SHA.PPC64LE.SHA_helpers.ch_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6)) in let sigma1 =
Vale.SHA2.Wrapper.sigma256_1_1 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 4)) in let sigma0 =
Vale.SHA2.Wrapper.sigma256_1_0 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) in let maj =
Vale.SHA.PPC64LE.SHA_helpers.maj_256 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0))
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1)) (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 2)) in let sigma0_maj =
Vale.Arch.Types.add_wrap32 sigma0 maj in Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.Arch.Types.add_wrap32
(Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3)) (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 h_k
(Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1) /\
Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32 (Vale.Arch.Types.add_wrap32
(Vale.Arch.Types.add_wrap32 h_k (Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) ch) sigma1)
sigma0_maj /\ (i =!= 63 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
g_vec) == Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 6))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 1))) /\ (i =!= 63 ==> (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 1) block hash_orig in l_and (l_and (l_and
(l_and (l_and (l_and (l_and (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM
a_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1)) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM b_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM c_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM d_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM e_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3
(va_eval_vec_opr va_sM f_vec) == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6)))
(Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM g_vec) ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i +
1)))) (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM h_vec) ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)))) /\ (i == 63 ==>
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_eval_vec_opr va_sM h_vec)
(va_eval_vec_opr va_sM a_vec) (va_eval_vec_opr va_sM b_vec) (va_eval_vec_opr va_sM c_vec)
(va_eval_vec_opr va_sM d_vec) (va_eval_vec_opr va_sM e_vec) (va_eval_vec_opr va_sM f_vec)
(va_eval_vec_opr va_sM g_vec) == Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block
hash_orig)) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_63_body : i:nat -> msg:va_operand_vec_opr -> a_vec:va_operand_vec_opr
-> b_vec:va_operand_vec_opr -> c_vec:va_operand_vec_opr -> d_vec:va_operand_vec_opr ->
e_vec:va_operand_vec_opr -> f_vec:va_operand_vec_opr -> g_vec:va_operand_vec_opr ->
h_vec:va_operand_vec_opr -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec
f_vec g_vec h_vec k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr
h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr d_vec]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_63_body (va_code_Loop_rounds_0_63_body i msg a_vec
b_vec c_vec d_vec e_vec f_vec g_vec h_vec) va_s0 i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_ok va_sM
(va_update_operand_vec_opr h_vec va_sM (va_update_operand_vec_opr g_vec va_sM
(va_update_operand_vec_opr d_vec va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec;
va_mod_vec_opr d_vec]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_63_body (i:nat) (msg:va_operand_vec_opr) (a_vec:va_operand_vec_opr)
(b_vec:va_operand_vec_opr) (c_vec:va_operand_vec_opr) (d_vec:va_operand_vec_opr)
(e_vec:va_operand_vec_opr) (f_vec:va_operand_vec_opr) (g_vec:va_operand_vec_opr)
(h_vec:va_operand_vec_opr) (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode
unit (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)) =
(va_QProc (va_code_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec)
([va_Mod_vec 26; va_Mod_vec 25; va_mod_vec_opr h_vec; va_mod_vec_opr g_vec; va_mod_vec_opr
d_vec]) (va_wp_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec g_vec h_vec k_b
block hash_orig) (va_wpProof_Loop_rounds_0_63_body i msg a_vec b_vec c_vec d_vec e_vec f_vec
g_vec h_vec k_b block hash_orig))
//--
//-- Loop_round_0_61_body
val va_code_Loop_round_0_61_body : i:nat -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_round_0_61_body i =
(va_Block (va_CCons (if (i `op_Modulus` 4 = 2) then va_Block (va_CCons
(va_code_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_CCons (va_code_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_CNil ()))) else va_Block (va_CCons (va_code_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_CNil ()))) (va_CNil
())))
val va_codegen_success_Loop_round_0_61_body : i:nat -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_round_0_61_body i =
(va_pbool_and (if (i `op_Modulus` 4 = 2) then va_pbool_and
(va_codegen_success_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret) (va_pbool_and (va_codegen_success_AddImm (va_op_reg_opr_reg 6)
(va_op_reg_opr_reg 6) 16) (va_ttrue ())) else va_pbool_and (va_codegen_success_Vsldoi
(va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4) (va_ttrue ()))
(va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_round_0_61_body (va_mods:va_mods_t) (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(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 276 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_qInlineIf va_mods (i `op_Modulus` 4 = 2) (qblock va_mods (fun (va_s:va_state) -> va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 278 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Load128_word4_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 24)
(va_op_reg_opr_reg 6) Secret k_b ((i + 2) `op_Division` 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_AddImm (va_op_reg_opr_reg 6) (va_op_reg_opr_reg 6) 16) (va_QEmpty (()))))) (qblock
va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 283 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) (va_op_vec_opr_vec 24) 4)
(va_QEmpty (()))))) (fun (va_s:va_state) va_g -> va_QEmpty (()))))
val va_lemma_Loop_round_0_61_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_round_0_61_body i) va_s0 /\ va_get_ok va_s0 /\
(l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2)
`op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in (i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) /\
va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM va_s0)))))
[@"opaque_to_smt"]
let va_lemma_Loop_round_0_61_body va_b0 va_s0 i k_b =
let (va_mods:va_mods_t) = [va_Mod_vec 24; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_round_0_61_body va_mods i k_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_round_0_61_body i) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 254 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 270 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0
va_sM) in label va_range1
"***** POSTCONDITION NOT MET AT line 271 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 272 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 273 column 122 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 274 column 97 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ 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_vec 24; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Loop_round_0_61_body (i:nat) (k_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_and (0 <= i) (i < 62) /\ (let ks = Vale.PPC64LE.Decls.buffer128_read k_b
((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_s0) in (i `op_Modulus` 4 == 0 ==>
(va_get_vec 24 va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24
va_s0).hi2 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 1 ==> (va_get_vec 24
va_s0).hi3 == Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks) /\ (i `op_Modulus` 4 == 2 ==>
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
((i + 2) `op_Division` 4) 1 (va_get_mem_layout va_s0) Secret /\ va_get_reg 6 va_s0 + 16 <
pow2_64) /\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_s0).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_s0).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_s0).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_s0).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks))) /\ (forall (va_x_r6:nat64) (va_x_v24:quad32) .
let va_sM = va_upd_vec 24 va_x_v24 (va_upd_reg 6 va_x_r6 va_s0) in va_get_ok va_sM /\ (let ks =
Vale.PPC64LE.Decls.buffer128_read k_b ((i + 2) `op_Division` 4) (va_get_mem_heaplet 0 va_sM) in
(i `op_Modulus` 4 == 0 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 1 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0) /\
(i `op_Modulus` 4 == 2 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo0 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16)
/\ (i `op_Modulus` 4 == 3 ==> (va_get_vec 24 va_sM).hi3 ==
Vale.Def.Words_s.__proj__Mkfour__item__lo1 ks /\ (va_get_vec 24 va_sM).hi2 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi2 ks /\ (va_get_vec 24 va_sM).lo1 ==
Vale.Def.Words_s.__proj__Mkfour__item__hi3 ks /\ va_get_reg 6 va_sM == va_get_reg 6 va_s0)) ==>
va_k va_sM (())))
val va_wpProof_Loop_round_0_61_body : i:nat -> k_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_Loop_round_0_61_body i k_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_round_0_61_body i) ([va_Mod_vec
24; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Loop_round_0_61_body i k_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_round_0_61_body (va_code_Loop_round_0_61_body i) va_s0 i k_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 24 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM
va_s0))));
va_lemma_norm_mods ([va_Mod_vec 24; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_round_0_61_body (i:nat) (k_b:buffer128) : (va_quickCode unit
(va_code_Loop_round_0_61_body i)) =
(va_QProc (va_code_Loop_round_0_61_body i) ([va_Mod_vec 24; va_Mod_reg 6])
(va_wp_Loop_round_0_61_body i k_b) (va_wpProof_Loop_round_0_61_body i k_b))
//--
//-- Loop_rounds_0_59_a
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_59_a i =
(va_Block (va_CCons (va_code_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)) (va_CCons
(va_code_Loop_round_0_61_body i) (va_CCons (va_code_Loop_rounds_0_63_body (i + 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22)) (va_CCons (va_code_Loop_round_0_61_body (i + 1)) (va_CCons
(va_code_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_CCons
(va_code_Loop_round_0_61_body (i + 2)) (va_CCons (va_code_Loop_rounds_0_63_body (i + 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20)) (va_CCons (va_code_Loop_round_0_61_body (i + 3)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_59_a i =
(va_pbool_and (va_codegen_success_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23))
(va_pbool_and (va_codegen_success_Loop_round_0_61_body i) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 1)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 2)) (va_pbool_and
(va_codegen_success_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)) (va_pbool_and
(va_codegen_success_Loop_round_0_61_body (i + 3)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_59_a (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_0_59_a i)) =
(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 336 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body i (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 16)
(va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20)
(va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 337 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body i k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 338 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 23)
(va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19)
(va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) (va_op_vec_opr_vec 22) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 339 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 1) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 340 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 22)
(va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17) (va_op_vec_opr_vec 18)
(va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) (va_op_vec_opr_vec 21) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 341 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 2) k_b) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 342 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_rounds_0_63_body (i + 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 21)
(va_op_vec_opr_vec 22) (va_op_vec_opr_vec 23) (va_op_vec_opr_vec 16) (va_op_vec_opr_vec 17)
(va_op_vec_opr_vec 18) (va_op_vec_opr_vec 19) (va_op_vec_opr_vec 20) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 343 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_quick_Loop_round_0_61_body (i + 3) k_b) (va_QEmpty (()))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.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.SHA.PPC64LE.Rounds.Core.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds",
"short_module": null
},
{
"abbrev": 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": 2000,
"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 ->
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"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_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"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",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Addition",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.SHA.PPC64LE.Rounds.Core.va_qcode_Loop_rounds_0_59_a"
] | [] | false | false | false | false | false | let va_lemma_Loop_rounds_0_59_a va_b0 va_s0 i k_b block hash_orig =
| let va_mods:va_mods_t =
[
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
]
in
let va_qc = va_qcode_Loop_rounds_0_59_a va_mods i k_b block hash_orig in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Loop_rounds_0_59_a i)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 287 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_ok va_sM) /\
(label va_range1
"***** POSTCONDITION NOT MET AT line 323 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 16) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 324 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
label va_range1
"***** POSTCONDITION NOT MET AT line 333 column 86 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale (i + 4) block hash_orig
in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 23 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 19 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 4)))) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 334 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 5))
((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 6)))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks (i + 7))))
))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 6;
va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
FStar.Map.fsti | FStar.Map.disjoint_dom | val disjoint_dom : m1: FStar.Map.t key value -> m2: FStar.Map.t key value -> Prims.logical | let disjoint_dom (#key:eqtype) (#value:Type) (m1:t key value) (m2:t key value)
= forall x.{:pattern (contains m1 x)(* ; (contains m2 x) *)} contains m1 x ==> not (contains m2 x) | {
"file_name": "ulib/FStar.Map.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 100,
"end_line": 88,
"start_col": 0,
"start_line": 87
} | (*
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.
*)
(**
@summary FStar.Map provides a polymorphic, partial map from keys to
values, where keys support decidable equality.
`m:Map.t key value` is a partial map from `key` to `value`
A distinctive feature of the library is in its model of partiality.
A map can be seen as a pair of:
1. a total map `key -> Tot value`
2. a set of keys that record the domain of the map
*)
module FStar.Map
module S = FStar.Set
(* Map.t key value: The main type provided by this module *)
val t (key:eqtype) ([@@@strictly_positive] value:Type u#a)
: Type u#a
(* sel m k : Look up key `k` in map `m` *)
val sel: #key:eqtype -> #value:Type -> t key value -> key -> Tot value
(* upd m k v : A map identical to `m` except mapping `k` to `v` *)
val upd: #key:eqtype -> #value:Type -> t key value -> key -> value -> Tot (t key value)
(* const v : A constant map mapping all keys to `v` *)
val const: #key:eqtype -> #value:Type -> value -> Tot (t key value)
(* domain m : The set of keys on which this partial map is defined *)
val domain: #key:eqtype -> #value:Type -> t key value -> Tot (S.set key)
(* contains m k: Decides if key `k` is in the map `m` *)
val contains: #key:eqtype -> #value:Type -> t key value -> key -> Tot bool
(* concat m1 m2 :
A map whose domain is the union of the domains of `m1` and `m2`.
Maps every key `k` in the domain of `m1` to `sel m1 k`
and all other keys to `sel m2 k`.
*)
val concat: #key:eqtype -> #value:Type -> t key value -> t key value -> Tot (t key value)
(* map_val f m:
A map whose domain is the same as `m` but all values have
`f` applied to them.
*)
val map_val: #val1:Type -> #val2:Type -> f:(val1 -> val2) -> #key:eqtype -> t key val1 -> Tot (t key val2)
(* restrict s m:
Restricts the domain of `m` to (domain m `intersect` s)
*)
val restrict: #key:eqtype -> #value:Type -> S.set key -> t key value -> Tot (t key value)
(* const_on dom v: A defined notion, for convenience
A partial constant map on dom
*)
let const_on (#key:eqtype) (#value:Type) (dom:S.set key) (v:value)
: t key value
= restrict dom (const v)
(* map_literal f: A map that is extensionally equal to the function [f] *)
val map_literal (#k:eqtype) (#v:Type) (f: k -> Tot v)
: t k v
(* disjoint_dom m1 m2:
Disjoint domains. TODO: its pattern is biased towards `m1`. Why? | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Map.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Set",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | m1: FStar.Map.t key value -> m2: FStar.Map.t key value -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Map.t",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.b2t",
"FStar.Map.contains",
"Prims.op_Negation",
"Prims.logical"
] | [] | false | false | false | false | true | let disjoint_dom (#key: eqtype) (#value: Type) (m1 m2: t key value) =
| forall x. {:pattern (contains m1 x)} contains m1 x ==> not (contains m2 x) | false |
|
FStar.Map.fsti | FStar.Map.has_dom | val has_dom : m: FStar.Map.t key value -> dom: FStar.Set.set key -> Prims.logical | let has_dom (#key:eqtype) (#value:Type) (m:t key value) (dom:S.set key)
= forall x. contains m x <==> S.mem x dom | {
"file_name": "ulib/FStar.Map.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 92,
"start_col": 0,
"start_line": 91
} | (*
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.
*)
(**
@summary FStar.Map provides a polymorphic, partial map from keys to
values, where keys support decidable equality.
`m:Map.t key value` is a partial map from `key` to `value`
A distinctive feature of the library is in its model of partiality.
A map can be seen as a pair of:
1. a total map `key -> Tot value`
2. a set of keys that record the domain of the map
*)
module FStar.Map
module S = FStar.Set
(* Map.t key value: The main type provided by this module *)
val t (key:eqtype) ([@@@strictly_positive] value:Type u#a)
: Type u#a
(* sel m k : Look up key `k` in map `m` *)
val sel: #key:eqtype -> #value:Type -> t key value -> key -> Tot value
(* upd m k v : A map identical to `m` except mapping `k` to `v` *)
val upd: #key:eqtype -> #value:Type -> t key value -> key -> value -> Tot (t key value)
(* const v : A constant map mapping all keys to `v` *)
val const: #key:eqtype -> #value:Type -> value -> Tot (t key value)
(* domain m : The set of keys on which this partial map is defined *)
val domain: #key:eqtype -> #value:Type -> t key value -> Tot (S.set key)
(* contains m k: Decides if key `k` is in the map `m` *)
val contains: #key:eqtype -> #value:Type -> t key value -> key -> Tot bool
(* concat m1 m2 :
A map whose domain is the union of the domains of `m1` and `m2`.
Maps every key `k` in the domain of `m1` to `sel m1 k`
and all other keys to `sel m2 k`.
*)
val concat: #key:eqtype -> #value:Type -> t key value -> t key value -> Tot (t key value)
(* map_val f m:
A map whose domain is the same as `m` but all values have
`f` applied to them.
*)
val map_val: #val1:Type -> #val2:Type -> f:(val1 -> val2) -> #key:eqtype -> t key val1 -> Tot (t key val2)
(* restrict s m:
Restricts the domain of `m` to (domain m `intersect` s)
*)
val restrict: #key:eqtype -> #value:Type -> S.set key -> t key value -> Tot (t key value)
(* const_on dom v: A defined notion, for convenience
A partial constant map on dom
*)
let const_on (#key:eqtype) (#value:Type) (dom:S.set key) (v:value)
: t key value
= restrict dom (const v)
(* map_literal f: A map that is extensionally equal to the function [f] *)
val map_literal (#k:eqtype) (#v:Type) (f: k -> Tot v)
: t k v
(* disjoint_dom m1 m2:
Disjoint domains. TODO: its pattern is biased towards `m1`. Why?
*)
let disjoint_dom (#key:eqtype) (#value:Type) (m1:t key value) (m2:t key value)
= forall x.{:pattern (contains m1 x)(* ; (contains m2 x) *)} contains m1 x ==> not (contains m2 x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Map.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.FunctionalExtensionality",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Set",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | m: FStar.Map.t key value -> dom: FStar.Set.set key -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Map.t",
"FStar.Set.set",
"Prims.l_Forall",
"Prims.l_iff",
"Prims.b2t",
"FStar.Map.contains",
"FStar.Set.mem",
"Prims.logical"
] | [] | false | false | false | false | true | let has_dom (#key: eqtype) (#value: Type) (m: t key value) (dom: S.set key) =
| forall x. contains m x <==> S.mem x dom | false |
|
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_bound_f4_lt_pow12 | val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1) | val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1) | let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 140,
"start_col": 0,
"start_line": 139
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Spec.K256.Field52.Definitions.felem5
-> FStar.Pervasives.Lemma
(requires
(let _ = f in
(let FStar.Pervasives.Native.Mktuple5 #_ #_ #_ #_ #_ _ _ _ _ f4 = _ in
Hacl.Spec.K256.Field52.Definitions.felem_fits5 f (1, 1, 1, 1, 1) /\
Lib.IntTypes.v f4 < Prims.pow2 12)
<:
Type0)) (ensures Hacl.Spec.K256.Field52.Definitions.as_nat5 f <= Prims.pow2 220 - 1) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_bound_f4_lt_powa",
"Prims.unit"
] | [] | true | false | true | false | false | let lemma_as_nat_bound_f4_lt_pow12 f =
| lemma_as_nat_bound_f4_lt_powa f 12 | false |
ReifyLong.fst | ReifyLong.p1 | val p1 : x: FStar.DM4F.Heap.IntStoreFixed.id -> FStar.DM4F.IntStoreFixed.INT_STORE Prims.unit | let p1 x =
if is_x x 0 then write x 0 else write x 0;
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x) | {
"file_name": "examples/rel/ReifyLong.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 51,
"start_col": 1,
"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 ReifyLong
open FStar.DM4F.Heap.IntStoreFixed
open FStar.DM4F.IntStoreFixed
open Rel
(*
type label =
| Low
| High
type env = id -> Tot label
type low_equiv (env:env) (h : rel heap) =
forall (x:id). (Low? (env x) ==> sel (R?.l h) x = sel (R?.r h) x)
*)
let is_x (hi:id) (x:int) :INT_STORE bool (fun s0 p -> p ((index s0 hi = x), s0)) =
read hi = x | {
"checked_file": "/",
"dependencies": [
"Rel.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.DM4F.IntStoreFixed.fst.checked",
"FStar.DM4F.Heap.IntStoreFixed.fsti.checked"
],
"interface_file": false,
"source_file": "ReifyLong.fst"
} | [
{
"abbrev": false,
"full_module": "Rel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.DM4F.IntStoreFixed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.DM4F.Heap.IntStoreFixed",
"short_module": null
},
{
"abbrev": 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: FStar.DM4F.Heap.IntStoreFixed.id -> FStar.DM4F.IntStoreFixed.INT_STORE Prims.unit | FStar.DM4F.IntStoreFixed.INT_STORE | [] | [] | [
"FStar.DM4F.Heap.IntStoreFixed.id",
"FStar.DM4F.IntStoreFixed.write",
"Prims.unit",
"Prims.int",
"FStar.DM4F.IntStoreFixed.read",
"Prims.bool",
"ReifyLong.is_x"
] | [] | false | true | false | false | false | let p1 x =
| if is_x x 0 then write x 0 else write x 0;
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x);
write x (read x) | false |
|
Pulse.Checker.STApp.fst | Pulse.Checker.STApp.canon_comp | val canon_comp (c: comp_st) : comp_st | val canon_comp (c: comp_st) : comp_st | let canon_comp (c:comp_st) : comp_st =
match readback_comp (elab_comp c) with
| None -> c
| Some (C_Tot _) -> c //should be impossible
| Some c' -> c' | {
"file_name": "lib/steel/pulse/Pulse.Checker.STApp.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 17,
"end_line": 38,
"start_col": 0,
"start_line": 34
} | (*
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 Pulse.Checker.STApp
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module P = Pulse.Syntax.Printer
module Prover = Pulse.Checker.Prover
open Pulse.Show
let debug_log (g:env) (f:unit -> T.Tac unit) : T.Tac unit = if RU.debug_at_level (fstar_env g) "st_app" then f () else () | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Show.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.STApp.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Show",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Prover",
"short_module": "Prover"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Pulse.Syntax.Base.comp_st -> Pulse.Syntax.Base.comp_st | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.comp_st",
"Pulse.Readback.readback_comp",
"Pulse.Elaborate.Pure.elab_comp",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.comp",
"Prims.eq2",
"FStar.Stubs.Reflection.Types.term"
] | [] | false | false | false | true | false | let canon_comp (c: comp_st) : comp_st =
| match readback_comp (elab_comp c) with
| None -> c
| Some (C_Tot _) -> c
| Some c' -> c' | false |
Pulse.Checker.STApp.fst | Pulse.Checker.STApp.coerce_eq | val coerce_eq: #a: Type -> #b: Type -> x: a -> squash (a === b) -> y: b{y == x} | val coerce_eq: #a: Type -> #b: Type -> x: a -> squash (a === b) -> y: b{y == x} | let coerce_eq (#a #b:Type) (x:a) (_:squash (a === b)) : y:b { y == x } = x | {
"file_name": "lib/steel/pulse/Pulse.Checker.STApp.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 74,
"end_line": 59,
"start_col": 0,
"start_line": 59
} | (*
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 Pulse.Checker.STApp
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module P = Pulse.Syntax.Printer
module Prover = Pulse.Checker.Prover
open Pulse.Show
let debug_log (g:env) (f:unit -> T.Tac unit) : T.Tac unit = if RU.debug_at_level (fstar_env g) "st_app" then f () else ()
let canon_comp (c:comp_st) : comp_st =
match readback_comp (elab_comp c) with
| None -> c
| Some (C_Tot _) -> c //should be impossible
| Some c' -> c'
#push-options "--admit_smt_queries true"
let canon_comp_eq_res (g:env) (c:comp_st)
: RT.equiv (elab_env g) (elab_term (comp_res c)) (elab_term (comp_res (canon_comp c)))
= RT.Rel_refl _ _ _
#pop-options
let canonicalize_st_typing (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
: st_typing g t (canon_comp c)
= let c' = canon_comp c in
let x = fresh g in
assume ( ~(x `Set.mem` freevars (comp_post c)) /\
~(x `Set.mem` freevars (comp_post c')) );
assume (st_equiv_pre c c');
let st_eq
: st_equiv g c c'
= ST_VPropEquiv g c c' x (RU.magic ()) (RU.magic()) (RU.magic()) (canon_comp_eq_res g c) (RU.magic()) (RU.magic())
in
T_Equiv _ _ _ _ d st_eq | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Show.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.STApp.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Show",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Prover",
"short_module": "Prover"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: a -> _: Prims.squash (a === b) -> y: b{y == x} | Prims.Tot | [
"total"
] | [] | [
"Prims.squash",
"Prims.op_Equals_Equals_Equals",
"Prims.eq2"
] | [] | false | false | false | false | false | let coerce_eq (#a: Type) (#b: Type) (x: a) (_: squash (a === b)) : y: b{y == x} =
| x | false |
CDDLExtractionTest.BytesUnwrapped.fst | CDDLExtractionTest.BytesUnwrapped.impl_mytype | val impl_mytype:impl_typ bytes | val impl_mytype:impl_typ bytes | let impl_mytype : impl_typ bytes = impl_bytes () | {
"file_name": "share/steel/examples/pulse/dice/cbor/CDDLExtractionTest.BytesUnwrapped.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 48,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | (*
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 CDDLExtractionTest.BytesUnwrapped
open CBOR.Spec
open CDDL.Spec
open CBOR.Pulse
open CDDL.Pulse | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"CDDL.Spec.fsti.checked",
"CDDL.Pulse.fst.checked",
"CBOR.Spec.fsti.checked",
"CBOR.Pulse.fst.checked"
],
"interface_file": false,
"source_file": "CDDLExtractionTest.BytesUnwrapped.fst"
} | [
{
"abbrev": false,
"full_module": "CDDL.Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "CDDL.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CDDLExtractionTest",
"short_module": null
},
{
"abbrev": false,
"full_module": "CDDLExtractionTest",
"short_module": null
},
{
"abbrev": 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 | CDDL.Pulse.impl_typ CDDL.Spec.bytes | Prims.Tot | [
"total"
] | [] | [
"CDDL.Pulse.impl_bytes"
] | [] | false | false | false | true | false | let impl_mytype:impl_typ bytes =
| impl_bytes () | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_bound | val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256) | val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256) | let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 131,
"start_col": 0,
"start_line": 130
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Spec.K256.Field52.Definitions.felem5
-> FStar.Pervasives.Lemma
(requires Hacl.Spec.K256.Field52.Definitions.felem_fits5 f (1, 1, 1, 1, 1))
(ensures Hacl.Spec.K256.Field52.Definitions.as_nat5 f < Prims.pow2 256) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_bound_f4_lt_powa",
"Prims.unit"
] | [] | true | false | true | false | false | let lemma_as_nat_bound f =
| lemma_as_nat_bound_f4_lt_powa f 48 | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_mod2 | val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2) | val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2) | let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 26,
"start_col": 0,
"start_line": 18
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 -> | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Hacl.Spec.K256.Field52.Definitions.felem5
-> FStar.Pervasives.Lemma
(ensures
(let _ = x in
(let FStar.Pervasives.Native.Mktuple5 #_ #_ #_ #_ #_ x0 _ _ _ _ = _ in
Hacl.Spec.K256.Field52.Definitions.as_nat5 x % 2 = Lib.IntTypes.v x0 % 2)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Hacl.Spec.K256.Field52.Definitions.as_nat5",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.unit",
"Hacl.Spec.K256.MathLemmas.lemma_a_plus_b_pow2_mod2",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Hacl.Spec.K256.Field52.Definitions.pow52",
"Hacl.Spec.K256.Field52.Definitions.pow104",
"Hacl.Spec.K256.Field52.Definitions.pow156",
"Hacl.Spec.K256.Field52.Definitions.pow208"
] | [] | false | false | true | false | false | let lemma_as_nat_mod2 x =
| let x0, x1, x2, x3, x4 = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2) | false |
Vale.SHA.PPC64LE.Rounds.fsti | Vale.SHA.PPC64LE.Rounds.va_quick_Loop_rounds_48_63 | val va_quick_Loop_rounds_48_63 (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_48_63 ())) | val va_quick_Loop_rounds_48_63 (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_48_63 ())) | let va_quick_Loop_rounds_48_63 (k_b:buffer128) (block:block_w) (hash_orig:hash256) : (va_quickCode
unit (va_code_Loop_rounds_48_63 ())) =
(va_QProc (va_code_Loop_rounds_48_63 ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;
va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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
6]) (va_wp_Loop_rounds_48_63 k_b block hash_orig) (va_wpProof_Loop_rounds_48_63 k_b block
hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 15,
"end_line": 522,
"start_col": 0,
"start_line": 514
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> offset:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> input_BE:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3)))))
(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 6 va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48
/\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let
next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) /\ va_state_eq va_sM (va_update_vec 26 va_sM
(va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM
(va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_reg 4 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0) in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3))) /\ (forall (va_x_r4:nat64)
(va_x_r6: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_v20:quad32) (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32)
(va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22
(va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6 (va_upd_reg 4 va_x_r4
va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48 /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> offset:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> input_BE:(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_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6; va_Mod_reg 4]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6; va_Mod_reg 4])
(va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE) (va_wpProof_Loop_rounds_0_15
in_b offset k_b block hash_orig input_BE))
//--
//-- Loop_rounds_16_47
val va_code_Loop_rounds_16_47 : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_47 : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_47 : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_47 i) va_s0 /\ va_get_ok va_s0 /\ (l_or
(i == 16) (i == 32) /\ validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 4 (va_get_mem_layout va_s0) Secret /\ (let ks = buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in k_reqs ks /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ (let hash
= repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 16 va_s0).hi3 == word_to_nat32 (index hash 0)) ((va_get_vec 17 va_s0).hi3 ==
word_to_nat32 (index hash 1))) ((va_get_vec 18 va_s0).hi3 == word_to_nat32 (index hash 2)))
((va_get_vec 19 va_s0).hi3 == word_to_nat32 (index hash 3))) ((va_get_vec 20 va_s0).hi3 ==
word_to_nat32 (index hash 4))) ((va_get_vec 21 va_s0).hi3 == word_to_nat32 (index hash 5)))
((va_get_vec 22 va_s0).hi3 == word_to_nat32 (index hash 6))) ((va_get_vec 23 va_s0).hi3 ==
add_wrap32 (word_to_nat32 (index hash 7)) (k_index ks i))) /\ l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3
== ws_opaque block i) ((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2
va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i -
13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 10))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 9))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
8))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 7))) ((va_get_vec 10 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec
12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
3))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i - 2))) ((va_get_vec 15 va_s0).hi3 ==
ws_opaque block (i - 1)) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 == k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == k_index ks (i + 2))) ((va_get_vec 24 va_s0).lo1 == k_index ks (i
+ 3))))))
(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 6 va_s0 + 64 /\ (let ks = buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash = repeat_range_vale (i + 16) block hash_orig
in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32
(index next_hash 0)) ((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1)))
((va_get_vec 18 va_sM).hi3 == word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
word_to_nat32 (index next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index
next_hash 4))) ((va_get_vec 21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec
22 va_sM).hi3 == word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32
(word_to_nat32 (index next_hash 7)) (k_index ks (i + 16)))) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0
va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)))
((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))) ((va_get_vec 5
va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 6)))
((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7))) ((va_get_vec 8 va_sM).hi3 == ws_opaque
block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 9))) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i +
11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 12))) ((va_get_vec 13 va_sM).hi3 ==
ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 14)))
((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15)) /\ l_and (l_and ((va_get_vec 24
va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 == k_index ks (i + 18)))
((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22
va_sM (va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_47 (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (i == 16) (i == 32) /\ validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 4 (va_get_mem_layout va_s0) Secret /\
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in k_reqs ks /\ va_get_reg 6 va_s0
+ 64 < pow2_64 /\ (let hash = repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == word_to_nat32 (index hash 0)) ((va_get_vec
17 va_s0).hi3 == word_to_nat32 (index hash 1))) ((va_get_vec 18 va_s0).hi3 == word_to_nat32
(index hash 2))) ((va_get_vec 19 va_s0).hi3 == word_to_nat32 (index hash 3))) ((va_get_vec 20
va_s0).hi3 == word_to_nat32 (index hash 4))) ((va_get_vec 21 va_s0).hi3 == word_to_nat32 (index
hash 5))) ((va_get_vec 22 va_s0).hi3 == word_to_nat32 (index hash 6))) ((va_get_vec 23
va_s0).hi3 == add_wrap32 (word_to_nat32 (index hash 7)) (k_index ks i))) /\ l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3 == ws_opaque block (i
- 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 3 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i -
10))) ((va_get_vec 7 va_s0).hi3 == ws_opaque block (i - 9))) ((va_get_vec 8 va_s0).hi3 ==
ws_opaque block (i - 8))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 7))) ((va_get_vec
10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i -
5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 ==
ws_opaque block (i - 3))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i - 2))) ((va_get_vec
15 va_s0).hi3 == ws_opaque block (i - 1)) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 == k_index
ks (i + 1)) ((va_get_vec 24 va_s0).hi2 == k_index ks (i + 2))) ((va_get_vec 24 va_s0).lo1 ==
k_index ks (i + 3)))) /\ (forall (va_x_r6: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_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6
va_s0))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ (let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 == word_to_nat32 (index
next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index next_hash 3))) ((va_get_vec
20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 == word_to_nat32 (index
next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32 (index next_hash 7))
(k_index ks (i + 16)))) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16))
((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque
block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4
va_sM).hi3 == ws_opaque block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5)))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 7))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9
va_sM).hi3 == ws_opaque block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i +
10))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 ==
ws_opaque block (i + 12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13)))
((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 ==
ws_opaque block (i + 15)) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17))
((va_get_vec 24 va_sM).hi2 == k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i
+ 19)))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_47 : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_47 (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(va_QProc (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6])
(va_wp_Loop_rounds_16_47 i k_b block hash_orig) (va_wpProof_Loop_rounds_16_47 i k_b block
hash_orig))
//--
//-- Loop_rounds_48_63
val va_code_Loop_rounds_48_63 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_48_63 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_48_63 : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 -> block:block_w
-> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_48_63 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 33)) ((va_get_vec 2
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 34)) ((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 35)) ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 36)) ((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37)) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40)) ((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41)) ((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51)))))
(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 6 va_s0 + 48 /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM
(va_update_ok va_sM va_s0)))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_48_63 (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 33)) ((va_get_vec 2
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 34)) ((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 35)) ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 36)) ((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37)) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40)) ((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41)) ((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51))) /\ (forall (va_x_r6: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_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (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 6 va_x_r6 va_s0))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6
va_sM == va_get_reg 6 va_s0 + 48 /\ Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32
(va_get_vec 16 va_sM) (va_get_vec 17 va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM)
(va_get_vec 20 va_sM) (va_get_vec 21 va_sM) (va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_48_63 : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_48_63 k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_48_63 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.va_wp_Loop_rounds_48_63",
"Vale.SHA.PPC64LE.Rounds.va_wpProof_Loop_rounds_48_63",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_48_63 (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_48_63 ())) =
| (va_QProc (va_code_Loop_rounds_48_63 ())
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; 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 6
])
(va_wp_Loop_rounds_48_63 k_b block hash_orig)
(va_wpProof_Loop_rounds_48_63 k_b block hash_orig)) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.as_nat_inj | val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4)) | val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4)) | let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 27,
"end_line": 188,
"start_col": 0,
"start_line": 186
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f1: Hacl.Spec.K256.Field52.Definitions.felem5 -> f2: Hacl.Spec.K256.Field52.Definitions.felem5
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.K256.Field52.Definitions.felem_fits5 f1 (1, 1, 1, 1, 1) /\
Hacl.Spec.K256.Field52.Definitions.felem_fits5 f2 (1, 1, 1, 1, 1) /\
Hacl.Spec.K256.Field52.Definitions.as_nat5 f1 ==
Hacl.Spec.K256.Field52.Definitions.as_nat5 f2)
(ensures
(let _ = f1 in
(let FStar.Pervasives.Native.Mktuple5 #_ #_ #_ #_ #_ a0 a1 a2 a3 a4 = _ in
let _ = f2 in
(let FStar.Pervasives.Native.Mktuple5 #_ #_ #_ #_ #_ b0 b1 b2 b3 b4 = _ in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4)
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_decompose",
"Prims.unit"
] | [] | true | false | true | false | false | let as_nat_inj f1 f2 =
| lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2 | false |
Vale.SHA.PPC64LE.Rounds.fsti | Vale.SHA.PPC64LE.Rounds.va_quick_Loop_rounds_0_15 | val va_quick_Loop_rounds_0_15
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
: (va_quickCode unit (va_code_Loop_rounds_0_15 ())) | val va_quick_Loop_rounds_0_15
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
: (va_quickCode unit (va_code_Loop_rounds_0_15 ())) | let va_quick_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6; va_Mod_reg 4])
(va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE) (va_wpProof_Loop_rounds_0_15
in_b offset k_b block hash_orig input_BE)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 225,
"start_col": 0,
"start_line": 217
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> offset:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> input_BE:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3)))))
(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 6 va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48
/\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let
next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) /\ va_state_eq va_sM (va_update_vec 26 va_sM
(va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM
(va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_reg 4 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0) in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3))) /\ (forall (va_x_r4:nat64)
(va_x_r6: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_v20:quad32) (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32)
(va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22
(va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6 (va_upd_reg 4 va_x_r4
va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48 /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> offset:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> input_BE:(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_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6; va_Mod_reg 4]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
in_b: Vale.PPC64LE.Memory.buffer128 ->
offset: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
input_BE: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_0_15 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_0_15",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.va_wp_Loop_rounds_0_15",
"Vale.SHA.PPC64LE.Rounds.va_wpProof_Loop_rounds_0_15",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_0_15
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
: (va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
| (va_QProc (va_code_Loop_rounds_0_15 ())
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; 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 6; va_Mod_reg 4
])
(va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE)
(va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE)) | false |
Steel.ST.GhostHigherReference.fst | Steel.ST.GhostHigherReference.pts_to_injective_eq | val pts_to_injective_eq (#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1: a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1) | val pts_to_injective_eq (#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1: a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1) | let pts_to_injective_eq
#_ #_ #p0 #p1 #v0 #v1 r
= rewrite (pts_to r p0 v0) (RST.pts_to r.reveal p0 v0);
rewrite (pts_to r p1 v1) (RST.pts_to r.reveal p1 v1);
RST.pts_to_injective_eq #_ #_ #_ #_ #v0 #v1 r.reveal;
rewrite (RST.pts_to r.reveal p0 v0) (pts_to r p0 v0);
rewrite (RST.pts_to r.reveal p1 v0) (pts_to r p1 v0) | {
"file_name": "lib/steel/Steel.ST.GhostHigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 54,
"end_line": 38,
"start_col": 0,
"start_line": 32
} | module Steel.ST.GhostHigherReference
// needed because I need to know that `Steel.ST.HigherReference.ref a`
// can be turned into `Steel.HigherReference.ref a`
friend Steel.ST.HigherReference
module RST = Steel.ST.HigherReference
module R = Steel.HigherReference
module STC = Steel.ST.Coercions
// FIXME: WHY WHY WHY in `Ghost.reveal (ref a)` is `a` not strictly positive?
[@@erasable]
noeq
type ref' ([@@@strictly_positive] a : Type u#1) : Type0
= | Hide: (reveal: R.ref a) -> ref' a
let ref a = ref' a
let pts_to r p v = RST.pts_to r.reveal p v
let reveal_ref r = r.reveal
let hide_ref r = Hide r
let hide_reveal_ref r = ()
let reveal_pts_to r p x =
equiv_refl (Steel.ST.HigherReference.pts_to (reveal_ref r) p x) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.HigherReference.fst.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GhostHigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.ST.Coercions",
"short_module": "STC"
},
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.HigherReference",
"short_module": "RST"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": 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.ST.GhostHigherReference.ref a -> Steel.ST.Effect.Ghost.STGhost Prims.unit | Steel.ST.Effect.Ghost.STGhost | [] | [] | [
"Steel.Memory.inames",
"Steel.FractionalPermission.perm",
"Steel.ST.GhostHigherReference.ref",
"Steel.ST.Util.rewrite",
"Steel.ST.HigherReference.pts_to",
"Steel.ST.GhostHigherReference.__proj__Hide__item__reveal",
"Steel.ST.GhostHigherReference.pts_to",
"Prims.unit",
"Steel.ST.HigherReference.pts_to_injective_eq"
] | [] | false | true | false | false | false | let pts_to_injective_eq #_ #_ #p0 #p1 #v0 #v1 r =
| rewrite (pts_to r p0 v0) (RST.pts_to r.reveal p0 v0);
rewrite (pts_to r p1 v1) (RST.pts_to r.reveal p1 v1);
RST.pts_to_injective_eq #_ #_ #_ #_ #v0 #v1 r.reveal;
rewrite (RST.pts_to r.reveal p0 v0) (pts_to r p0 v0);
rewrite (RST.pts_to r.reveal p1 v0) (pts_to r p1 v0) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_div_pow48 | val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1)) | val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1)) | let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 223,
"start_col": 0,
"start_line": 216
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t4: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma (requires Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 t4 2)
(ensures
Lib.IntTypes.v t4 / Prims.pow2 48 ==
(match Lib.IntTypes.v t4 < Prims.pow2 48 with
| true -> 0
| _ -> 1)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.IntTypes.uint64",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.pow2",
"FStar.Math.Lemmas.small_div",
"Prims.bool",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Division",
"Prims.unit",
"FStar.Math.Lemmas.lemma_div_le",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_normalize_x_le_1"
] | [] | false | false | true | false | false | let lemma_div_pow48 t4 =
| if v t4 < pow2 48
then Math.Lemmas.small_div (v t4) (pow2 48)
else
(lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48)) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_carry_last52 | val lemma_carry_last52: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits_last1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52)) | val lemma_carry_last52: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits_last1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52)) | let lemma_carry_last52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52_last m1 m2 a b | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 321,
"start_col": 0,
"start_line": 319
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1)
let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1)
val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52 m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
(==) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1))
val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52_last m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max48 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 48 12 }
m1 * max48 + max48;
(==) { Math.Lemmas.distributivity_add_left m1 1 max48 }
(m1 + 1) * max48;
};
Math.Lemmas.lemma_mult_le_right max48 (m1 + 1) 65536;
assert_norm (65536 * max48 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits_last1 c (m1 + 1))
val lemma_carry52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52))
let lemma_carry52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52 m1 m2 a b
val lemma_carry_last52: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits_last1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
m1: Hacl.Spec.K256.Field52.Definitions.scale64_last ->
m2: Hacl.Spec.K256.Field52.Definitions.scale64 ->
a: Lib.IntTypes.uint64 ->
b: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 a m1 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in
let d = b &. Hacl.Spec.K256.Field52.Definitions.mask52 in
Hacl.Spec.K256.Field52.Definitions.felem_fits1 d 1 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 c (m1 + 1) /\
Lib.IntTypes.v d = Lib.IntTypes.v b % Prims.pow2 52 /\
Lib.IntTypes.v c = Lib.IntTypes.v a + Lib.IntTypes.v b / Prims.pow2 52)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.scale64_last",
"Hacl.Spec.K256.Field52.Definitions.scale64",
"Lib.IntTypes.uint64",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_add_rsh52_last",
"Prims.unit",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_mask52"
] | [] | true | false | true | false | false | let lemma_carry_last52 m1 m2 a b =
| lemma_mask52 b;
lemma_add_rsh52_last m1 m2 a b | false |
Steel.ST.Array.fst | Steel.ST.Array.intro_exists_compare_inv | val intro_exists_compare_inv
(#o: _)
(#t: eqtype)
(#p0 #p1: perm)
(a0 a1: array t)
(#s0 #s1: Seq.seq t)
(l: US.t)
(ctr: R.ref (option US.t))
(x: Ghost.erased (option US.t))
: STGhostT unit
o
(let open US in
(((pts_to a0 p0 s0) `star` (pts_to a1 p1 s1))
`star`
(R.pts_to ctr Steel.FractionalPermission.full_perm x))
`star`
(pure (equal_up_to s0 s1 x)))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)) | val intro_exists_compare_inv
(#o: _)
(#t: eqtype)
(#p0 #p1: perm)
(a0 a1: array t)
(#s0 #s1: Seq.seq t)
(l: US.t)
(ctr: R.ref (option US.t))
(x: Ghost.erased (option US.t))
: STGhostT unit
o
(let open US in
(((pts_to a0 p0 s0) `star` (pts_to a1 p1 s1))
`star`
(R.pts_to ctr Steel.FractionalPermission.full_perm x))
`star`
(pure (equal_up_to s0 s1 x)))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)) | let intro_exists_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(x: Ghost.erased (option US.t))
: STGhostT unit o
(let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))
= let b : bool =
match Ghost.reveal x with
| None -> false
| Some x -> US.(x <^ l)
in
assert (within_bounds x l b);
intro_compare_inv #_ #_ #p0 #p1 a0 a1 #s0 #s1 l ctr x b;
intro_exists _ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr) | {
"file_name": "lib/steel/Steel.ST.Array.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 63,
"end_line": 370,
"start_col": 0,
"start_line": 347
} | (*
Copyright 2020, 2021, 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.
*)
module Steel.ST.Array
module US = FStar.SizeT
/// Lifting a value of universe 0 to universe 1. We use
/// FStar.Universe, since FStar.Extraction.Krml is set to extract
/// those functions to identity.
inline_for_extraction
[@@ noextract_to "krml"]
let raise_t (t: Type0) : Type u#1 = FStar.Universe.raise_t t
inline_for_extraction
[@@noextract_to "krml"]
let raise (#t: Type) (x: t) : Tot (raise_t t) =
FStar.Universe.raise_val x
inline_for_extraction
[@@noextract_to "krml"]
let lower (#t: Type) (x: raise_t t) : Tot t =
FStar.Universe.downgrade_val x
/// A map operation on sequences. Here we only need Ghost versions,
/// because such sequences are only used in vprops or with their
/// selectors.
let rec seq_map
(#t: Type u#a)
(#t' : Type u#b)
(f: (t -> GTot t'))
(s: Seq.seq t)
: Ghost (Seq.seq t')
(requires True)
(ensures (fun s' ->
Seq.length s' == Seq.length s /\
(forall i . {:pattern (Seq.index s' i)} Seq.index s' i == f (Seq.index s i))
))
(decreases (Seq.length s))
= if Seq.length s = 0
then Seq.empty
else Seq.cons (f (Seq.index s 0)) (seq_map f (Seq.slice s 1 (Seq.length s)))
let seq_map_append
(#t: Type u#a)
(#t': Type u#b)
(f: (t -> GTot t'))
(s1 s2: Seq.seq t)
: Lemma
(seq_map f (s1 `Seq.append` s2) `Seq.equal` (seq_map f s1 `Seq.append` seq_map f s2))
= ()
let seq_map_raise_inj
(#elt: Type0)
(s1 s2: Seq.seq elt)
: Lemma
(requires (seq_map raise s1 == seq_map raise s2))
(ensures (s1 == s2))
[SMTPat (seq_map raise s1); SMTPat (seq_map raise s2)]
= assert (seq_map lower (seq_map raise s1) `Seq.equal` s1);
assert (seq_map lower (seq_map raise s2) `Seq.equal` s2)
/// Implementation of the interface
/// base, ptr, array, pts_to
module H = Steel.ST.HigherArray
let base_t elt = H.base_t (raise_t elt)
let base_len b = H.base_len b
let ptr elt = H.ptr (raise_t elt)
let null_ptr elt = H.null_ptr (raise_t elt)
let is_null_ptr p = H.is_null_ptr p
let base p = H.base p
let offset p = H.offset p
let ptr_base_offset_inj p1 p2 = H.ptr_base_offset_inj p1 p2
let base_len_null_ptr elt = H.base_len_null_ptr (raise_t elt)
let length_fits a = H.length_fits a
let pts_to a p s = H.pts_to a p (seq_map raise s)
let pts_to_length a s =
H.pts_to_length a _
let h_array_eq'
(#t: Type u#1)
(a1 a2: H.array t)
: Lemma
(requires (
dfst a1 == dfst a2 /\
(Ghost.reveal (dsnd a1) <: nat) == Ghost.reveal (dsnd a2)
))
(ensures (
a1 == a2
))
= ()
let pts_to_not_null #_ #t #p a s =
let _ = H.pts_to_not_null #_ #_ #p a (seq_map raise s) in
assert (a =!= H.null #(raise_t t));
Classical.move_requires (h_array_eq' a) (H.null #(raise_t t));
noop ()
let pts_to_inj a p1 s1 p2 s2 =
H.pts_to_inj a p1 (seq_map raise s1) p2 (seq_map raise s2)
/// Non-selector operations.
let malloc x n =
let res = H.malloc (raise x) n in
assert (seq_map raise (Seq.create (US.v n) x) `Seq.equal` Seq.create (US.v n) (raise x));
rewrite
(H.pts_to res _ _)
(pts_to res _ _);
return res
let free #_ x =
let s = elim_exists () in
rewrite
(pts_to x _ _)
(H.pts_to x P.full_perm (seq_map raise s));
H.free x
let share
#_ #_ #x a p p1 p2
= rewrite
(pts_to a _ _)
(H.pts_to a p (seq_map raise x));
H.share a p p1 p2;
rewrite
(H.pts_to a p1 _)
(pts_to a p1 x);
rewrite
(H.pts_to a p2 _)
(pts_to a p2 x)
let gather
#_ #_ a #x1 p1 #x2 p2
= rewrite
(pts_to a p1 _)
(H.pts_to a p1 (seq_map raise x1));
rewrite
(pts_to a p2 _)
(H.pts_to a p2 (seq_map raise x2));
H.gather a p1 p2;
rewrite
(H.pts_to a _ _)
(pts_to _ _ _)
let index #_ #p a #s i =
rewrite
(pts_to a _ _)
(H.pts_to a p (seq_map raise s));
let res = H.index a i in
rewrite
(H.pts_to _ _ _)
(pts_to _ _ _);
return (lower res)
let upd #_ a #s i v =
rewrite
(pts_to a _ _)
(H.pts_to a P.full_perm (seq_map raise s));
H.upd a i (raise v);
assert (seq_map raise (Seq.upd s (US.v i) v) `Seq.equal` Seq.upd (seq_map raise s) (US.v i) (raise v));
rewrite
(H.pts_to _ _ _)
(pts_to _ _ _)
let ghost_join
#_ #_ #x1 #x2 #p a1 a2 h
= rewrite
(pts_to a1 _ _)
(H.pts_to a1 p (seq_map raise x1));
rewrite
(pts_to a2 _ _)
(H.pts_to a2 p (seq_map raise x2));
H.ghost_join a1 a2 h;
assert (seq_map raise (x1 `Seq.append` x2) `Seq.equal` (seq_map raise x1 `Seq.append` seq_map raise x2));
rewrite
(H.pts_to _ _ _)
(H.pts_to (merge a1 a2) p (seq_map raise (x1 `Seq.append` x2)));
rewrite
(H.pts_to _ _ _)
(pts_to (merge a1 a2) _ _)
let ptr_shift p off = H.ptr_shift p off
let ghost_split
#_ #_ #x #p a i
=
rewrite
(pts_to a _ _)
(H.pts_to a p (seq_map raise x));
let _ = H.ghost_split a i in
//H.ghost_split a i;
assert (seq_map raise (Seq.slice x 0 (US.v i)) `Seq.equal` Seq.slice (seq_map raise x) 0 (US.v i));
rewrite
(H.pts_to (H.split_l a i) _ _)
(H.pts_to (split_l a i) p (seq_map raise (Seq.slice x 0 (US.v i))));
rewrite
(H.pts_to (split_l a i) _ _)
(pts_to (split_l a i) _ _);
assert (seq_map raise (Seq.slice x (US.v i) (Seq.length x)) `Seq.equal` Seq.slice (seq_map raise x) (US.v i) (Seq.length (seq_map raise x)));
Seq.lemma_split x (US.v i);
rewrite
(H.pts_to (H.split_r a i) _ _)
(H.pts_to (split_r a i) p (seq_map raise (Seq.slice x (US.v i) (Seq.length x))));
rewrite
(H.pts_to (split_r a i) _ _)
(pts_to (split_r a i) _ _)
let memcpy
a0 a1 l
=
H.memcpy a0 a1 l
////////////////////////////////////////////////////////////////////////////////
// compare
////////////////////////////////////////////////////////////////////////////////
module R = Steel.ST.Reference
#push-options "--fuel 0 --ifuel 1 --z3rlimit_factor 2"
let equal_up_to #t
(s0: Seq.seq t)
(s1: Seq.seq t)
(v : option US.t) : prop =
Seq.length s0 = Seq.length s1 /\
(match v with
| None -> Ghost.reveal s0 =!= Ghost.reveal s1
| Some v -> US.v v <= Seq.length s0 /\ Seq.slice s0 0 (US.v v) `Seq.equal` Seq.slice s1 0 (US.v v))
let within_bounds (x:option US.t) (l:US.t) (b:Ghost.erased bool) : prop =
if b then Some? x /\ US.(Some?.v x <^ l)
else None? x \/ US.(Some?.v x >=^ l)
let compare_inv (#t:eqtype) (#p0 #p1:perm)
(a0 a1:array t)
(s0: Seq.seq t)
(s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(b: bool) =
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (x:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x) `star`
pure (within_bounds x l b))
let elim_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(b: bool)
: STGhostT (Ghost.erased (option US.t)) o
(compare_inv a0 a1 s0 s1 l ctr b)
(fun x ->
let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x) `star`
pure (within_bounds x l b))
= let open US in
assert_spinoff
((compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr b) ==
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l b))));
rewrite
(compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr b)
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l b)));
let _v = elim_exists () in
_v
let intro_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(x: Ghost.erased (option US.t))
(b:bool { within_bounds x l b })
: STGhostT unit o
(let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x))
(fun _ -> compare_inv a0 a1 s0 s1 l ctr (Ghost.hide b))
= let open US in
intro_pure (within_bounds x l (Ghost.hide b));
intro_exists_erased x (fun (x:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x) `star`
pure (within_bounds x l (Ghost.hide b)));
assert_norm
((compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr (Ghost.hide b)) ==
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l (Ghost.hide b)))));
rewrite
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l (Ghost.hide b))))
(compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr (Ghost.hide b)) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.HigherArray.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Array.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.HigherArray",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "US"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.PtrdiffT",
"short_module": "UP"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "US"
},
{
"abbrev": true,
"full_module": "Steel.FractionalPermission",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": 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": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a0: Steel.ST.Array.array t ->
a1: Steel.ST.Array.array t ->
l: FStar.SizeT.t ->
ctr: Steel.ST.Reference.ref (FStar.Pervasives.Native.option FStar.SizeT.t) ->
x: FStar.Ghost.erased (FStar.Pervasives.Native.option FStar.SizeT.t)
-> Steel.ST.Effect.Ghost.STGhostT Prims.unit | Steel.ST.Effect.Ghost.STGhostT | [] | [] | [
"Steel.Memory.inames",
"Prims.eqtype",
"Steel.FractionalPermission.perm",
"Steel.ST.Array.array",
"FStar.Seq.Base.seq",
"FStar.SizeT.t",
"Steel.ST.Reference.ref",
"FStar.Pervasives.Native.option",
"FStar.Ghost.erased",
"Steel.ST.Util.intro_exists",
"Prims.bool",
"Steel.ST.Array.compare_inv",
"Prims.unit",
"Steel.ST.Array.intro_compare_inv",
"Prims._assert",
"Steel.ST.Array.within_bounds",
"FStar.Ghost.reveal",
"FStar.Ghost.hide",
"FStar.SizeT.op_Less_Hat",
"Steel.Effect.Common.star",
"Steel.ST.Array.pts_to",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.ST.Util.pure",
"Steel.ST.Array.equal_up_to",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.vprop"
] | [] | false | true | false | false | false | let intro_exists_compare_inv
#o
(#t: eqtype)
(#p0: perm)
(#p1: perm)
(a0: array t)
(a1: array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l: US.t)
(ctr: R.ref (option US.t))
(x: Ghost.erased (option US.t))
: STGhostT unit
o
(let open US in
(((pts_to a0 p0 s0) `star` (pts_to a1 p1 s1))
`star`
(R.pts_to ctr Steel.FractionalPermission.full_perm x))
`star`
(pure (equal_up_to s0 s1 x)))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)) =
| let b:bool =
match Ghost.reveal x with
| None -> false
| Some x -> let open US in x <^ l
in
assert (within_bounds x l b);
intro_compare_inv #_ #_ #p0 #p1 a0 a1 #s0 #s1 l ctr x b;
intro_exists _ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr) | false |
Vale.SHA.PPC64LE.Rounds.fsti | Vale.SHA.PPC64LE.Rounds.va_quick_Loop_rounds_16_47 | val va_quick_Loop_rounds_16_47 (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_16_47 i)) | val va_quick_Loop_rounds_16_47 (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_16_47 i)) | let va_quick_Loop_rounds_16_47 (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(va_QProc (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6])
(va_wp_Loop_rounds_16_47 i k_b block hash_orig) (va_wpProof_Loop_rounds_16_47 i k_b block
hash_orig)) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 15,
"end_line": 372,
"start_col": 0,
"start_line": 364
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> offset:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> input_BE:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3)))))
(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 6 va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48
/\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let
next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) /\ va_state_eq va_sM (va_update_vec 26 va_sM
(va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM
(va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_reg 4 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0) in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3))) /\ (forall (va_x_r4:nat64)
(va_x_r6: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_v20:quad32) (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32)
(va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22
(va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6 (va_upd_reg 4 va_x_r4
va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48 /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> offset:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> input_BE:(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_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6; va_Mod_reg 4]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6; va_Mod_reg 4])
(va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE) (va_wpProof_Loop_rounds_0_15
in_b offset k_b block hash_orig input_BE))
//--
//-- Loop_rounds_16_47
val va_code_Loop_rounds_16_47 : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_47 : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_47 : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_47 i) va_s0 /\ va_get_ok va_s0 /\ (l_or
(i == 16) (i == 32) /\ validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 4 (va_get_mem_layout va_s0) Secret /\ (let ks = buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in k_reqs ks /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ (let hash
= repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 16 va_s0).hi3 == word_to_nat32 (index hash 0)) ((va_get_vec 17 va_s0).hi3 ==
word_to_nat32 (index hash 1))) ((va_get_vec 18 va_s0).hi3 == word_to_nat32 (index hash 2)))
((va_get_vec 19 va_s0).hi3 == word_to_nat32 (index hash 3))) ((va_get_vec 20 va_s0).hi3 ==
word_to_nat32 (index hash 4))) ((va_get_vec 21 va_s0).hi3 == word_to_nat32 (index hash 5)))
((va_get_vec 22 va_s0).hi3 == word_to_nat32 (index hash 6))) ((va_get_vec 23 va_s0).hi3 ==
add_wrap32 (word_to_nat32 (index hash 7)) (k_index ks i))) /\ l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3
== ws_opaque block i) ((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2
va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i -
13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 10))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 9))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
8))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 7))) ((va_get_vec 10 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec
12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
3))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i - 2))) ((va_get_vec 15 va_s0).hi3 ==
ws_opaque block (i - 1)) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 == k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == k_index ks (i + 2))) ((va_get_vec 24 va_s0).lo1 == k_index ks (i
+ 3))))))
(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 6 va_s0 + 64 /\ (let ks = buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash = repeat_range_vale (i + 16) block hash_orig
in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32
(index next_hash 0)) ((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1)))
((va_get_vec 18 va_sM).hi3 == word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
word_to_nat32 (index next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index
next_hash 4))) ((va_get_vec 21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec
22 va_sM).hi3 == word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32
(word_to_nat32 (index next_hash 7)) (k_index ks (i + 16)))) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0
va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)))
((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))) ((va_get_vec 5
va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 6)))
((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7))) ((va_get_vec 8 va_sM).hi3 == ws_opaque
block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 9))) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i +
11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 12))) ((va_get_vec 13 va_sM).hi3 ==
ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 14)))
((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15)) /\ l_and (l_and ((va_get_vec 24
va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 == k_index ks (i + 18)))
((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22
va_sM (va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_47 (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (i == 16) (i == 32) /\ validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 4 (va_get_mem_layout va_s0) Secret /\
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in k_reqs ks /\ va_get_reg 6 va_s0
+ 64 < pow2_64 /\ (let hash = repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == word_to_nat32 (index hash 0)) ((va_get_vec
17 va_s0).hi3 == word_to_nat32 (index hash 1))) ((va_get_vec 18 va_s0).hi3 == word_to_nat32
(index hash 2))) ((va_get_vec 19 va_s0).hi3 == word_to_nat32 (index hash 3))) ((va_get_vec 20
va_s0).hi3 == word_to_nat32 (index hash 4))) ((va_get_vec 21 va_s0).hi3 == word_to_nat32 (index
hash 5))) ((va_get_vec 22 va_s0).hi3 == word_to_nat32 (index hash 6))) ((va_get_vec 23
va_s0).hi3 == add_wrap32 (word_to_nat32 (index hash 7)) (k_index ks i))) /\ l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3 == ws_opaque block (i
- 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 3 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i -
10))) ((va_get_vec 7 va_s0).hi3 == ws_opaque block (i - 9))) ((va_get_vec 8 va_s0).hi3 ==
ws_opaque block (i - 8))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 7))) ((va_get_vec
10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i -
5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 ==
ws_opaque block (i - 3))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i - 2))) ((va_get_vec
15 va_s0).hi3 == ws_opaque block (i - 1)) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 == k_index
ks (i + 1)) ((va_get_vec 24 va_s0).hi2 == k_index ks (i + 2))) ((va_get_vec 24 va_s0).lo1 ==
k_index ks (i + 3)))) /\ (forall (va_x_r6: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_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6
va_s0))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ (let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 == word_to_nat32 (index
next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index next_hash 3))) ((va_get_vec
20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 == word_to_nat32 (index
next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32 (index next_hash 7))
(k_index ks (i + 16)))) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16))
((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque
block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4
va_sM).hi3 == ws_opaque block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5)))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 7))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9
va_sM).hi3 == ws_opaque block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i +
10))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 ==
ws_opaque block (i + 12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13)))
((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 ==
ws_opaque block (i + 15)) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17))
((va_get_vec 24 va_sM).hi2 == k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i
+ 19)))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_47 : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_16_47 i) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_16_47",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.SHA.PPC64LE.Rounds.va_wp_Loop_rounds_16_47",
"Vale.SHA.PPC64LE.Rounds.va_wpProof_Loop_rounds_16_47",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop_rounds_16_47 (i: nat) (k_b: buffer128) (block: block_w) (hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
| (va_QProc (va_code_Loop_rounds_16_47 i)
([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; 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 6
])
(va_wp_Loop_rounds_16_47 i k_b block hash_orig)
(va_wpProof_Loop_rounds_16_47 i k_b block hash_orig)) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_normalize_x_le_1 | val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1) | val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1) | let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 209,
"start_col": 0,
"start_line": 196
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t4: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma (requires Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 t4 2)
(ensures Lib.IntTypes.v t4 / Prims.pow2 48 <= 1) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Division",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.pow2",
"Prims.unit",
"FStar.Math.Lemmas.lemma_div_le",
"Prims.op_Subtraction",
"FStar.Mul.op_Star",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"FStar.Calc.calc_step",
"Prims.op_Addition",
"Prims.op_Minus",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.distributivity_add_right",
"Prims.squash",
"FStar.Math.Lemmas.division_addition_lemma",
"FStar.Pervasives.assert_norm",
"Prims.op_Equality"
] | [] | false | false | true | false | false | let lemma_normalize_x_le_1 t4 =
| calc ( == ) {
(2 * (pow2 48 - 1)) / pow2 48;
( == ) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
( == ) { Math.Lemmas.division_addition_lemma (- 2) (pow2 48) 2 }
(- 2) / pow2 48 + 2;
( == ) { assert_norm ((- 2) / pow2 48 = - 1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1) | false |
Vale.SHA.PPC64LE.Rounds.fsti | Vale.SHA.PPC64LE.Rounds.va_wp_Loop_rounds_48_63 | val va_wp_Loop_rounds_48_63
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_48_63
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_48_63 (k_b:buffer128) (block:block_w) (hash_orig:hash256) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg
6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 33)) ((va_get_vec 2
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 34)) ((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 35)) ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 36)) ((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37)) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40)) ((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41)) ((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51))) /\ (forall (va_x_r6: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_v20:quad32)
(va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)
(va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24
va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20
va_x_v20 (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 6 va_x_r6 va_s0))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6
va_sM == va_get_reg 6 va_s0 + 48 /\ Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32
(va_get_vec 16 va_sM) (va_get_vec 17 va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM)
(va_get_vec 20 va_sM) (va_get_vec 21 va_sM) (va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 501,
"start_col": 0,
"start_line": 441
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> offset:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> input_BE:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3)))))
(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 6 va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48
/\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let
next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) /\ va_state_eq va_sM (va_update_vec 26 va_sM
(va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM
(va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_reg 4 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0) in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3))) /\ (forall (va_x_r4:nat64)
(va_x_r6: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_v20:quad32) (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32)
(va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22
(va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6 (va_upd_reg 4 va_x_r4
va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48 /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> offset:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> input_BE:(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_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6; va_Mod_reg 4]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
(va_QProc (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6; va_Mod_reg 4])
(va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE) (va_wpProof_Loop_rounds_0_15
in_b offset k_b block hash_orig input_BE))
//--
//-- Loop_rounds_16_47
val va_code_Loop_rounds_16_47 : i:nat -> Tot va_code
val va_codegen_success_Loop_rounds_16_47 : i:nat -> Tot va_pbool
val va_lemma_Loop_rounds_16_47 : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->
block:block_w -> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_16_47 i) va_s0 /\ va_get_ok va_s0 /\ (l_or
(i == 16) (i == 32) /\ validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)
k_b (i `op_Division` 4 + 1) 4 (va_get_mem_layout va_s0) Secret /\ (let ks = buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in k_reqs ks /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ (let hash
= repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 16 va_s0).hi3 == word_to_nat32 (index hash 0)) ((va_get_vec 17 va_s0).hi3 ==
word_to_nat32 (index hash 1))) ((va_get_vec 18 va_s0).hi3 == word_to_nat32 (index hash 2)))
((va_get_vec 19 va_s0).hi3 == word_to_nat32 (index hash 3))) ((va_get_vec 20 va_s0).hi3 ==
word_to_nat32 (index hash 4))) ((va_get_vec 21 va_s0).hi3 == word_to_nat32 (index hash 5)))
((va_get_vec 22 va_s0).hi3 == word_to_nat32 (index hash 6))) ((va_get_vec 23 va_s0).hi3 ==
add_wrap32 (word_to_nat32 (index hash 7)) (k_index ks i))) /\ l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_s0).hi3
== ws_opaque block i) ((va_get_vec 1 va_s0).hi3 == ws_opaque block (i - 15))) ((va_get_vec 2
va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 3 va_s0).hi3 == ws_opaque block (i -
13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec 5 va_s0).hi3 ==
ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i - 10))) ((va_get_vec
7 va_s0).hi3 == ws_opaque block (i - 9))) ((va_get_vec 8 va_s0).hi3 == ws_opaque block (i -
8))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 7))) ((va_get_vec 10 va_s0).hi3 ==
ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i - 5))) ((va_get_vec
12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 == ws_opaque block (i -
3))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i - 2))) ((va_get_vec 15 va_s0).hi3 ==
ws_opaque block (i - 1)) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 == k_index ks (i + 1))
((va_get_vec 24 va_s0).hi2 == k_index ks (i + 2))) ((va_get_vec 24 va_s0).lo1 == k_index ks (i
+ 3))))))
(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 6 va_s0 + 64 /\ (let ks = buffer128_as_seq
(va_get_mem_heaplet 0 va_sM) k_b in (let next_hash = repeat_range_vale (i + 16) block hash_orig
in l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32
(index next_hash 0)) ((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1)))
((va_get_vec 18 va_sM).hi3 == word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
word_to_nat32 (index next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index
next_hash 4))) ((va_get_vec 21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec
22 va_sM).hi3 == word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32
(word_to_nat32 (index next_hash 7)) (k_index ks (i + 16)))) /\ l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 0
va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1)))
((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque
block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque block (i + 4))) ((va_get_vec 5
va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 6)))
((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7))) ((va_get_vec 8 va_sM).hi3 == ws_opaque
block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque block (i + 9))) ((va_get_vec 10
va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i +
11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i + 12))) ((va_get_vec 13 va_sM).hi3 ==
ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 14)))
((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15)) /\ l_and (l_and ((va_get_vec 24
va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 == k_index ks (i + 18)))
((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))) /\ va_state_eq va_sM (va_update_vec 26
va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22
va_sM (va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop_rounds_16_47 (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (l_or (i == 16) (i == 32) /\ validSrcAddrsOffset128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 6 va_s0) k_b (i `op_Division` 4 + 1) 4 (va_get_mem_layout va_s0) Secret /\
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in k_reqs ks /\ va_get_reg 6 va_s0
+ 64 < pow2_64 /\ (let hash = repeat_range_vale i block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == word_to_nat32 (index hash 0)) ((va_get_vec
17 va_s0).hi3 == word_to_nat32 (index hash 1))) ((va_get_vec 18 va_s0).hi3 == word_to_nat32
(index hash 2))) ((va_get_vec 19 va_s0).hi3 == word_to_nat32 (index hash 3))) ((va_get_vec 20
va_s0).hi3 == word_to_nat32 (index hash 4))) ((va_get_vec 21 va_s0).hi3 == word_to_nat32 (index
hash 5))) ((va_get_vec 22 va_s0).hi3 == word_to_nat32 (index hash 6))) ((va_get_vec 23
va_s0).hi3 == add_wrap32 (word_to_nat32 (index hash 7)) (k_index ks i))) /\ l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 0 va_s0).hi3 == ws_opaque block i) ((va_get_vec 1 va_s0).hi3 == ws_opaque block (i
- 15))) ((va_get_vec 2 va_s0).hi3 == ws_opaque block (i - 14))) ((va_get_vec 3 va_s0).hi3 ==
ws_opaque block (i - 13))) ((va_get_vec 4 va_s0).hi3 == ws_opaque block (i - 12))) ((va_get_vec
5 va_s0).hi3 == ws_opaque block (i - 11))) ((va_get_vec 6 va_s0).hi3 == ws_opaque block (i -
10))) ((va_get_vec 7 va_s0).hi3 == ws_opaque block (i - 9))) ((va_get_vec 8 va_s0).hi3 ==
ws_opaque block (i - 8))) ((va_get_vec 9 va_s0).hi3 == ws_opaque block (i - 7))) ((va_get_vec
10 va_s0).hi3 == ws_opaque block (i - 6))) ((va_get_vec 11 va_s0).hi3 == ws_opaque block (i -
5))) ((va_get_vec 12 va_s0).hi3 == ws_opaque block (i - 4))) ((va_get_vec 13 va_s0).hi3 ==
ws_opaque block (i - 3))) ((va_get_vec 14 va_s0).hi3 == ws_opaque block (i - 2))) ((va_get_vec
15 va_s0).hi3 == ws_opaque block (i - 1)) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 == k_index
ks (i + 1)) ((va_get_vec 24 va_s0).hi2 == k_index ks (i + 2))) ((va_get_vec 24 va_s0).lo1 ==
k_index ks (i + 3)))) /\ (forall (va_x_r6: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_v20:quad32) (va_x_v21:quad32)
(va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let
va_sM = va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23
va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6
va_s0))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ (let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and (l_and (l_and (l_and
((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 == word_to_nat32 (index
next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index next_hash 3))) ((va_get_vec
20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 == word_to_nat32 (index
next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32 (index next_hash 7))
(k_index ks (i + 16)))) /\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16))
((va_get_vec 1 va_sM).hi3 == ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque
block (i + 2))) ((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4
va_sM).hi3 == ws_opaque block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5)))
((va_get_vec 6 va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque
block (i + 7))) ((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9
va_sM).hi3 == ws_opaque block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i +
10))) ((va_get_vec 11 va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 ==
ws_opaque block (i + 12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13)))
((va_get_vec 14 va_sM).hi3 == ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 ==
ws_opaque block (i + 15)) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17))
((va_get_vec 24 va_sM).hi2 == k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i
+ 19)))) ==> va_k va_sM (())))
val va_wpProof_Loop_rounds_16_47 : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
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 6]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop_rounds_16_47 (i:nat) (k_b:buffer128) (block:block_w) (hash_orig:hash256) :
(va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(va_QProc (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec
23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; 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 6])
(va_wp_Loop_rounds_16_47 i k_b block hash_orig) (va_wpProof_Loop_rounds_16_47 i k_b block
hash_orig))
//--
//-- Loop_rounds_48_63
val va_code_Loop_rounds_48_63 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_48_63 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_48_63 : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 -> block:block_w
-> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_48_63 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 33)) ((va_get_vec 2
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 34)) ((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 35)) ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 36)) ((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37)) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40)) ((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41)) ((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51)))))
(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 6 va_s0 + 48 /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.PPC64LE.Decls.validSrcAddrs128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.PPC64LE.Machine_s.pow2_64",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Prims.int",
"Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_48_63
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
16
(va_get_mem_layout va_s0)
Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
13
3
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and ((va_get_vec 0 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
48)
((va_get_vec 1 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
33))
((va_get_vec 2 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
34))
((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
35))
((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
36))
((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37))
((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38))
((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39))
((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40))
((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41))
((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42))
((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43))
((va_get_vec 12 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44))
((va_get_vec 13 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45))
((va_get_vec 14 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46))
((va_get_vec 15 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51))) /\
(forall (va_x_r6: 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_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32) (va_x_v23: quad32)
(va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(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
6
va_x_r6
va_s0
)
)
)
)
))
))))))))))
)))))))))))
in
va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 48 /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM)
(va_get_vec 17 va_sM)
(va_get_vec 18 va_sM)
(va_get_vec 19 va_sM)
(va_get_vec 20 va_sM)
(va_get_vec 21 va_sM)
(va_get_vec 22 va_sM)
(va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) ==>
va_k va_sM (()))) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_mask48 | val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1) | val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1) | let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 249,
"start_col": 0,
"start_line": 243
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(ensures
(let r = a &. Hacl.Spec.K256.Field52.Definitions.mask48 in
Lib.IntTypes.v r = Lib.IntTypes.v a % Prims.pow2 48 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 r 1)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Hacl.Spec.K256.Field52.Definitions.felem_fits_last1",
"Prims.unit",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.op_Modulus",
"Prims.pow2",
"Prims.eq2",
"Lib.IntTypes.range_t",
"Lib.IntTypes.mod_mask",
"FStar.UInt32.__uint_to_t",
"Hacl.Spec.K256.Field52.Definitions.mask48",
"Lib.IntTypes.mod_mask_lemma",
"FStar.Pervasives.assert_norm",
"Prims.op_Subtraction",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Amp_Dot"
] | [] | true | false | true | false | false | let lemma_mask48 a =
| let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_mask52 | val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1) | val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1) | let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 236,
"start_col": 0,
"start_line": 230
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(ensures
(let r = a &. Hacl.Spec.K256.Field52.Definitions.mask52 in
Lib.IntTypes.v r = Lib.IntTypes.v a % Prims.pow2 52 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits1 r 1)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Hacl.Spec.K256.Field52.Definitions.felem_fits1",
"Prims.unit",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.op_Modulus",
"Prims.pow2",
"Prims.eq2",
"Lib.IntTypes.range_t",
"Lib.IntTypes.mod_mask",
"FStar.UInt32.__uint_to_t",
"Hacl.Spec.K256.Field52.Definitions.mask52",
"Lib.IntTypes.mod_mask_lemma",
"FStar.Pervasives.assert_norm",
"Prims.op_Subtraction",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Amp_Dot"
] | [] | true | false | true | false | false | let lemma_mask52 a =
| let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_carry52 | val lemma_carry52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52)) | val lemma_carry52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52)) | let lemma_carry52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52 m1 m2 a b | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 27,
"end_line": 309,
"start_col": 0,
"start_line": 307
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1)
let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1)
val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52 m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
(==) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1))
val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52_last m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max48 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 48 12 }
m1 * max48 + max48;
(==) { Math.Lemmas.distributivity_add_left m1 1 max48 }
(m1 + 1) * max48;
};
Math.Lemmas.lemma_mult_le_right max48 (m1 + 1) 65536;
assert_norm (65536 * max48 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits_last1 c (m1 + 1))
val lemma_carry52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
m1: Hacl.Spec.K256.Field52.Definitions.scale64 ->
m2: Hacl.Spec.K256.Field52.Definitions.scale64 ->
a: Lib.IntTypes.uint64 ->
b: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.K256.Field52.Definitions.felem_fits1 a m1 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in
let d = b &. Hacl.Spec.K256.Field52.Definitions.mask52 in
Hacl.Spec.K256.Field52.Definitions.felem_fits1 d 1 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits1 c (m1 + 1) /\
Lib.IntTypes.v d = Lib.IntTypes.v b % Prims.pow2 52 /\
Lib.IntTypes.v c = Lib.IntTypes.v a + Lib.IntTypes.v b / Prims.pow2 52)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.scale64",
"Lib.IntTypes.uint64",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_add_rsh52",
"Prims.unit",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_mask52"
] | [] | true | false | true | false | false | let lemma_carry52 m1 m2 a b =
| lemma_mask52 b;
lemma_add_rsh52 m1 m2 a b | false |
Hacl.Bignum64.fsti | Hacl.Bignum64.t_limbs | val t_limbs:Hacl.Bignum.Definitions.limb_t | val t_limbs:Hacl.Bignum.Definitions.limb_t | let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U64 | {
"file_name": "code/bignum/Hacl.Bignum64.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 62,
"end_line": 12,
"start_col": 0,
"start_line": 12
} | module Hacl.Bignum64
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum64.fsti"
} | [
{
"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.Definitions.limb_t | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.U64"
] | [] | false | false | false | true | false | let t_limbs:Hacl.Bignum.Definitions.limb_t =
| Lib.IntTypes.U64 | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_small_sub_mod | val lemma_small_sub_mod: a:nat -> n:pos -> Lemma
(requires n <= a /\ a < 2 * n)
(ensures a % n = a - n) | val lemma_small_sub_mod: a:nat -> n:pos -> Lemma
(requires n <= a /\ a < 2 * n)
(ensures a % n = a - n) | let lemma_small_sub_mod a n =
calc (==) {
a % n;
(==) { Math.Lemmas.sub_div_mod_1 a n }
(a - n) % n;
(==) { Math.Lemmas.small_mod (a - n) n }
a - n;
} | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 335,
"start_col": 0,
"start_line": 328
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1)
let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1)
val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52 m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
(==) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1))
val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52_last m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max48 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 48 12 }
m1 * max48 + max48;
(==) { Math.Lemmas.distributivity_add_left m1 1 max48 }
(m1 + 1) * max48;
};
Math.Lemmas.lemma_mult_le_right max48 (m1 + 1) 65536;
assert_norm (65536 * max48 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits_last1 c (m1 + 1))
val lemma_carry52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52))
let lemma_carry52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52 m1 m2 a b
val lemma_carry_last52: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits_last1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52))
let lemma_carry_last52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52_last m1 m2 a b
val lemma_small_sub_mod: a:nat -> n:pos -> Lemma
(requires n <= a /\ a < 2 * n)
(ensures a % n = a - n) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Prims.nat -> n: Prims.pos
-> FStar.Pervasives.Lemma (requires n <= a /\ a < 2 * n) (ensures a % n = a - n) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Prims.pos",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Modulus",
"Prims.op_Subtraction",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.sub_div_mod_1",
"Prims.squash",
"FStar.Math.Lemmas.small_mod"
] | [] | false | false | true | false | false | let lemma_small_sub_mod a n =
| calc ( == ) {
a % n;
( == ) { Math.Lemmas.sub_div_mod_1 a n }
(a - n) % n;
( == ) { Math.Lemmas.small_mod (a - n) n }
a - n;
} | false |
Hacl.Bignum64.fsti | Hacl.Bignum64.lbignum | val lbignum : t: Hacl.Bignum.Definitions.limb_t -> len: Lib.IntTypes.size_t -> Type0 | let lbignum = Hacl.Bignum.Definitions.lbignum | {
"file_name": "code/bignum/Hacl.Bignum64.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 15,
"start_col": 0,
"start_line": 15
} | module Hacl.Bignum64
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U64 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum64.fsti"
} | [
{
"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 | t: Hacl.Bignum.Definitions.limb_t -> len: Lib.IntTypes.size_t -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.lbignum"
] | [] | false | false | false | true | true | let lbignum =
| Hacl.Bignum.Definitions.lbignum | false |
|
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_nat_from_bytes_be_mod2 | val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2) | val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2) | let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 84,
"end_line": 37,
"start_col": 0,
"start_line": 32
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Lib.Sequence.lseq Lib.IntTypes.uint8 32
-> FStar.Pervasives.Lemma
(ensures Lib.ByteSequence.nat_from_bytes_be f % 2 = Lib.IntTypes.v (Lib.Sequence.index f 31) % 2
) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.Sequence.lseq",
"Lib.IntTypes.uint8",
"Hacl.Spec.K256.MathLemmas.lemma_a_plus_b_pow2_mod2",
"Lib.IntTypes.v",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.ByteSequence.nat_from_intseq_be",
"Lib.Sequence.slice",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"Lib.ByteSequence.nat_from_intseq_be_lemma0",
"Lib.ByteSequence.nat_from_intseq_be_slice_lemma",
"Lib.IntTypes.int_t",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index"
] | [] | true | false | true | false | false | let lemma_nat_from_bytes_be_mod2 f =
| let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8 | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_add_rsh52 | val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52)) | val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52)) | let lemma_add_rsh52 m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
(==) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1)) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 273,
"start_col": 0,
"start_line": 257
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1)
let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1)
val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
m1: Hacl.Spec.K256.Field52.Definitions.scale64 ->
m2: Hacl.Spec.K256.Field52.Definitions.scale64 ->
a: Lib.IntTypes.uint64 ->
b: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.K256.Field52.Definitions.felem_fits1 a m1 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in
Hacl.Spec.K256.Field52.Definitions.felem_fits1 c (m1 + 1) /\
Lib.IntTypes.v c = Lib.IntTypes.v a + Lib.IntTypes.v b / Prims.pow2 52)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.scale64",
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Hacl.Spec.K256.Field52.Definitions.felem_fits1",
"Prims.op_Addition",
"Prims.unit",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.op_Division",
"Prims.pow2",
"FStar.Math.Lemmas.small_mod",
"FStar.Pervasives.assert_norm",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Hacl.Spec.K256.Field52.Definitions.max52",
"FStar.Math.Lemmas.lemma_mult_le_right",
"FStar.Calc.calc_finish",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.eq2",
"Prims.op_LessThanOrEqual",
"Prims.Nil",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.lemma_div_lt",
"Prims.squash",
"FStar.Math.Lemmas.pow2_lt_compat",
"FStar.Math.Lemmas.distributivity_add_left",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Plus_Dot",
"Lib.IntTypes.op_Greater_Greater_Dot",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | true | false | false | let lemma_add_rsh52 m1 m2 a b =
| let c = a +. (b >>. 52ul) in
calc ( < ) {
v a + v b / pow2 52;
( < ) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
( <= ) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
( == ) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1)) | false |
Steel.ST.GhostPCMReference.fst | Steel.ST.GhostPCMReference.ref | val ref (a:Type u#0) (p:pcm a) : Type u#0 | val ref (a:Type u#0) (p:pcm a) : Type u#0 | let ref (a:Type u#0) (p:pcm a) : Type u#0 =
G.ref (raise_t u#0 u#1 a) (UP.raise p) | {
"file_name": "lib/steel/Steel.ST.GhostPCMReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 42,
"end_line": 26,
"start_col": 0,
"start_line": 25
} | (*
Copyright 2021 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.ST.GhostPCMReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
open FStar.PCM
open FStar.Universe
module UP = FStar.Universe.PCM
module G = Steel.GhostPCMReference | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.GhostPCMReference.fsti.checked",
"prims.fst.checked",
"FStar.Universe.PCM.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GhostPCMReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.GhostPCMReference",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Universe.PCM",
"short_module": "UP"
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": 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: Type0 -> p: FStar.PCM.pcm a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.PCM.pcm",
"Steel.GhostPCMReference.ref",
"FStar.Universe.raise_t",
"FStar.Universe.PCM.raise"
] | [] | false | false | false | true | true | let ref (a: Type u#0) (p: pcm a) : Type u#0 =
| G.ref (raise_t u#0 u#1 a) (UP.raise p) | false |
Steel.ST.GhostPCMReference.fst | Steel.ST.GhostPCMReference.pts_to | val pts_to (#a:Type u#0) (#pcm:pcm a) (r:ref a pcm) ([@@@smt_fallback] v:a)
: vprop | val pts_to (#a:Type u#0) (#pcm:pcm a) (r:ref a pcm) ([@@@smt_fallback] v:a)
: vprop | let pts_to (#a:Type u#0) (#pcm:pcm a) (r:ref a pcm) ([@@@smt_fallback] v:a)
= G.pts_to #(raise_t a) #(UP.raise pcm) r (raise_val v) | {
"file_name": "lib/steel/Steel.ST.GhostPCMReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 57,
"end_line": 30,
"start_col": 0,
"start_line": 29
} | (*
Copyright 2021 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.ST.GhostPCMReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
open FStar.PCM
open FStar.Universe
module UP = FStar.Universe.PCM
module G = Steel.GhostPCMReference
let ref (a:Type u#0) (p:pcm a) : Type u#0 =
G.ref (raise_t u#0 u#1 a) (UP.raise p) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.GhostPCMReference.fsti.checked",
"prims.fst.checked",
"FStar.Universe.PCM.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GhostPCMReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.GhostPCMReference",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Universe.PCM",
"short_module": "UP"
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": 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.ST.GhostPCMReference.ref a pcm -> v: a -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"FStar.PCM.pcm",
"Steel.ST.GhostPCMReference.ref",
"Steel.GhostPCMReference.pts_to",
"FStar.Universe.raise_t",
"FStar.Universe.PCM.raise",
"FStar.Universe.raise_val",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | false | false | let pts_to (#a: Type u#0) (#pcm: pcm a) (r: ref a pcm) ([@@@ smt_fallback]v: a) =
| G.pts_to #(raise_t a) #(UP.raise pcm) r (raise_val v) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_add_rsh52_last | val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52)) | val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52)) | let lemma_add_rsh52_last m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max48 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 48 12 }
m1 * max48 + max48;
(==) { Math.Lemmas.distributivity_add_left m1 1 max48 }
(m1 + 1) * max48;
};
Math.Lemmas.lemma_mult_le_right max48 (m1 + 1) 65536;
assert_norm (65536 * max48 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits_last1 c (m1 + 1)) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 297,
"start_col": 0,
"start_line": 281
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1)
let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1)
val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52 m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
(==) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1))
val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
m1: Hacl.Spec.K256.Field52.Definitions.scale64_last ->
m2: Hacl.Spec.K256.Field52.Definitions.scale64 ->
a: Lib.IntTypes.uint64 ->
b: Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 a m1 /\
Hacl.Spec.K256.Field52.Definitions.felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 c (m1 + 1) /\
Lib.IntTypes.v c = Lib.IntTypes.v a + Lib.IntTypes.v b / Prims.pow2 52)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.scale64_last",
"Hacl.Spec.K256.Field52.Definitions.scale64",
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Hacl.Spec.K256.Field52.Definitions.felem_fits_last1",
"Prims.op_Addition",
"Prims.unit",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.op_Division",
"Prims.pow2",
"FStar.Math.Lemmas.small_mod",
"FStar.Pervasives.assert_norm",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Hacl.Spec.K256.Field52.Definitions.max48",
"FStar.Math.Lemmas.lemma_mult_le_right",
"FStar.Calc.calc_finish",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.eq2",
"Prims.op_LessThanOrEqual",
"Prims.Nil",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"FStar.Math.Lemmas.lemma_div_lt",
"Prims.squash",
"FStar.Math.Lemmas.pow2_lt_compat",
"FStar.Math.Lemmas.distributivity_add_left",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Plus_Dot",
"Lib.IntTypes.op_Greater_Greater_Dot",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | true | false | false | let lemma_add_rsh52_last m1 m2 a b =
| let c = a +. (b >>. 52ul) in
calc ( < ) {
v a + v b / pow2 52;
( < ) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max48 + pow2 12;
( <= ) { Math.Lemmas.pow2_lt_compat 48 12 }
m1 * max48 + max48;
( == ) { Math.Lemmas.distributivity_add_left m1 1 max48 }
(m1 + 1) * max48;
};
Math.Lemmas.lemma_mult_le_right max48 (m1 + 1) 65536;
assert_norm (65536 * max48 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits_last1 c (m1 + 1)) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_decompose | val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52)) | val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52)) | let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52) | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 174,
"start_col": 0,
"start_line": 152
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52)) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Hacl.Spec.K256.Field52.Definitions.felem5
-> FStar.Pervasives.Lemma
(requires Hacl.Spec.K256.Field52.Definitions.felem_fits5 f (1, 1, 1, 1, 1))
(ensures
(let _ = f in
(let FStar.Pervasives.Native.Mktuple5 #_ #_ #_ #_ #_ f0 f1 f2 f3 f4 = _ in
Lib.IntTypes.v f4 =
Hacl.Spec.K256.Field52.Definitions.as_nat5 f / Hacl.Spec.K256.Field52.Definitions.pow208 /\
Lib.IntTypes.v f3 =
Hacl.Spec.K256.Field52.Definitions.as_nat5 f % Hacl.Spec.K256.Field52.Definitions.pow208 /
Hacl.Spec.K256.Field52.Definitions.pow156 /\
Lib.IntTypes.v f2 =
Hacl.Spec.K256.Field52.Definitions.as_nat5 f % Hacl.Spec.K256.Field52.Definitions.pow156 /
Hacl.Spec.K256.Field52.Definitions.pow104 /\
Lib.IntTypes.v f1 =
Hacl.Spec.K256.Field52.Definitions.as_nat5 f % Hacl.Spec.K256.Field52.Definitions.pow104 /
Hacl.Spec.K256.Field52.Definitions.pow52 /\
Lib.IntTypes.v f0 =
Hacl.Spec.K256.Field52.Definitions.as_nat5 f % Hacl.Spec.K256.Field52.Definitions.pow52)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Spec.K256.Field52.Definitions.felem5",
"Lib.IntTypes.uint64",
"Prims._assert",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.op_Modulus",
"Hacl.Spec.K256.Field52.Definitions.as_nat5",
"Hacl.Spec.K256.Field52.Definitions.pow52",
"Prims.unit",
"Prims.eq2",
"Hacl.Spec.K256.Field52.Definitions.pow104",
"FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1",
"Prims.op_Division",
"FStar.Math.Lemmas.euclidean_division_definition",
"Hacl.Spec.K256.Field52.Definitions.pow156",
"Hacl.Spec.K256.Field52.Definitions.pow208",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_as_nat_bound"
] | [] | false | false | true | false | false | let lemma_as_nat_decompose f =
| let f0, f1, f2, f3, f4 = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52) | false |
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.unfold_nat_from_uint64_four | val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192) | val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192) | let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0 | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 66,
"start_col": 0,
"start_line": 45
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Lib.Sequence.lseq Lib.IntTypes.uint64 4
-> FStar.Pervasives.Lemma
(ensures
Lib.ByteSequence.nat_from_intseq_be b ==
Lib.IntTypes.v (Lib.Sequence.index b 3) +
Lib.IntTypes.v (Lib.Sequence.index b 2) * Prims.pow2 64 +
Lib.IntTypes.v (Lib.Sequence.index b 1) * Prims.pow2 128 +
Lib.IntTypes.v (Lib.Sequence.index b 0) * Prims.pow2 192) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.Sequence.lseq",
"Lib.IntTypes.uint64",
"Hacl.Spec.K256.MathLemmas.lemma_as_nat64_horner",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"Lib.ByteSequence.nat_from_intseq_be_lemma0",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.slice",
"Lib.ByteSequence.nat_from_intseq_be",
"Lib.ByteSequence.nat_from_intseq_be_slice_lemma",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Multiply",
"Lib.Sequence.length",
"Lib.IntTypes.int_t",
"Lib.IntTypes.range",
"Lib.IntTypes.v",
"Lib.Sequence.index"
] | [] | true | false | true | false | false | let unfold_nat_from_uint64_four b =
| let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) ==
b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) ==
b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0 | false |
Hacl.Bignum64.fsti | Hacl.Bignum64.pbn_mont_ctx_u64 | val pbn_mont_ctx_u64 : Type0 | let pbn_mont_ctx_u64 = MA.pbn_mont_ctx_u64 | {
"file_name": "code/bignum/Hacl.Bignum64.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 42,
"end_line": 17,
"start_col": 0,
"start_line": 17
} | module Hacl.Bignum64
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U64
inline_for_extraction noextract
let lbignum = Hacl.Bignum.Definitions.lbignum | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum64.fsti"
} | [
{
"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 | Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx_u64"
] | [] | false | false | false | true | true | let pbn_mont_ctx_u64 =
| MA.pbn_mont_ctx_u64 | false |
|
Hacl.Spec.K256.Field52.Definitions.Lemmas.fst | Hacl.Spec.K256.Field52.Definitions.Lemmas.carry_last_small_mod_lemma | val carry_last_small_mod_lemma: t4:uint64 -> t3':uint64 -> Lemma
(requires felem_fits_last1 t4 1 /\
v (t4 +. (t3' >>. 52ul)) == v t4 + v t3' / pow2 52)
(ensures (let r = t4 +. (t3' >>. 52ul) in
felem_fits_last1 r 2 /\
v r < v t4 + pow2 12 /\ (v r >= pow2 48 ==> v r % pow2 48 < pow2 12))) | val carry_last_small_mod_lemma: t4:uint64 -> t3':uint64 -> Lemma
(requires felem_fits_last1 t4 1 /\
v (t4 +. (t3' >>. 52ul)) == v t4 + v t3' / pow2 52)
(ensures (let r = t4 +. (t3' >>. 52ul) in
felem_fits_last1 r 2 /\
v r < v t4 + pow2 12 /\ (v r >= pow2 48 ==> v r % pow2 48 < pow2 12))) | let carry_last_small_mod_lemma t4 t3' =
let r = t4 +. (t3' >>. 52ul) in
assert (v r = v t4 + v t3' / pow2 52);
Math.Lemmas.lemma_div_lt (v t3') 64 52;
assert (v r < v t4 + pow2 12);
Math.Lemmas.pow2_lt_compat 48 12;
assert (felem_fits_last1 r 2);
if v r >= pow2 48 then begin
lemma_small_sub_mod (v r) (pow2 48);
assert (v r % pow2 48 = v r - pow2 48);
assert (v r % pow2 48 < pow2 12) end | {
"file_name": "code/k256/Hacl.Spec.K256.Field52.Definitions.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 356,
"start_col": 0,
"start_line": 345
} | module Hacl.Spec.K256.Field52.Definitions.Lemmas
open FStar.Mul
open Lib.IntTypes
open Hacl.Spec.K256.Field52.Definitions
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module S = Spec.K256
module ML = Hacl.Spec.K256.MathLemmas
#set-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val lemma_as_nat_mod2: x:felem5 ->
Lemma (let (x0,x1,x2,x3,x4) = x in as_nat5 x % 2 = v x0 % 2)
let lemma_as_nat_mod2 x =
let (x0,x1,x2,x3,x4) = x in
assert (as_nat5 x = v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208);
assert (as_nat5 x % 2 = (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156 + v x4 * pow208) % 2);
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104 + v x3 * pow156) (v x4) 208;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52 + v x2 * pow104) (v x3) 156;
ML.lemma_a_plus_b_pow2_mod2 (v x0 + v x1 * pow52) (v x2) 104;
ML.lemma_a_plus_b_pow2_mod2 (v x0) (v x1) 52;
assert (as_nat5 x % 2 = v x0 % 2)
val lemma_nat_from_bytes_be_mod2: f:LSeq.lseq uint8 32 ->
Lemma (BSeq.nat_from_bytes_be f % 2 = v (LSeq.index f 31) % 2)
let lemma_nat_from_bytes_be_mod2 f =
let x0 = LSeq.index f 31 in
BSeq.nat_from_intseq_be_slice_lemma f 31;
BSeq.nat_from_intseq_be_lemma0 (LSeq.slice f 31 32);
assert (BSeq.nat_from_intseq_be f == v x0 + pow2 8 * BSeq.nat_from_intseq_be (LSeq.slice f 0 31));
ML.lemma_a_plus_b_pow2_mod2 (v x0) (BSeq.nat_from_intseq_be (LSeq.slice f 0 31)) 8
val unfold_nat_from_uint64_four: b:LSeq.lseq uint64 4 ->
Lemma (BSeq.nat_from_intseq_be b ==
v (LSeq.index b 3) + v (LSeq.index b 2) * pow2 64 +
v (LSeq.index b 1) * pow2 128 + v (LSeq.index b 0) * pow2 192)
let unfold_nat_from_uint64_four b =
let b0 = v (LSeq.index b 0) in
let b1 = v (LSeq.index b 1) in
let b2 = v (LSeq.index b 2) in
let b3 = v (LSeq.index b 3) in
let res = BSeq.nat_from_intseq_be b in
BSeq.nat_from_intseq_be_slice_lemma b 3;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 3 4);
assert (res == b3 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 3)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #3 (Seq.slice b 0 3) 2;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 2 3);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 3) == b2 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 2)));
BSeq.nat_from_intseq_be_slice_lemma #U64 #SEC #2 (Seq.slice b 0 2) 1;
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 1 2);
assert (BSeq.nat_from_intseq_be (Seq.slice b 0 2) == b1 + pow2 64 * (BSeq.nat_from_intseq_be (Seq.slice b 0 1)));
BSeq.nat_from_intseq_be_lemma0 (Seq.slice b 0 1);
assert (res == b3 + pow2 64 * (b2 + pow2 64 * (b1 + pow2 64 * b0)));
ML.lemma_as_nat64_horner b3 b2 b1 b0
val lemma_prime : unit -> Lemma (pow2 256 % S.prime = 0x1000003D1)
let lemma_prime () = ()
val lemma_pow2_256_minus_prime : unit -> Lemma (pow2 256 - S.prime = 0x1000003D1)
let lemma_pow2_256_minus_prime () = ()
val lemma_pow2_260_mod_prime: unit -> Lemma (pow2 260 % S.prime = 0x1000003D10)
let lemma_pow2_260_mod_prime () =
calc (==) {
pow2 260 % S.prime;
(==) { Math.Lemmas.pow2_plus 256 4 }
pow2 256 * pow2 4 % S.prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_l (pow2 256) (pow2 4) S.prime }
(pow2 256 % S.prime) * pow2 4 % S.prime;
(==) { lemma_prime () }
0x1000003D1 * pow2 4 % S.prime;
(==) { assert_norm (0x1000003D1 * pow2 4 = 0x1000003D10) }
0x1000003D10 % S.prime;
(==) { Math.Lemmas.small_mod 0x1000003D10 S.prime }
0x1000003D10;
}
val lemma_as_nat_bound_f4_lt_powa: f:felem5 -> a:nat -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 a))
(ensures as_nat5 f <= pow2 (208 + a) - 1)
let lemma_as_nat_bound_f4_lt_powa f a =
let (f0,f1,f2,f3,f4) = f in
calc (<=) { //as_nat5 f ==
v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) { }
pow2 52 - 1 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208;
(<=) {
Math.Lemmas.lemma_mult_le_right pow52 (v f1) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow52 }
pow2 52 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow104 (v f2) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow104;
Math.Lemmas.pow2_plus 52 52 }
pow2 52 * pow104 + v f3 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow156 (v f3) (pow2 52 - 1);
Math.Lemmas.distributivity_sub_left (pow2 52) 1 pow156;
Math.Lemmas.pow2_plus 52 104 }
pow2 52 * pow156 + v f4 * pow208 - 1;
(<=) {
Math.Lemmas.lemma_mult_le_right pow208 (v f4) (pow2 a - 1);
Math.Lemmas.distributivity_sub_left (pow2 a) 1 pow208;
Math.Lemmas.pow2_plus 52 156;
Math.Lemmas.pow2_plus a 208 }
pow2 (208 + a) - 1;
}
val lemma_as_nat_bound: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures as_nat5 f < pow2 256)
let lemma_as_nat_bound f =
lemma_as_nat_bound_f4_lt_powa f 48
val lemma_as_nat_bound_f4_lt_pow12: f:felem5 -> Lemma
(requires (let (f0,f1,f2,f3,f4) = f in
felem_fits5 f (1,1,1,1,1) /\ v f4 < pow2 12))
(ensures as_nat5 f <= pow2 220 - 1)
let lemma_as_nat_bound_f4_lt_pow12 f =
lemma_as_nat_bound_f4_lt_powa f 12
val lemma_as_nat_decompose: f:felem5 -> Lemma
(requires felem_fits5 f (1,1,1,1,1))
(ensures (let (f0,f1,f2,f3,f4) = f in
v f4 = as_nat5 f / pow208 /\
v f3 = as_nat5 f % pow208 / pow156 /\
v f2 = as_nat5 f % pow156 / pow104 /\
v f1 = as_nat5 f % pow104 / pow52 /\
v f0 = as_nat5 f % pow52))
let lemma_as_nat_decompose f =
let (f0,f1,f2,f3,f4) = f in
lemma_as_nat_bound f;
Math.Lemmas.euclidean_division_definition (as_nat5 f) pow208;
assert (v f4 = as_nat5 f / pow208);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow208) pow156;
assert (v f3 = as_nat5 f % pow208 / pow156);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 156 208;
assert (as_nat5 f % pow208 % pow156 == as_nat5 f % pow156);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow156) pow104;
assert (v f2 = as_nat5 f % pow156 / pow104);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 104 156;
assert (as_nat5 f % pow156 % pow104 == as_nat5 f % pow104);
Math.Lemmas.euclidean_division_definition (as_nat5 f % pow104) pow52;
assert (v f1 = as_nat5 f % pow104 / pow52);
Math.Lemmas.pow2_modulo_modulo_lemma_1 (as_nat5 f) 52 104;
assert (as_nat5 f % pow104 % pow52 == as_nat5 f % pow52);
assert (v f0 = as_nat5 f % pow52)
#push-options "--ifuel 1"
val as_nat_inj (f1 f2: felem5) : Lemma
(requires
felem_fits5 f1 (1,1,1,1,1) /\ felem_fits5 f2 (1,1,1,1,1) /\
as_nat5 f1 == as_nat5 f2)
(ensures
(let (a0,a1,a2,a3,a4) = f1 in let (b0,b1,b2,b3,b4) = f2 in
a0 == b0 /\ a1 == b1 /\ a2 == b2 /\ a3 == b3 /\ a4 == b4))
let as_nat_inj f1 f2 =
lemma_as_nat_decompose f1;
lemma_as_nat_decompose f2
#pop-options
val lemma_normalize_x_le_1: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 <= 1)
let lemma_normalize_x_le_1 t4 =
calc (==) {
(2 * (pow2 48 - 1)) / pow2 48;
(==) { Math.Lemmas.distributivity_add_right 2 (pow2 48) 1 }
(2 * pow2 48 - 2) / pow2 48;
(==) { Math.Lemmas.division_addition_lemma (-2) (pow2 48) 2 }
(-2) / pow2 48 + 2;
(==) { assert_norm ((-2) / pow2 48 = -1) }
1;
};
assert (v t4 <= 2 * (pow2 48 - 1));
Math.Lemmas.lemma_div_le (v t4) (2 * pow2 48 - 2) (pow2 48);
assert (v t4 / pow2 48 <= 1)
val lemma_div_pow48: t4:uint64 -> Lemma
(requires felem_fits_last1 t4 2)
(ensures v t4 / pow2 48 == (if v t4 < pow2 48 then 0 else 1))
let lemma_div_pow48 t4 =
if v t4 < pow2 48 then
Math.Lemmas.small_div (v t4) (pow2 48)
else begin
lemma_normalize_x_le_1 t4;
assert (v t4 / pow2 48 <= 1);
Math.Lemmas.lemma_div_le (pow2 48) (v t4) (pow2 48);
assert (1 <= v t4 / pow2 48) end
val lemma_mask52: a:uint64 ->
Lemma (let r = a &. mask52 in
v r = v a % pow2 52 /\ felem_fits1 r 1)
let lemma_mask52 a =
let r = a &. mask52 in
assert_norm (v mask52 = pow2 52 - 1);
mod_mask_lemma a 52ul;
assert (v (mod_mask #U64 #SEC 52ul) == v mask52);
assert (v r = v a % pow2 52);
assert (felem_fits1 r 1)
val lemma_mask48: a:uint64 ->
Lemma (let r = a &. mask48 in
v r = v a % pow2 48 /\ felem_fits_last1 r 1)
let lemma_mask48 a =
let r = a &. mask48 in
assert_norm (v mask48 = pow2 48 - 1);
mod_mask_lemma a 48ul;
assert (v (mod_mask #U64 #SEC 48ul) == v mask48);
assert (v r = v a % pow2 48);
assert (felem_fits_last1 r 1)
val lemma_add_rsh52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52 m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max52 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 52 12 }
m1 * max52 + max52;
(==) { Math.Lemmas.distributivity_add_left m1 1 max52 }
(m1 + 1) * max52;
};
Math.Lemmas.lemma_mult_le_right max52 (m1 + 1) 4096;
assert_norm (4096 * max52 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits1 c (m1 + 1))
val lemma_add_rsh52_last: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures (let c = a +. (b >>. 52ul) in
felem_fits_last1 c (m1 + 1) /\ v c = v a + v b / pow2 52))
let lemma_add_rsh52_last m1 m2 a b =
let c = a +. (b >>. 52ul) in
calc (<) {
v a + v b / pow2 52;
(<) { Math.Lemmas.lemma_div_lt (v b) 64 52 }
m1 * max48 + pow2 12;
(<=) { Math.Lemmas.pow2_lt_compat 48 12 }
m1 * max48 + max48;
(==) { Math.Lemmas.distributivity_add_left m1 1 max48 }
(m1 + 1) * max48;
};
Math.Lemmas.lemma_mult_le_right max48 (m1 + 1) 65536;
assert_norm (65536 * max48 < pow2 64);
Math.Lemmas.small_mod (v a + v b / pow2 52) (pow2 64);
assert (v c = v a + v b / pow2 52);
assert (felem_fits_last1 c (m1 + 1))
val lemma_carry52: m1:scale64 -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 4096)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52))
let lemma_carry52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52 m1 m2 a b
val lemma_carry_last52: m1:scale64_last -> m2:scale64 -> a:uint64 -> b:uint64 -> Lemma
(requires felem_fits_last1 a m1 /\ felem_fits1 b m2 /\ m1 + 1 <= 65536)
(ensures
(let c = a +. (b >>. 52ul) in let d = b &. mask52 in
felem_fits1 d 1 /\ felem_fits_last1 c (m1 + 1) /\
v d = v b % pow2 52 /\ v c = v a + v b / pow2 52))
let lemma_carry_last52 m1 m2 a b =
lemma_mask52 b;
lemma_add_rsh52_last m1 m2 a b
val lemma_small_sub_mod: a:nat -> n:pos -> Lemma
(requires n <= a /\ a < 2 * n)
(ensures a % n = a - n)
let lemma_small_sub_mod a n =
calc (==) {
a % n;
(==) { Math.Lemmas.sub_div_mod_1 a n }
(a - n) % n;
(==) { Math.Lemmas.small_mod (a - n) n }
a - n;
}
val carry_last_small_mod_lemma: t4:uint64 -> t3':uint64 -> Lemma
(requires felem_fits_last1 t4 1 /\
v (t4 +. (t3' >>. 52ul)) == v t4 + v t3' / pow2 52)
(ensures (let r = t4 +. (t3' >>. 52ul) in
felem_fits_last1 r 2 /\
v r < v t4 + pow2 12 /\ (v r >= pow2 48 ==> v r % pow2 48 < pow2 12))) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.K256.MathLemmas.fst.checked",
"Hacl.Spec.K256.Field52.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.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.Field52.Definitions.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.K256.MathLemmas",
"short_module": "ML"
},
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256.Field52.Definitions",
"short_module": null
},
{
"abbrev": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t4: Lib.IntTypes.uint64 -> t3': Lib.IntTypes.uint64
-> FStar.Pervasives.Lemma
(requires
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 t4 1 /\
Lib.IntTypes.v (t4 +. (t3' >>. 52ul)) ==
Lib.IntTypes.v t4 + Lib.IntTypes.v t3' / Prims.pow2 52)
(ensures
(let r = t4 +. (t3' >>. 52ul) in
Hacl.Spec.K256.Field52.Definitions.felem_fits_last1 r 2 /\
Lib.IntTypes.v r < Lib.IntTypes.v t4 + Prims.pow2 12 /\
(Lib.IntTypes.v r >= Prims.pow2 48 ==> Lib.IntTypes.v r % Prims.pow2 48 < Prims.pow2 12))) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Lib.IntTypes.uint64",
"Prims.op_GreaterThanOrEqual",
"Lib.IntTypes.v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Prims.pow2",
"Prims._assert",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Modulus",
"Prims.unit",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Hacl.Spec.K256.Field52.Definitions.Lemmas.lemma_small_sub_mod",
"Prims.bool",
"Hacl.Spec.K256.Field52.Definitions.felem_fits_last1",
"FStar.Math.Lemmas.pow2_lt_compat",
"Prims.op_Addition",
"FStar.Math.Lemmas.lemma_div_lt",
"Prims.op_Division",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Plus_Dot",
"Lib.IntTypes.op_Greater_Greater_Dot",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | true | false | false | let carry_last_small_mod_lemma t4 t3' =
| let r = t4 +. (t3' >>. 52ul) in
assert (v r = v t4 + v t3' / pow2 52);
Math.Lemmas.lemma_div_lt (v t3') 64 52;
assert (v r < v t4 + pow2 12);
Math.Lemmas.pow2_lt_compat 48 12;
assert (felem_fits_last1 r 2);
if v r >= pow2 48
then
(lemma_small_sub_mod (v r) (pow2 48);
assert (v r % pow2 48 = v r - pow2 48);
assert (v r % pow2 48 < pow2 12)) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.felem | val felem : Type0 | let felem = x:nat{x < prime} | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 20,
"start_col": 0,
"start_line": 20
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.prime"
] | [] | false | false | false | true | true | let felem =
| x: nat{x < prime} | false |
|
Pulse.Checker.STApp.fst | Pulse.Checker.STApp.instantiate_implicits | val instantiate_implicits (g: env) (t: st_term{Tm_STApp? t.term})
: T.Tac (uvs: env & g': env{extends_with g' g uvs} & t': st_term{Tm_STApp? t'.term}) | val instantiate_implicits (g: env) (t: st_term{Tm_STApp? t.term})
: T.Tac (uvs: env & g': env{extends_with g' g uvs} & t': st_term{Tm_STApp? t'.term}) | let instantiate_implicits (g:env) (t:st_term { Tm_STApp? t.term })
: T.Tac (uvs : env &
g' : env { extends_with g' g uvs } &
t' : st_term { Tm_STApp? t'.term }) =
let range = t.range in
let Tm_STApp { head; arg_qual=qual; arg } = t.term in
let pure_app = tm_pureapp head qual arg in
let (| uvs, t, ty |) = instantiate_term_implicits_uvs g pure_app in
match is_arrow ty with
| Some (_, Some Implicit, _) ->
//Some implicits to follow
intro_uvars_for_logical_implicits g uvs t ty
| _ ->
match is_pure_app t with
| Some (head, q, arg) ->
(| uvs, push_env g uvs, {term=Tm_STApp {head;arg_qual=q;arg}; range=t.range; effect_tag=default_effect_hint } |)
| _ ->
fail g (Some t.range)
(Printf.sprintf "check_stapp.instantiate_implicits: expected an application term, found: %s"
(show t)) | {
"file_name": "lib/steel/pulse/Pulse.Checker.STApp.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 20,
"end_line": 109,
"start_col": 0,
"start_line": 89
} | (*
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 Pulse.Checker.STApp
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module P = Pulse.Syntax.Printer
module Prover = Pulse.Checker.Prover
open Pulse.Show
let debug_log (g:env) (f:unit -> T.Tac unit) : T.Tac unit = if RU.debug_at_level (fstar_env g) "st_app" then f () else ()
let canon_comp (c:comp_st) : comp_st =
match readback_comp (elab_comp c) with
| None -> c
| Some (C_Tot _) -> c //should be impossible
| Some c' -> c'
#push-options "--admit_smt_queries true"
let canon_comp_eq_res (g:env) (c:comp_st)
: RT.equiv (elab_env g) (elab_term (comp_res c)) (elab_term (comp_res (canon_comp c)))
= RT.Rel_refl _ _ _
#pop-options
let canonicalize_st_typing (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
: st_typing g t (canon_comp c)
= let c' = canon_comp c in
let x = fresh g in
assume ( ~(x `Set.mem` freevars (comp_post c)) /\
~(x `Set.mem` freevars (comp_post c')) );
assume (st_equiv_pre c c');
let st_eq
: st_equiv g c c'
= ST_VPropEquiv g c c' x (RU.magic ()) (RU.magic()) (RU.magic()) (canon_comp_eq_res g c) (RU.magic()) (RU.magic())
in
T_Equiv _ _ _ _ d st_eq
let coerce_eq (#a #b:Type) (x:a) (_:squash (a === b)) : y:b { y == x } = x
let rec intro_uvars_for_logical_implicits (g:env) (uvs:env { disjoint g uvs }) (t:term) (ty:term)
: T.Tac (uvs':env &
g':env { extends_with g' g uvs' } &
t':st_term { Tm_STApp? t'.term }) =
let ropt = is_arrow ty in
match ropt with
| Some (b, Some Implicit, c_rest) ->
let x = fresh (push_env g uvs) in
let uvs' = push_binding uvs x b.binder_ppname b.binder_ty in
let c_rest = open_comp_with c_rest (tm_var {nm_index = x; nm_ppname = b.binder_ppname}) in
begin
match c_rest with
| C_ST _
| C_STAtomic _ _ _
| C_STGhost _ ->
(| uvs', push_env g uvs', {term=Tm_STApp {head=t;arg_qual=Some Implicit;arg=null_var x};
range=t.range;
effect_tag=as_effect_hint (ctag_of_comp_st c_rest) } |)
| C_Tot ty ->
intro_uvars_for_logical_implicits g uvs' (tm_pureapp t (Some Implicit) (null_var x)) ty
end
| _ ->
fail g None
(Printf.sprintf "check_stapp.intro_uvars_for_logical_implicits: expected an arrow type,\
with an implicit parameter, found: %s"
(P.term_to_string ty)) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Show.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.STApp.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Show",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Prover",
"short_module": "Prover"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.st_term{Tm_STApp? (Mkst_term?.term t)}
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple3 Pulse.Typing.Env.env
(fun uvs -> g': Pulse.Typing.Env.env{Pulse.Typing.Env.extends_with g' g uvs})
(fun _ _ -> t': Pulse.Syntax.Base.st_term{Tm_STApp? (Mkst_term?.term t')})) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.st_term",
"Prims.b2t",
"Pulse.Syntax.Base.uu___is_Tm_STApp",
"Pulse.Syntax.Base.__proj__Mkst_term__item__term",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.qualifier",
"Pulse.Typing.Env.disjoint",
"Pulse.Syntax.Pure.is_arrow",
"Pulse.Syntax.Base.binder",
"Pulse.Syntax.Base.comp",
"Pulse.Checker.STApp.intro_uvars_for_logical_implicits",
"FStar.Pervasives.dtuple3",
"Pulse.Typing.Env.extends_with",
"FStar.Pervasives.Native.tuple3",
"Pulse.Syntax.Pure.is_pure_app",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Typing.Env.push_env",
"Pulse.Syntax.Base.Mkst_term",
"Pulse.Syntax.Base.Tm_STApp",
"Pulse.Syntax.Base.Mkst_term'__Tm_STApp__payload",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Pulse.Syntax.Base.default_effect_hint",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.range",
"Prims.string",
"FStar.Printf.sprintf",
"Pulse.Show.show",
"Pulse.Show.uu___30",
"Pulse.Checker.Pure.instantiate_term_implicits_uvs",
"Pulse.Syntax.Pure.tm_pureapp",
"Pulse.Syntax.Base.st_term'",
"Pulse.Syntax.Base.__proj__Mkst_term__item__range"
] | [] | false | true | false | false | false | let instantiate_implicits (g: env) (t: st_term{Tm_STApp? t.term})
: T.Tac (uvs: env & g': env{extends_with g' g uvs} & t': st_term{Tm_STApp? t'.term}) =
| let range = t.range in
let Tm_STApp { head = head ; arg_qual = qual ; arg = arg } = t.term in
let pure_app = tm_pureapp head qual arg in
let (| uvs , t , ty |) = instantiate_term_implicits_uvs g pure_app in
match is_arrow ty with
| Some (_, Some Implicit, _) -> intro_uvars_for_logical_implicits g uvs t ty
| _ ->
match is_pure_app t with
| Some (head, q, arg) ->
(|
uvs,
push_env g uvs,
{
term = Tm_STApp ({ head = head; arg_qual = q; arg = arg });
range = t.range;
effect_tag = default_effect_hint
}
|)
| _ ->
fail g
(Some t.range)
(Printf.sprintf "check_stapp.instantiate_implicits: expected an application term, found: %s"
(show t)) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.is_fodd | val is_fodd (x: nat) : bool | val is_fodd (x: nat) : bool | let is_fodd (x:nat) : bool = x % 2 = 1 | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Prims.nat -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.bool"
] | [] | false | false | false | true | false | let is_fodd (x: nat) : bool =
| x % 2 = 1 | false |
Pulse.Checker.STApp.fst | Pulse.Checker.STApp.intro_uvars_for_logical_implicits | val intro_uvars_for_logical_implicits (g: env) (uvs: env{disjoint g uvs}) (t ty: term)
: T.Tac (uvs': env & g': env{extends_with g' g uvs'} & t': st_term{Tm_STApp? t'.term}) | val intro_uvars_for_logical_implicits (g: env) (uvs: env{disjoint g uvs}) (t ty: term)
: T.Tac (uvs': env & g': env{extends_with g' g uvs'} & t': st_term{Tm_STApp? t'.term}) | let rec intro_uvars_for_logical_implicits (g:env) (uvs:env { disjoint g uvs }) (t:term) (ty:term)
: T.Tac (uvs':env &
g':env { extends_with g' g uvs' } &
t':st_term { Tm_STApp? t'.term }) =
let ropt = is_arrow ty in
match ropt with
| Some (b, Some Implicit, c_rest) ->
let x = fresh (push_env g uvs) in
let uvs' = push_binding uvs x b.binder_ppname b.binder_ty in
let c_rest = open_comp_with c_rest (tm_var {nm_index = x; nm_ppname = b.binder_ppname}) in
begin
match c_rest with
| C_ST _
| C_STAtomic _ _ _
| C_STGhost _ ->
(| uvs', push_env g uvs', {term=Tm_STApp {head=t;arg_qual=Some Implicit;arg=null_var x};
range=t.range;
effect_tag=as_effect_hint (ctag_of_comp_st c_rest) } |)
| C_Tot ty ->
intro_uvars_for_logical_implicits g uvs' (tm_pureapp t (Some Implicit) (null_var x)) ty
end
| _ ->
fail g None
(Printf.sprintf "check_stapp.intro_uvars_for_logical_implicits: expected an arrow type,\
with an implicit parameter, found: %s"
(P.term_to_string ty)) | {
"file_name": "lib/steel/pulse/Pulse.Checker.STApp.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 31,
"end_line": 87,
"start_col": 0,
"start_line": 61
} | (*
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 Pulse.Checker.STApp
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module P = Pulse.Syntax.Printer
module Prover = Pulse.Checker.Prover
open Pulse.Show
let debug_log (g:env) (f:unit -> T.Tac unit) : T.Tac unit = if RU.debug_at_level (fstar_env g) "st_app" then f () else ()
let canon_comp (c:comp_st) : comp_st =
match readback_comp (elab_comp c) with
| None -> c
| Some (C_Tot _) -> c //should be impossible
| Some c' -> c'
#push-options "--admit_smt_queries true"
let canon_comp_eq_res (g:env) (c:comp_st)
: RT.equiv (elab_env g) (elab_term (comp_res c)) (elab_term (comp_res (canon_comp c)))
= RT.Rel_refl _ _ _
#pop-options
let canonicalize_st_typing (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
: st_typing g t (canon_comp c)
= let c' = canon_comp c in
let x = fresh g in
assume ( ~(x `Set.mem` freevars (comp_post c)) /\
~(x `Set.mem` freevars (comp_post c')) );
assume (st_equiv_pre c c');
let st_eq
: st_equiv g c c'
= ST_VPropEquiv g c c' x (RU.magic ()) (RU.magic()) (RU.magic()) (canon_comp_eq_res g c) (RU.magic()) (RU.magic())
in
T_Equiv _ _ _ _ d st_eq
let coerce_eq (#a #b:Type) (x:a) (_:squash (a === b)) : y:b { y == x } = x | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Show.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.STApp.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Show",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Prover",
"short_module": "Prover"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 |
g: Pulse.Typing.Env.env ->
uvs: Pulse.Typing.Env.env{Pulse.Typing.Env.disjoint g uvs} ->
t: Pulse.Syntax.Base.term ->
ty: Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.dtuple3 Pulse.Typing.Env.env
(fun uvs' -> g': Pulse.Typing.Env.env{Pulse.Typing.Env.extends_with g' g uvs'})
(fun _ _ -> t': Pulse.Syntax.Base.st_term{Tm_STApp? (Mkst_term?.term t')})) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.Env.disjoint",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.binder",
"Pulse.Syntax.Base.comp",
"Pulse.Syntax.Base.st_comp",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Typing.Env.extends_with",
"Pulse.Syntax.Base.st_term",
"Prims.b2t",
"Pulse.Syntax.Base.uu___is_Tm_STApp",
"Pulse.Syntax.Base.__proj__Mkst_term__item__term",
"Pulse.Typing.Env.push_env",
"Pulse.Syntax.Base.Mkst_term",
"Pulse.Syntax.Base.Tm_STApp",
"Pulse.Syntax.Base.Mkst_term'__Tm_STApp__payload",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Base.qualifier",
"Pulse.Syntax.Base.Implicit",
"Pulse.Syntax.Pure.null_var",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Pulse.Syntax.Base.as_effect_hint",
"Pulse.Syntax.Base.ctag_of_comp_st",
"FStar.Pervasives.dtuple3",
"Pulse.Syntax.Base.observability",
"Pulse.Checker.STApp.intro_uvars_for_logical_implicits",
"Pulse.Syntax.Pure.tm_pureapp",
"Pulse.Syntax.Naming.open_comp_with",
"Pulse.Syntax.Pure.tm_var",
"Pulse.Syntax.Base.Mknm",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ppname",
"Prims.eq2",
"FStar.Reflection.Typing.fstar_top_env",
"Pulse.Typing.Env.fstar_env",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty",
"Pulse.Syntax.Base.var",
"Prims.l_not",
"FStar.Set.mem",
"Pulse.Typing.Env.dom",
"Pulse.Typing.Env.fresh",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple3",
"Pulse.Typing.Env.fail",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.range",
"Prims.string",
"FStar.Printf.sprintf",
"Pulse.Syntax.Printer.term_to_string",
"Pulse.Syntax.Pure.is_arrow"
] | [
"recursion"
] | false | true | false | false | false | let rec intro_uvars_for_logical_implicits (g: env) (uvs: env{disjoint g uvs}) (t ty: term)
: T.Tac (uvs': env & g': env{extends_with g' g uvs'} & t': st_term{Tm_STApp? t'.term}) =
| let ropt = is_arrow ty in
match ropt with
| Some (b, Some Implicit, c_rest) ->
let x = fresh (push_env g uvs) in
let uvs' = push_binding uvs x b.binder_ppname b.binder_ty in
let c_rest = open_comp_with c_rest (tm_var ({ nm_index = x; nm_ppname = b.binder_ppname })) in
(match c_rest with
| C_ST _
| C_STAtomic _ _ _
| C_STGhost _ ->
(|
uvs',
push_env g uvs',
{
term = Tm_STApp ({ head = t; arg_qual = Some Implicit; arg = null_var x });
range = t.range;
effect_tag = as_effect_hint (ctag_of_comp_st c_rest)
}
|)
| C_Tot ty ->
intro_uvars_for_logical_implicits g uvs' (tm_pureapp t (Some Implicit) (null_var x)) ty)
| _ ->
fail g
None
(Printf.sprintf "check_stapp.intro_uvars_for_logical_implicits: expected an arrow type,with an implicit parameter, found: %s"
(P.term_to_string ty)) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.qelem | val qelem : Type0 | let qelem = x:nat{x < order} | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 43,
"start_col": 0,
"start_line": 43
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.order"
] | [] | false | false | false | true | true | let qelem =
| x: nat{x < order} | false |
|
Spec.P256.PointOps.fst | Spec.P256.PointOps.aff_point | val aff_point : Type0 | let aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\ py < prime} | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 78,
"end_line": 54,
"start_col": 0,
"start_line": 54
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b` | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"FStar.Pervasives.Native.tuple2",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.prime"
] | [] | false | false | false | true | true | let aff_point =
| p:
tuple2 nat nat
{ let px, py = p in
px < prime /\ py < prime } | false |
|
Spec.P256.PointOps.fst | Spec.P256.PointOps.order | val order:(a: pos{a < pow2 256}) | val order:(a: pos{a < pow2 256}) | let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 41,
"start_col": 0,
"start_line": 39
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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{a < Prims.pow2 256} | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.int"
] | [] | false | false | false | false | false | let order:(a: pos{a < pow2 256}) =
| let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256);
o | false |
Vale.SHA.PPC64LE.Rounds.fsti | Vale.SHA.PPC64LE.Rounds.va_wp_Loop_rounds_0_15 | val va_wp_Loop_rounds_0_15
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop_rounds_0_15
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop_rounds_0_15 (in_b:buffer128) (offset:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) (input_BE:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0) in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3))) /\ (forall (va_x_r4:nat64)
(va_x_r6: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_v20:quad32) (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32)
(va_x_v24:quad32) (va_x_v25:quad32) (va_x_v26:quad32) . let va_sM = va_upd_vec 26 va_x_v26
(va_upd_vec 25 va_x_v25 (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22
(va_upd_vec 21 va_x_v21 (va_upd_vec 20 va_x_v20 (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 6 va_x_r6 (va_upd_reg 4 va_x_r4
va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ (va_get_reg 6 va_sM == va_get_reg 6
va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48 /\ (let ks =
Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let next_hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 203,
"start_col": 0,
"start_line": 118
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop_rounds_0_15 : va_b0:va_code -> va_s0:va_state -> in_b:buffer128 -> offset:nat ->
k_b:buffer128 -> block:block_w -> hash_orig:hash256 -> input_BE:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_0_15 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
in_b (offset + 1) 3 (va_get_mem_layout va_s0) Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b
1 4 (va_get_mem_layout va_s0) Secret /\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s0) k_b in Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4
va_s0 + 48 < pow2_64 /\ va_get_reg 6 va_s0 + 64 < pow2_64 /\ input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b) offset (offset + 4)) /\
block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\ va_get_vec 0 va_s0 ==
FStar.Seq.Base.index #quad32 input_BE 0 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2)) ((va_get_vec 24
va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3)))))
(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 6 va_s0 + 64 /\ va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48
/\ (let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in (let
next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and (l_and
(l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\ l_and (l_and ((va_get_vec 24 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17) ((va_get_vec 24 va_sM).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24 va_sM).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) /\ va_state_eq va_sM (va_update_vec 26 va_sM
(va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM
(va_update_vec 21 va_sM (va_update_vec 20 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 6 va_sM (va_update_reg 4 va_sM
(va_update_ok va_sM va_s0)))))))))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.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.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.SHA.PPC64LE.Rounds.fsti"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"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.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"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.Stack_i",
"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.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.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": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
in_b: Vale.PPC64LE.Memory.buffer128 ->
offset: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
input_BE: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Addition",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.SHA.PPC64LE.SHA_helpers.k_reqs",
"Prims.op_LessThan",
"Vale.PPC64LE.Machine_s.pow2_64",
"Prims.eq2",
"Vale.Arch.Types.reverse_bytes_quad32_seq",
"FStar.Seq.Base.slice",
"Vale.PPC64LE.Machine_s.quad32",
"Vale.PPC64LE.Decls.buffer128_as_seq",
"Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"FStar.Seq.Base.index",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.nat32",
"Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32",
"Vale.SHA.PPC64LE.SHA_helpers.word",
"Vale.Arch.Types.add_wrap32",
"Vale.SHA.PPC64LE.SHA_helpers.k_index",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Prims.l_imp",
"Prims.int",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_Loop_rounds_0_15
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0)
in_b
(offset + 1)
3
(va_get_mem_layout va_s0)
Secret /\
Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 6 va_s0)
k_b
1
4
(va_get_mem_layout va_s0)
Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 4 va_s0 + 48 < pow2_64 /\
va_get_reg 6 va_s0 + 64 < pow2_64 /\
input_BE ==
Vale.Arch.Types.reverse_bytes_quad32_seq (FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32
(Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) in_b)
offset
(offset + 4)) /\ block == Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be input_BE /\
va_get_vec 0 va_s0 == FStar.Seq.Base.index #quad32 input_BE 0 /\
(let hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 0 block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
0))
((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
1)))
((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
2)))
((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
3)))
((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
4)))
((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
5)))
((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
hash
6)))
((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks 0))) /\
l_and (l_and ((va_get_vec 24 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 1)
((va_get_vec 24 va_s0).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 2))
((va_get_vec 24 va_s0).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 3))) /\
(forall (va_x_r4: nat64) (va_x_r6: 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_v20: quad32) (va_x_v21: quad32) (va_x_v22: quad32)
(va_x_v23: quad32) (va_x_v24: quad32) (va_x_v25: quad32) (va_x_v26: quad32).
let va_sM =
va_upd_vec 26
va_x_v26
(va_upd_vec 25
va_x_v25
(va_upd_vec 24
va_x_v24
(va_upd_vec 23
va_x_v23
(va_upd_vec 22
va_x_v22
(va_upd_vec 21
va_x_v21
(va_upd_vec 20
va_x_v20
(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
6
va_x_r6
(
va_upd_reg
4
va_x_r4
va_s0
)
)
)
)
)
))
))))))))))
)))))))))))
in
va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64 /\
va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48 /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in
l_and (l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
0))
((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
1)))
((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
2)))
((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
3)))
((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
4)))
((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
5)))
((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
6)))
((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word
next_hash
7))
(Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (
l_and (l_and ((va_get_vec 0 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
16)
((va_get_vec 1 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
1))
((va_get_vec 2 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
2))
((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque
block
3))
((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block
4))
((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5
))
((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6))
((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7))
((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8))
((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9))
((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10))
((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11))
((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12))
((va_get_vec 13 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13))
((va_get_vec 14 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14))
((va_get_vec 15 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15) /\
l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18))
((va_get_vec 24 va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))) ==>
va_k va_sM (()))) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.proj_point | val proj_point : Type0 | let proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\ py < prime /\ pz < prime} | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 101,
"end_line": 55,
"start_col": 0,
"start_line": 55
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b` | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"FStar.Pervasives.Native.tuple3",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.prime"
] | [] | false | false | false | true | true | let proj_point =
| p:
tuple3 nat nat nat
{ let px, py, pz = p in
px < prime /\ py < prime /\ pz < prime } | false |
|
Spec.P256.PointOps.fst | Spec.P256.PointOps.zero | val zero:felem | val zero:felem | let zero : felem = 0 | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 21,
"start_col": 0,
"start_line": 21
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let zero:felem =
| 0 | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.fadd | val fadd (x y: felem) : felem | val fadd (x y: felem) : felem | let fadd (x y:felem) : felem = (x + y) % prime | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Spec.P256.PointOps.felem -> y: Spec.P256.PointOps.felem -> Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.felem",
"Prims.op_Modulus",
"Prims.op_Addition",
"Spec.P256.PointOps.prime"
] | [] | false | false | false | true | false | let fadd (x y: felem) : felem =
| (x + y) % prime | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.finv | val finv (a: felem) : felem | val finv (a: felem) : felem | let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2) | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 27,
"start_col": 0,
"start_line": 27
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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: Spec.P256.PointOps.felem -> Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.felem",
"Lib.NatMod.pow_mod",
"Spec.P256.PointOps.prime",
"Prims.op_Subtraction"
] | [] | false | false | false | true | false | let finv (a: felem) : felem =
| M.pow_mod #prime a (prime - 2) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.one | val one:felem | val one:felem | let one : felem = 1 | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 22,
"start_col": 0,
"start_line": 22
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let one:felem =
| 1 | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.fmul | val fmul (x y: felem) : felem | val fmul (x y: felem) : felem | let fmul (x y:felem) : felem = (x * y) % prime | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Spec.P256.PointOps.felem -> y: Spec.P256.PointOps.felem -> Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.felem",
"Prims.op_Modulus",
"FStar.Mul.op_Star",
"Spec.P256.PointOps.prime"
] | [] | false | false | false | true | false | let fmul (x y: felem) : felem =
| (x * y) % prime | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.fsub | val fsub (x y: felem) : felem | val fsub (x y: felem) : felem | let fsub (x y:felem) : felem = (x - y) % prime | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 25,
"start_col": 0,
"start_line": 25
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Spec.P256.PointOps.felem -> y: Spec.P256.PointOps.felem -> Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.felem",
"Prims.op_Modulus",
"Prims.op_Subtraction",
"Spec.P256.PointOps.prime"
] | [] | false | false | false | true | false | let fsub (x y: felem) : felem =
| (x - y) % prime | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.is_point_at_inf | val is_point_at_inf : p: Spec.P256.PointOps.proj_point -> Prims.bool | let is_point_at_inf (p:proj_point) =
let (_, _, z) = p in z = 0 | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 88,
"start_col": 0,
"start_line": 87
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b`
let aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\ py < prime}
let proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\ py < prime /\ pz < prime}
// let aff_point = felem & felem // Affine point
// let proj_point = felem & felem & felem // Projective coordinates
let a_coeff : felem = (-3) % prime
let b_coeff : felem =
let b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b in
assert_norm (b < prime); b
// Base point
let g_x : felem =
let x = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 in
assert_norm (x < prime); x
let g_y : felem =
let y = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5 in
assert_norm (y < prime); y
let base_point : proj_point = (g_x, g_y, one)
let is_on_curve (p:aff_point) : bool =
let (x, y) = p in y *% y = x *% x *% x +% a_coeff *% x +% b_coeff
let aff_point_at_inf : aff_point = (zero, zero) // not on the curve!
let point_at_inf : proj_point = (zero, one, zero)
let is_aff_point_at_inf (p:aff_point) : bool =
let (x, y) = p in x = zero && y = zero | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | p: Spec.P256.PointOps.proj_point -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.proj_point",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Prims.bool"
] | [] | false | false | false | true | false | let is_point_at_inf (p: proj_point) =
| let _, _, z = p in
z = 0 | false |
|
Spec.P256.PointOps.fst | Spec.P256.PointOps.fsqrt | val fsqrt (a: felem) : felem | val fsqrt (a: felem) : felem | let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4) | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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: Spec.P256.PointOps.felem -> Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.felem",
"Lib.NatMod.pow_mod",
"Spec.P256.PointOps.prime",
"Prims.op_Division",
"Prims.op_Addition"
] | [] | false | false | false | true | false | let fsqrt (a: felem) : felem =
| M.pow_mod #prime a ((prime + 1) / 4) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.qinv | val qinv (x: qelem) : qelem | val qinv (x: qelem) : qelem | let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2) | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 46,
"start_col": 0,
"start_line": 46
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Spec.P256.PointOps.qelem -> Spec.P256.PointOps.qelem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.qelem",
"Lib.NatMod.pow_mod",
"Spec.P256.PointOps.order",
"Prims.op_Subtraction"
] | [] | false | false | false | true | false | let qinv (x: qelem) : qelem =
| M.pow_mod #order x (order - 2) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.g_x | val g_x:felem | val g_x:felem | let g_x : felem =
let x = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 in
assert_norm (x < prime); x | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 69,
"start_col": 0,
"start_line": 67
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b`
let aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\ py < prime}
let proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\ py < prime /\ pz < prime}
// let aff_point = felem & felem // Affine point
// let proj_point = felem & felem & felem // Projective coordinates
let a_coeff : felem = (-3) % prime
let b_coeff : felem =
let b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b in
assert_norm (b < prime); b | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.prime",
"Prims.int"
] | [] | false | false | false | true | false | let g_x:felem =
| let x = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 in
assert_norm (x < prime);
x | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.qmul | val qmul (x y: qelem) : qelem | val qmul (x y: qelem) : qelem | let qmul (x y:qelem) : qelem = (x * y) % order | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 45,
"start_col": 0,
"start_line": 45
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Spec.P256.PointOps.qelem -> y: Spec.P256.PointOps.qelem -> Spec.P256.PointOps.qelem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.qelem",
"Prims.op_Modulus",
"FStar.Mul.op_Star",
"Spec.P256.PointOps.order"
] | [] | false | false | false | true | false | let qmul (x y: qelem) : qelem =
| (x * y) % order | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.g_y | val g_y:felem | val g_y:felem | let g_y : felem =
let y = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5 in
assert_norm (y < prime); y | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 72,
"start_col": 0,
"start_line": 70
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b`
let aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\ py < prime}
let proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\ py < prime /\ pz < prime}
// let aff_point = felem & felem // Affine point
// let proj_point = felem & felem & felem // Projective coordinates
let a_coeff : felem = (-3) % prime
let b_coeff : felem =
let b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b in
assert_norm (b < prime); b
// Base point
let g_x : felem =
let x = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 in | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.prime",
"Prims.int"
] | [] | false | false | false | true | false | let g_y:felem =
| let y = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5 in
assert_norm (y < prime);
y | false |
Vale.X64.InsLemmas.fst | Vale.X64.InsLemmas.lemma_valid_src_operand128_and_taint | val lemma_valid_src_operand128_and_taint (o:operand128) (s:vale_state) : Lemma
(requires valid_operand128 o s)
(ensures S.valid_src_operand128_and_taint o (state_to_S s))
[SMTPat (S.valid_src_operand128_and_taint o (state_to_S s))] | val lemma_valid_src_operand128_and_taint (o:operand128) (s:vale_state) : Lemma
(requires valid_operand128 o s)
(ensures S.valid_src_operand128_and_taint o (state_to_S s))
[SMTPat (S.valid_src_operand128_and_taint o (state_to_S s))] | let lemma_valid_src_operand128_and_taint o s =
let h = get_vale_heap s.vs_heap in
match o with
| OMem (m, t) ->
let addr = eval_maddr m s in
let aux (b:buffer128) (i:int) : Lemma
(requires valid_buf_maddr128 addr h s.vs_heap.vf_layout b i t)
(ensures S.valid_src_operand128_and_taint o (state_to_S s))
=
lemma_heap_get_heap s.vs_heap;
lemma_valid_taint128 b (full_heap_taint s.vs_heap) h i t
in
Classical.forall_intro_2 (fun b i -> (fun b -> Classical.move_requires (aux b)) b i)
| OStack (m, t) -> lemma_valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint
| _ -> () | {
"file_name": "vale/code/arch/x64/Vale.X64.InsLemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 44,
"start_col": 0,
"start_line": 30
} | module Vale.X64.InsLemmas
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.HeapImpl
open Vale.X64.StateLemmas
open Vale.X64.Taint_Semantics
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.Memory_Sems
friend Vale.X64.Decls
let lemma_valid_src_operand64_and_taint o s =
let h = get_vale_heap s.vs_heap in
match o with
| OMem (m, t) ->
let addr = eval_maddr m s in
let aux (b:buffer64) (i:int) : Lemma
(requires valid_buf_maddr64 addr h s.vs_heap.vf_layout b i t)
(ensures S.valid_src_operand64_and_taint o (state_to_S s))
=
lemma_heap_get_heap s.vs_heap;
lemma_valid_taint64 b (full_heap_taint s.vs_heap) h i t
in
Classical.forall_intro_2 (fun b i -> (fun b -> Classical.move_requires (aux b)) b i)
| OStack (m, t) -> lemma_valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint
| _ -> () | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Taint_Semantics.fst.checked",
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Decls.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.InsLemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.Memory_Sems",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | o: Vale.X64.Machine_s.operand128 -> s: Vale.X64.State.vale_state
-> FStar.Pervasives.Lemma (requires Vale.X64.Decls.valid_operand128 o s)
(ensures
Vale.X64.Machine_Semantics_s.valid_src_operand128_and_taint o
(Vale.X64.StateLemmas.state_to_S s))
[
SMTPat (Vale.X64.Machine_Semantics_s.valid_src_operand128_and_taint o
(Vale.X64.StateLemmas.state_to_S s))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.X64.Machine_s.operand128",
"Vale.X64.State.vale_state",
"Vale.X64.Machine_s.maddr",
"Vale.Arch.HeapTypes_s.taint",
"FStar.Classical.forall_intro_2",
"Vale.X64.Memory.buffer128",
"Prims.int",
"Prims.l_imp",
"Vale.X64.Decls.valid_buf_maddr128",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Prims.b2t",
"Vale.X64.Machine_Semantics_s.valid_src_operand128_and_taint",
"Vale.X64.StateLemmas.state_to_S",
"FStar.Classical.move_requires",
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Vale.X64.Memory.lemma_valid_taint128",
"Vale.Arch.HeapImpl.full_heap_taint",
"Vale.X64.Memory_Sems.lemma_heap_get_heap",
"Vale.X64.State.eval_maddr",
"Vale.X64.Stack_i.lemma_valid_taint_stack128",
"Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint",
"Vale.X64.Machine_s.operand",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Machine_s.reg_xmm",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.get_vale_heap"
] | [] | false | false | true | false | false | let lemma_valid_src_operand128_and_taint o s =
| let h = get_vale_heap s.vs_heap in
match o with
| OMem (m, t) ->
let addr = eval_maddr m s in
let aux (b: buffer128) (i: int)
: Lemma (requires valid_buf_maddr128 addr h s.vs_heap.vf_layout b i t)
(ensures S.valid_src_operand128_and_taint o (state_to_S s)) =
lemma_heap_get_heap s.vs_heap;
lemma_valid_taint128 b (full_heap_taint s.vs_heap) h i t
in
Classical.forall_intro_2 (fun b i -> (fun b -> Classical.move_requires (aux b)) b i)
| OStack (m, t) -> lemma_valid_taint_stack128 (eval_maddr m s) t s.vs_stackTaint
| _ -> () | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.b_coeff | val b_coeff:felem | val b_coeff:felem | let b_coeff : felem =
let b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b in
assert_norm (b < prime); b | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 28,
"end_line": 63,
"start_col": 0,
"start_line": 61
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b`
let aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\ py < prime}
let proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\ py < prime /\ pz < prime}
// let aff_point = felem & felem // Affine point
// let proj_point = felem & felem & felem // Projective coordinates | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | Spec.P256.PointOps.felem | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Spec.P256.PointOps.prime",
"Prims.int"
] | [] | false | false | false | true | false | let b_coeff:felem =
| let b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b in
assert_norm (b < prime);
b | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.qadd | val qadd (x y: qelem) : qelem | val qadd (x y: qelem) : qelem | let qadd (x y:qelem) : qelem = (x + y) % order | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 44,
"start_col": 0,
"start_line": 44
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | x: Spec.P256.PointOps.qelem -> y: Spec.P256.PointOps.qelem -> Spec.P256.PointOps.qelem | Prims.Tot | [
"total"
] | [] | [
"Spec.P256.PointOps.qelem",
"Prims.op_Modulus",
"Prims.op_Addition",
"Spec.P256.PointOps.order"
] | [] | false | false | false | true | false | let qadd (x y: qelem) : qelem =
| (x + y) % order | false |
Vale.X64.InsLemmas.fst | Vale.X64.InsLemmas.lemma_valid_src_operand64_and_taint | val lemma_valid_src_operand64_and_taint (o:operand64) (s:vale_state) : Lemma
(requires valid_operand o s)
(ensures S.valid_src_operand64_and_taint o (state_to_S s))
[SMTPat (S.valid_src_operand64_and_taint o (state_to_S s))] | val lemma_valid_src_operand64_and_taint (o:operand64) (s:vale_state) : Lemma
(requires valid_operand o s)
(ensures S.valid_src_operand64_and_taint o (state_to_S s))
[SMTPat (S.valid_src_operand64_and_taint o (state_to_S s))] | let lemma_valid_src_operand64_and_taint o s =
let h = get_vale_heap s.vs_heap in
match o with
| OMem (m, t) ->
let addr = eval_maddr m s in
let aux (b:buffer64) (i:int) : Lemma
(requires valid_buf_maddr64 addr h s.vs_heap.vf_layout b i t)
(ensures S.valid_src_operand64_and_taint o (state_to_S s))
=
lemma_heap_get_heap s.vs_heap;
lemma_valid_taint64 b (full_heap_taint s.vs_heap) h i t
in
Classical.forall_intro_2 (fun b i -> (fun b -> Classical.move_requires (aux b)) b i)
| OStack (m, t) -> lemma_valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint
| _ -> () | {
"file_name": "vale/code/arch/x64/Vale.X64.InsLemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 28,
"start_col": 0,
"start_line": 14
} | module Vale.X64.InsLemmas
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.HeapImpl
open Vale.X64.StateLemmas
open Vale.X64.Taint_Semantics
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.Memory_Sems
friend Vale.X64.Decls | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Taint_Semantics.fst.checked",
"Vale.X64.StateLemmas.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Memory_Sems.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Decls.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.X64.InsLemmas.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.X64.Memory_Sems",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Bytes_Code_s",
"short_module": "BC"
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | o: Vale.X64.Machine_s.operand64 -> s: Vale.X64.State.vale_state
-> FStar.Pervasives.Lemma (requires Vale.X64.Decls.valid_operand o s)
(ensures
Vale.X64.Machine_Semantics_s.valid_src_operand64_and_taint o
(Vale.X64.StateLemmas.state_to_S s))
[
SMTPat (Vale.X64.Machine_Semantics_s.valid_src_operand64_and_taint o
(Vale.X64.StateLemmas.state_to_S s))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.X64.Machine_s.operand64",
"Vale.X64.State.vale_state",
"Vale.X64.Machine_s.maddr",
"Vale.Arch.HeapTypes_s.taint",
"FStar.Classical.forall_intro_2",
"Vale.X64.Memory.buffer64",
"Prims.int",
"Prims.l_imp",
"Vale.X64.Decls.valid_buf_maddr64",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.X64.State.__proj__Mkvale_state__item__vs_heap",
"Prims.b2t",
"Vale.X64.Machine_Semantics_s.valid_src_operand64_and_taint",
"Vale.X64.StateLemmas.state_to_S",
"FStar.Classical.move_requires",
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Vale.X64.Memory.lemma_valid_taint64",
"Vale.Arch.HeapImpl.full_heap_taint",
"Vale.X64.Memory_Sems.lemma_heap_get_heap",
"Vale.X64.State.eval_maddr",
"Vale.X64.Stack_i.lemma_valid_taint_stack64",
"Vale.X64.State.__proj__Mkvale_state__item__vs_stackTaint",
"Vale.X64.Machine_s.operand",
"Vale.X64.Machine_s.nat64",
"Vale.X64.Machine_s.reg_64",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.X64.Memory.get_vale_heap"
] | [] | false | false | true | false | false | let lemma_valid_src_operand64_and_taint o s =
| let h = get_vale_heap s.vs_heap in
match o with
| OMem (m, t) ->
let addr = eval_maddr m s in
let aux (b: buffer64) (i: int)
: Lemma (requires valid_buf_maddr64 addr h s.vs_heap.vf_layout b i t)
(ensures S.valid_src_operand64_and_taint o (state_to_S s)) =
lemma_heap_get_heap s.vs_heap;
lemma_valid_taint64 b (full_heap_taint s.vs_heap) h i t
in
Classical.forall_intro_2 (fun b i -> (fun b -> Classical.move_requires (aux b)) b i)
| OStack (m, t) -> lemma_valid_taint_stack64 (eval_maddr m s) t s.vs_stackTaint
| _ -> () | false |
Steel.ST.Array.fst | Steel.ST.Array.pts_to_range_elim' | val pts_to_range_elim'
(#opened: _)
(#elt: Type0)
(a: array elt)
(i j: nat)
(p: P.perm)
(s: Seq.seq elt)
: STGhost (Ghost.erased (array elt))
opened
(pts_to_range a i j p s)
(fun a' -> pts_to a' p s)
True
(fun a' -> i <= j /\ j <= length a /\ Ghost.reveal a' == array_slice a i j ()) | val pts_to_range_elim'
(#opened: _)
(#elt: Type0)
(a: array elt)
(i j: nat)
(p: P.perm)
(s: Seq.seq elt)
: STGhost (Ghost.erased (array elt))
opened
(pts_to_range a i j p s)
(fun a' -> pts_to a' p s)
True
(fun a' -> i <= j /\ j <= length a /\ Ghost.reveal a' == array_slice a i j ()) | let pts_to_range_elim'
(#opened: _)
(#elt: Type0) (a: array elt) (i j: nat)
(p: P.perm)
(s: Seq.seq elt)
: STGhost (Ghost.erased (array elt)) opened
(pts_to_range a i j p s)
(fun a' -> pts_to a' p s)
True
(fun a' -> i <= j /\ j <= length a /\
Ghost.reveal a' == array_slice a i j ()
)
= rewrite (pts_to_range a i j p s) (exists_ (pts_to_range_body a i j p s));
let _ = elim_exists () in
vpattern_replace_erased (fun a' -> pts_to a' p s) | {
"file_name": "lib/steel/Steel.ST.Array.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 51,
"end_line": 616,
"start_col": 0,
"start_line": 602
} | (*
Copyright 2020, 2021, 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.
*)
module Steel.ST.Array
module US = FStar.SizeT
/// Lifting a value of universe 0 to universe 1. We use
/// FStar.Universe, since FStar.Extraction.Krml is set to extract
/// those functions to identity.
inline_for_extraction
[@@ noextract_to "krml"]
let raise_t (t: Type0) : Type u#1 = FStar.Universe.raise_t t
inline_for_extraction
[@@noextract_to "krml"]
let raise (#t: Type) (x: t) : Tot (raise_t t) =
FStar.Universe.raise_val x
inline_for_extraction
[@@noextract_to "krml"]
let lower (#t: Type) (x: raise_t t) : Tot t =
FStar.Universe.downgrade_val x
/// A map operation on sequences. Here we only need Ghost versions,
/// because such sequences are only used in vprops or with their
/// selectors.
let rec seq_map
(#t: Type u#a)
(#t' : Type u#b)
(f: (t -> GTot t'))
(s: Seq.seq t)
: Ghost (Seq.seq t')
(requires True)
(ensures (fun s' ->
Seq.length s' == Seq.length s /\
(forall i . {:pattern (Seq.index s' i)} Seq.index s' i == f (Seq.index s i))
))
(decreases (Seq.length s))
= if Seq.length s = 0
then Seq.empty
else Seq.cons (f (Seq.index s 0)) (seq_map f (Seq.slice s 1 (Seq.length s)))
let seq_map_append
(#t: Type u#a)
(#t': Type u#b)
(f: (t -> GTot t'))
(s1 s2: Seq.seq t)
: Lemma
(seq_map f (s1 `Seq.append` s2) `Seq.equal` (seq_map f s1 `Seq.append` seq_map f s2))
= ()
let seq_map_raise_inj
(#elt: Type0)
(s1 s2: Seq.seq elt)
: Lemma
(requires (seq_map raise s1 == seq_map raise s2))
(ensures (s1 == s2))
[SMTPat (seq_map raise s1); SMTPat (seq_map raise s2)]
= assert (seq_map lower (seq_map raise s1) `Seq.equal` s1);
assert (seq_map lower (seq_map raise s2) `Seq.equal` s2)
/// Implementation of the interface
/// base, ptr, array, pts_to
module H = Steel.ST.HigherArray
let base_t elt = H.base_t (raise_t elt)
let base_len b = H.base_len b
let ptr elt = H.ptr (raise_t elt)
let null_ptr elt = H.null_ptr (raise_t elt)
let is_null_ptr p = H.is_null_ptr p
let base p = H.base p
let offset p = H.offset p
let ptr_base_offset_inj p1 p2 = H.ptr_base_offset_inj p1 p2
let base_len_null_ptr elt = H.base_len_null_ptr (raise_t elt)
let length_fits a = H.length_fits a
let pts_to a p s = H.pts_to a p (seq_map raise s)
let pts_to_length a s =
H.pts_to_length a _
let h_array_eq'
(#t: Type u#1)
(a1 a2: H.array t)
: Lemma
(requires (
dfst a1 == dfst a2 /\
(Ghost.reveal (dsnd a1) <: nat) == Ghost.reveal (dsnd a2)
))
(ensures (
a1 == a2
))
= ()
let pts_to_not_null #_ #t #p a s =
let _ = H.pts_to_not_null #_ #_ #p a (seq_map raise s) in
assert (a =!= H.null #(raise_t t));
Classical.move_requires (h_array_eq' a) (H.null #(raise_t t));
noop ()
let pts_to_inj a p1 s1 p2 s2 =
H.pts_to_inj a p1 (seq_map raise s1) p2 (seq_map raise s2)
/// Non-selector operations.
let malloc x n =
let res = H.malloc (raise x) n in
assert (seq_map raise (Seq.create (US.v n) x) `Seq.equal` Seq.create (US.v n) (raise x));
rewrite
(H.pts_to res _ _)
(pts_to res _ _);
return res
let free #_ x =
let s = elim_exists () in
rewrite
(pts_to x _ _)
(H.pts_to x P.full_perm (seq_map raise s));
H.free x
let share
#_ #_ #x a p p1 p2
= rewrite
(pts_to a _ _)
(H.pts_to a p (seq_map raise x));
H.share a p p1 p2;
rewrite
(H.pts_to a p1 _)
(pts_to a p1 x);
rewrite
(H.pts_to a p2 _)
(pts_to a p2 x)
let gather
#_ #_ a #x1 p1 #x2 p2
= rewrite
(pts_to a p1 _)
(H.pts_to a p1 (seq_map raise x1));
rewrite
(pts_to a p2 _)
(H.pts_to a p2 (seq_map raise x2));
H.gather a p1 p2;
rewrite
(H.pts_to a _ _)
(pts_to _ _ _)
let index #_ #p a #s i =
rewrite
(pts_to a _ _)
(H.pts_to a p (seq_map raise s));
let res = H.index a i in
rewrite
(H.pts_to _ _ _)
(pts_to _ _ _);
return (lower res)
let upd #_ a #s i v =
rewrite
(pts_to a _ _)
(H.pts_to a P.full_perm (seq_map raise s));
H.upd a i (raise v);
assert (seq_map raise (Seq.upd s (US.v i) v) `Seq.equal` Seq.upd (seq_map raise s) (US.v i) (raise v));
rewrite
(H.pts_to _ _ _)
(pts_to _ _ _)
let ghost_join
#_ #_ #x1 #x2 #p a1 a2 h
= rewrite
(pts_to a1 _ _)
(H.pts_to a1 p (seq_map raise x1));
rewrite
(pts_to a2 _ _)
(H.pts_to a2 p (seq_map raise x2));
H.ghost_join a1 a2 h;
assert (seq_map raise (x1 `Seq.append` x2) `Seq.equal` (seq_map raise x1 `Seq.append` seq_map raise x2));
rewrite
(H.pts_to _ _ _)
(H.pts_to (merge a1 a2) p (seq_map raise (x1 `Seq.append` x2)));
rewrite
(H.pts_to _ _ _)
(pts_to (merge a1 a2) _ _)
let ptr_shift p off = H.ptr_shift p off
let ghost_split
#_ #_ #x #p a i
=
rewrite
(pts_to a _ _)
(H.pts_to a p (seq_map raise x));
let _ = H.ghost_split a i in
//H.ghost_split a i;
assert (seq_map raise (Seq.slice x 0 (US.v i)) `Seq.equal` Seq.slice (seq_map raise x) 0 (US.v i));
rewrite
(H.pts_to (H.split_l a i) _ _)
(H.pts_to (split_l a i) p (seq_map raise (Seq.slice x 0 (US.v i))));
rewrite
(H.pts_to (split_l a i) _ _)
(pts_to (split_l a i) _ _);
assert (seq_map raise (Seq.slice x (US.v i) (Seq.length x)) `Seq.equal` Seq.slice (seq_map raise x) (US.v i) (Seq.length (seq_map raise x)));
Seq.lemma_split x (US.v i);
rewrite
(H.pts_to (H.split_r a i) _ _)
(H.pts_to (split_r a i) p (seq_map raise (Seq.slice x (US.v i) (Seq.length x))));
rewrite
(H.pts_to (split_r a i) _ _)
(pts_to (split_r a i) _ _)
let memcpy
a0 a1 l
=
H.memcpy a0 a1 l
////////////////////////////////////////////////////////////////////////////////
// compare
////////////////////////////////////////////////////////////////////////////////
module R = Steel.ST.Reference
#push-options "--fuel 0 --ifuel 1 --z3rlimit_factor 2"
let equal_up_to #t
(s0: Seq.seq t)
(s1: Seq.seq t)
(v : option US.t) : prop =
Seq.length s0 = Seq.length s1 /\
(match v with
| None -> Ghost.reveal s0 =!= Ghost.reveal s1
| Some v -> US.v v <= Seq.length s0 /\ Seq.slice s0 0 (US.v v) `Seq.equal` Seq.slice s1 0 (US.v v))
let within_bounds (x:option US.t) (l:US.t) (b:Ghost.erased bool) : prop =
if b then Some? x /\ US.(Some?.v x <^ l)
else None? x \/ US.(Some?.v x >=^ l)
let compare_inv (#t:eqtype) (#p0 #p1:perm)
(a0 a1:array t)
(s0: Seq.seq t)
(s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(b: bool) =
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (x:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x) `star`
pure (within_bounds x l b))
let elim_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(b: bool)
: STGhostT (Ghost.erased (option US.t)) o
(compare_inv a0 a1 s0 s1 l ctr b)
(fun x ->
let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x) `star`
pure (within_bounds x l b))
= let open US in
assert_spinoff
((compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr b) ==
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l b))));
rewrite
(compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr b)
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l b)));
let _v = elim_exists () in
_v
let intro_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(x: Ghost.erased (option US.t))
(b:bool { within_bounds x l b })
: STGhostT unit o
(let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x))
(fun _ -> compare_inv a0 a1 s0 s1 l ctr (Ghost.hide b))
= let open US in
intro_pure (within_bounds x l (Ghost.hide b));
intro_exists_erased x (fun (x:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x) `star`
pure (within_bounds x l (Ghost.hide b)));
assert_norm
((compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr (Ghost.hide b)) ==
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l (Ghost.hide b)))));
rewrite
(pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
exists_ (fun (v:option US.t) ->
R.pts_to ctr Steel.FractionalPermission.full_perm v `star`
pure (equal_up_to s0 s1 v) `star`
pure (within_bounds v l (Ghost.hide b))))
(compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr (Ghost.hide b))
let intro_exists_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
(x: Ghost.erased (option US.t))
: STGhostT unit o
(let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm x `star`
pure (equal_up_to s0 s1 x))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))
= let b : bool =
match Ghost.reveal x with
| None -> false
| Some x -> US.(x <^ l)
in
assert (within_bounds x l b);
intro_compare_inv #_ #_ #p0 #p1 a0 a1 #s0 #s1 l ctr x b;
intro_exists _ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)
let extend_equal_up_to_lemma (#t:Type0)
(s0:Seq.seq t)
(s1:Seq.seq t)
(i:nat{ i < Seq.length s0 /\ Seq.length s0 == Seq.length s1 })
: Lemma
(requires
Seq.equal (Seq.slice s0 0 i) (Seq.slice s1 0 i) /\
Seq.index s0 i == Seq.index s1 i)
(ensures
Seq.equal (Seq.slice s0 0 (i + 1)) (Seq.slice s1 0 (i + 1)))
= assert (forall k. k < i ==> Seq.index s0 k == Seq.index (Seq.slice s0 0 i) k /\
Seq.index s1 k == Seq.index (Seq.slice s1 0 i) k)
let extend_equal_up_to (#o:_)
(#t:Type0)
(#s0:Seq.seq t)
(#s1:Seq.seq t)
(len:US.t)
(i:US.t{ Seq.length s0 == Seq.length s1 /\ US.(i <^ len) /\ US.v len == Seq.length s0 } )
: STGhost unit o
(pure (equal_up_to s0 s1 (Some i)))
(fun _ -> pure (equal_up_to s0 s1 (Some US.(i +^ 1sz))))
(requires
Seq.index s0 (US.v i) == Seq.index s1 (US.v i))
(ensures fun _ -> True)
= elim_pure _;
extend_equal_up_to_lemma s0 s1 (US.v i);
intro_pure (equal_up_to s0 s1 (Some US.(i +^ 1sz)))
let extend_equal_up_to_neg (#o:_)
(#t:Type0)
(#s0:Seq.seq t)
(#s1:Seq.seq t)
(len:US.t)
(i:US.t{ Seq.length s0 == Seq.length s1 /\ US.(i <^ len) /\ US.v len == Seq.length s0 } )
: STGhost unit o
(pure (equal_up_to s0 s1 (Some i)))
(fun _ -> pure (equal_up_to s0 s1 None))
(requires
Seq.index s0 (US.v i) =!= Seq.index s1 (US.v i))
(ensures fun _ -> True)
= elim_pure _;
intro_pure _
let init_compare_inv #o
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Seq.seq t)
(#s1: Seq.seq t)
(l:US.t)
(ctr : R.ref (option US.t))
: STGhost unit o
(let open US in
pts_to a0 p0 s0 `star`
pts_to a1 p1 s1 `star`
R.pts_to ctr Steel.FractionalPermission.full_perm (Some 0sz))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))
(requires (
length a0 > 0 /\
length a0 == length a1 /\
US.v l == length a0
))
(ensures (fun _ -> True))
= pts_to_length a0 _;
pts_to_length a1 _;
intro_pure (equal_up_to s0 s1 (Ghost.hide (Some 0sz)));
rewrite
(R.pts_to ctr Steel.FractionalPermission.full_perm (Some 0sz))
(R.pts_to ctr Steel.FractionalPermission.full_perm (Ghost.hide (Some 0sz)));
intro_exists_compare_inv a0 a1 l ctr (Ghost.hide (Some 0sz))
let compare_pts
(#t:eqtype)
(#p0 #p1:perm)
(a0 a1:array t)
(#s0: Ghost.erased (Seq.seq t))
(#s1: Ghost.erased (Seq.seq t))
(l:US.t)
: ST bool
(pts_to a0 p0 s0 `star` pts_to a1 p1 s1)
(fun _ -> pts_to a0 p0 s0 `star` pts_to a1 p1 s1)
(requires
length a0 > 0 /\ length a0 == length a1 /\ US.v l == length a0
)
(ensures fun b ->
b = (Ghost.reveal s0 = Ghost.reveal s1))
=
pts_to_length a0 _;
pts_to_length a1 _;
let ctr = R.alloc (Some 0sz) in
let cond ()
: STT bool
(exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))
(fun b -> compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr (Ghost.hide b))
= let _b = elim_exists () in
let _ = elim_compare_inv _ _ _ _ _ in
let x = R.read ctr in
elim_pure (within_bounds _ _ _);
match x with
| None ->
intro_compare_inv #_ #_ #p0 #p1 a0 a1 l ctr _ false;
return false
| Some x ->
let res = US.(x <^ l) in
intro_compare_inv #_ #_ #p0 #p1 a0 a1 l ctr _ res;
return res
in
let body ()
: STT unit
(compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr (Ghost.hide true))
(fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))
= let _i = elim_compare_inv _ _ _ _ _ in
elim_pure (within_bounds _ _ _);
let Some i = R.read ctr in
assert_spinoff
((pure (equal_up_to s0 s1 _i)) ==
(pure (equal_up_to s0 s1 (Some i))));
rewrite
(pure (equal_up_to s0 s1 _i))
(pure (equal_up_to s0 s1 (Some i)));
let v0 = index a0 i in
let v1 = index a1 i in
if v0 = v1
then (
R.write ctr (Some US.(i +^ 1sz));
extend_equal_up_to l i;
intro_exists_compare_inv #_ #_ #p0 #p1 a0 a1 l ctr (Ghost.hide (Some (US.(i +^ 1sz))))
)
else (
R.write ctr None;
extend_equal_up_to_neg l i;
intro_exists_compare_inv #_ #_ #p0 #p1 a0 a1 l ctr (Ghost.hide None)
)
in
init_compare_inv a0 a1 l ctr;
Steel.ST.Loops.while_loop (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)
cond
body;
let _ = elim_compare_inv _ _ _ _ _ in
elim_pure (equal_up_to _ _ _);
let v = R.read ctr in
R.free ctr;
elim_pure (within_bounds _ _ _);
match v with
| None -> return false
| Some _ -> return true
let compare
#t #p0 #p1 a0 a1 #s0 #s1 l
=
pts_to_length a0 _;
pts_to_length a1 _;
if l = 0sz
then (
assert (Seq.equal s0 s1);
return true
)
else (
compare_pts a0 a1 l
)
#pop-options
let intro_fits_u32 () = H.intro_fits_u32 ()
let intro_fits_u64 () = H.intro_fits_u64 ()
let intro_fits_ptrdiff32 () = H.intro_fits_ptrdiff32 ()
let intro_fits_ptrdiff64 () = H.intro_fits_ptrdiff64 ()
let ptrdiff #_ #p0 #p1 #s0 #s1 a0 a1 =
rewrite
(pts_to a0 _ _)
(H.pts_to a0 p0 (seq_map raise s0));
rewrite
(pts_to a1 _ _)
(H.pts_to a1 p1 (seq_map raise s1));
let res = H.ptrdiff a0 a1 in
rewrite
(H.pts_to a1 _ _)
(pts_to a1 _ _);
rewrite
(H.pts_to a0 _ _)
(pts_to a0 _ _);
return res
let array_slice
(#elt: Type0)
(a: array elt)
(i j: nat)
(sq: squash (i <= j /\ j <= length a))
: Ghost (array elt)
(requires True)
(ensures (fun a' -> length a' == j - i))
= length_fits a;
split_l (split_r a (US.uint_to_t i)) (US.uint_to_t (j - i))
[@@__reduce__]
let pts_to_range_body
(#elt: Type0) (a: array elt) (i j: nat)
(p: P.perm)
(s: Seq.seq elt)
(sq: squash (i <= j /\ j <= length a))
: Tot vprop
= pts_to (array_slice a i j sq) p s
let pts_to_range
(#elt: Type0) (a: array elt) (i j: nat)
(p: P.perm)
([@@@ smt_fallback ] s: Seq.seq elt)
: Tot vprop
= exists_ (pts_to_range_body a i j p s)
let pts_to_range_intro'
(#opened: _)
(#elt: Type0) (a: array elt) (i j: nat)
(p: P.perm)
(a': array elt)
(s: Seq.seq elt)
: STGhost unit opened
(pts_to a' p s)
(fun _ -> pts_to_range a i j p s)
(i <= j /\ j <= length a /\
a' == array_slice a i j ()
)
(fun _ -> True)
= let sq : squash (i <= j /\ j <= length a) = () in
rewrite (pts_to a' p s) (pts_to (array_slice a i j sq) p s);
rewrite (exists_ (pts_to_range_body a i j p s)) (pts_to_range a i j p s) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.HigherArray.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Array.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Steel.ST.HigherArray",
"short_module": "H"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "US"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.PtrdiffT",
"short_module": "UP"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "US"
},
{
"abbrev": true,
"full_module": "Steel.FractionalPermission",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": 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: Steel.ST.Array.array elt ->
i: Prims.nat ->
j: Prims.nat ->
p: Steel.FractionalPermission.perm ->
s: FStar.Seq.Base.seq elt
-> Steel.ST.Effect.Ghost.STGhost (FStar.Ghost.erased (Steel.ST.Array.array elt)) | Steel.ST.Effect.Ghost.STGhost | [] | [] | [
"Steel.Memory.inames",
"Steel.ST.Array.array",
"Prims.nat",
"Steel.FractionalPermission.perm",
"FStar.Seq.Base.seq",
"Steel.ST.Util.vpattern_replace_erased",
"Steel.ST.Array.array_slice",
"FStar.Ghost.reveal",
"Prims.squash",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Steel.ST.Array.length",
"Steel.ST.Array.pts_to",
"Steel.Effect.Common.vprop",
"FStar.Ghost.erased",
"Steel.ST.Util.elim_exists",
"Prims.unit",
"Steel.ST.Util.rewrite",
"Steel.ST.Array.pts_to_range",
"Steel.ST.Util.exists_",
"Steel.ST.Array.pts_to_range_body",
"Prims.l_True",
"Prims.eq2"
] | [] | false | true | false | false | false | let pts_to_range_elim'
(#opened: _)
(#elt: Type0)
(a: array elt)
(i j: nat)
(p: P.perm)
(s: Seq.seq elt)
: STGhost (Ghost.erased (array elt))
opened
(pts_to_range a i j p s)
(fun a' -> pts_to a' p s)
True
(fun a' -> i <= j /\ j <= length a /\ Ghost.reveal a' == array_slice a i j ()) =
| rewrite (pts_to_range a i j p s) (exists_ (pts_to_range_body a i j p s));
let _ = elim_exists () in
vpattern_replace_erased (fun a' -> pts_to a' p s) | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.prime | val prime:(a:
pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) | val prime:(a:
pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) | let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 18,
"start_col": 0,
"start_line": 15
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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
{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < Prims.pow2 256} | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Subtraction",
"Prims.op_Addition"
] | [] | false | false | false | false | false | let prime:(a:
pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
| let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256);
p | false |
Spec.P256.PointOps.fst | Spec.P256.PointOps.aff_point_at_inf | val aff_point_at_inf:aff_point | val aff_point_at_inf:aff_point | let aff_point_at_inf : aff_point = (zero, zero) | {
"file_name": "specs/Spec.P256.PointOps.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 81,
"start_col": 0,
"start_line": 81
} | module Spec.P256.PointOps
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
module M = Lib.NatMod
module BSeq = Lib.ByteSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Base field
// 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
let prime: (a:pos{a = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff /\ a < pow2 256}) =
let p = pow2 256 - pow2 224 + pow2 192 + pow2 96 - 1 in
assert_norm (0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff = p);
assert_norm (p < pow2 256); p
let felem = x:nat{x < prime}
let zero : felem = 0
let one : felem = 1
let fadd (x y:felem) : felem = (x + y) % prime
let fsub (x y:felem) : felem = (x - y) % prime
let fmul (x y:felem) : felem = (x * y) % prime
let finv (a:felem) : felem = M.pow_mod #prime a (prime - 2)
let fsqrt (a:felem) : felem = M.pow_mod #prime a ((prime + 1) / 4)
let is_fodd (x:nat) : bool = x % 2 = 1
let ( +% ) = fadd
let ( -% ) = fsub
let ( *% ) = fmul
let ( /% ) (x y:felem) = x *% finv y
/// Scalar field
// Group order
let order: (a:pos{a < pow2 256}) =
let o = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 in
assert_norm (o < pow2 256); o
let qelem = x:nat{x < order}
let qadd (x y:qelem) : qelem = (x + y) % order
let qmul (x y:qelem) : qelem = (x * y) % order
let qinv (x:qelem) : qelem = M.pow_mod #order x (order - 2)
let ( +^ ) = qadd
let ( *^ ) = qmul
/// Elliptic curve `y^2 = x^3 + a * x + b`
let aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\ py < prime}
let proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\ py < prime /\ pz < prime}
// let aff_point = felem & felem // Affine point
// let proj_point = felem & felem & felem // Projective coordinates
let a_coeff : felem = (-3) % prime
let b_coeff : felem =
let b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b in
assert_norm (b < prime); b
// Base point
let g_x : felem =
let x = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 in
assert_norm (x < prime); x
let g_y : felem =
let y = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5 in
assert_norm (y < prime); y
let base_point : proj_point = (g_x, g_y, one)
let is_on_curve (p:aff_point) : bool =
let (x, y) = p in y *% y = x *% x *% x +% a_coeff *% x +% b_coeff | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.P256.PointOps.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.NatMod",
"short_module": "M"
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.P256",
"short_module": null
},
{
"abbrev": 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 | Spec.P256.PointOps.aff_point | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.Mktuple2",
"Prims.nat",
"Spec.P256.PointOps.zero"
] | [] | false | false | false | true | false | let aff_point_at_inf:aff_point =
| (zero, zero) | false |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.