effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Tot | val point_double : BE.lsqr_st U64 12ul 0ul mk_to_p256_comm_monoid | [
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Point",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.P256.Lemmas",
"short_module": "SL"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Exponentiation.Definitions",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.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
}
] | false | let point_double ctx x xx =
let h0 = ST.get () in
SL.to_aff_point_double_lemma (from_mont_point (as_point_nat h0 x));
Hacl.Impl.P256.PointDouble.point_double xx x | val point_double : BE.lsqr_st U64 12ul 0ul mk_to_p256_comm_monoid
let point_double ctx x xx = | false | null | false | let h0 = ST.get () in
SL.to_aff_point_double_lemma (from_mont_point (as_point_nat h0 x));
Hacl.Impl.P256.PointDouble.point_double xx x | {
"checked_file": "Hacl.Impl.P256.Group.fst.checked",
"dependencies": [
"Spec.P256.Lemmas.fsti.checked",
"Spec.P256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.P256.PointDouble.fsti.checked",
"Hacl.Impl.P256.PointAdd.fsti.checked",
"Hacl.Impl.P256.Point.fsti.checked",
"Hacl.Impl.Exponentiation.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.P256.Group.fst"
} | [
"total"
] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.P256.PointDouble.point_double",
"Prims.unit",
"Spec.P256.Lemmas.to_aff_point_double_lemma",
"Hacl.Impl.P256.Point.from_mont_point",
"Hacl.Impl.P256.Point.as_point_nat",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | module Hacl.Impl.P256.Group
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BE = Hacl.Impl.Exponentiation.Definitions
module S = Spec.P256
module SL = Spec.P256.Lemmas
open Hacl.Impl.P256.Point
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
unfold
let linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True
unfold
let refl (p:LSeq.lseq uint64 12{point_inv_seq p}) : GTot S.aff_point =
S.to_aff_point (from_mont_point (as_point_nat_seq p))
inline_for_extraction noextract
let mk_to_p256_comm_monoid : BE.to_comm_monoid U64 12ul 0ul = {
BE.a_spec = S.aff_point;
BE.comm_monoid = S.mk_p256_comm_monoid;
BE.linv_ctx = linv_ctx;
BE.linv = point_inv_seq;
BE.refl = refl;
}
inline_for_extraction noextract
val point_add : BE.lmul_st U64 12ul 0ul mk_to_p256_comm_monoid
let point_add ctx x y xy =
let h0 = ST.get () in
SL.to_aff_point_add_lemma
(from_mont_point (as_point_nat h0 x)) (from_mont_point (as_point_nat h0 y));
Hacl.Impl.P256.PointAdd.point_add xy x y
inline_for_extraction noextract | false | false | Hacl.Impl.P256.Group.fst | {
"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"
} | null | val point_double : BE.lsqr_st U64 12ul 0ul mk_to_p256_comm_monoid | [] | Hacl.Impl.P256.Group.point_double | {
"file_name": "code/ecdsap256/Hacl.Impl.P256.Group.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Exponentiation.Definitions.lsqr_st Lib.IntTypes.U64
12ul
0ul
Hacl.Impl.P256.Group.mk_to_p256_comm_monoid | {
"end_col": 46,
"end_line": 53,
"start_col": 27,
"start_line": 50
} |
Prims.Tot | val point_add : BE.lmul_st U64 12ul 0ul mk_to_p256_comm_monoid | [
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Point",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.P256.Lemmas",
"short_module": "SL"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Exponentiation.Definitions",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.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
}
] | false | let point_add ctx x y xy =
let h0 = ST.get () in
SL.to_aff_point_add_lemma
(from_mont_point (as_point_nat h0 x)) (from_mont_point (as_point_nat h0 y));
Hacl.Impl.P256.PointAdd.point_add xy x y | val point_add : BE.lmul_st U64 12ul 0ul mk_to_p256_comm_monoid
let point_add ctx x y xy = | false | null | false | let h0 = ST.get () in
SL.to_aff_point_add_lemma (from_mont_point (as_point_nat h0 x))
(from_mont_point (as_point_nat h0 y));
Hacl.Impl.P256.PointAdd.point_add xy x y | {
"checked_file": "Hacl.Impl.P256.Group.fst.checked",
"dependencies": [
"Spec.P256.Lemmas.fsti.checked",
"Spec.P256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.P256.PointDouble.fsti.checked",
"Hacl.Impl.P256.PointAdd.fsti.checked",
"Hacl.Impl.P256.Point.fsti.checked",
"Hacl.Impl.Exponentiation.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.P256.Group.fst"
} | [
"total"
] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.P256.PointAdd.point_add",
"Prims.unit",
"Spec.P256.Lemmas.to_aff_point_add_lemma",
"Hacl.Impl.P256.Point.from_mont_point",
"Hacl.Impl.P256.Point.as_point_nat",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | module Hacl.Impl.P256.Group
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BE = Hacl.Impl.Exponentiation.Definitions
module S = Spec.P256
module SL = Spec.P256.Lemmas
open Hacl.Impl.P256.Point
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
unfold
let linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True
unfold
let refl (p:LSeq.lseq uint64 12{point_inv_seq p}) : GTot S.aff_point =
S.to_aff_point (from_mont_point (as_point_nat_seq p))
inline_for_extraction noextract
let mk_to_p256_comm_monoid : BE.to_comm_monoid U64 12ul 0ul = {
BE.a_spec = S.aff_point;
BE.comm_monoid = S.mk_p256_comm_monoid;
BE.linv_ctx = linv_ctx;
BE.linv = point_inv_seq;
BE.refl = refl;
}
inline_for_extraction noextract | false | false | Hacl.Impl.P256.Group.fst | {
"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"
} | null | val point_add : BE.lmul_st U64 12ul 0ul mk_to_p256_comm_monoid | [] | Hacl.Impl.P256.Group.point_add | {
"file_name": "code/ecdsap256/Hacl.Impl.P256.Group.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Exponentiation.Definitions.lmul_st Lib.IntTypes.U64
12ul
0ul
Hacl.Impl.P256.Group.mk_to_p256_comm_monoid | {
"end_col": 42,
"end_line": 45,
"start_col": 26,
"start_line": 41
} |
Prims.Tot | val mk_to_p256_comm_monoid:BE.to_comm_monoid U64 12ul 0ul | [
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Point",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.P256.Lemmas",
"short_module": "SL"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Exponentiation.Definitions",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.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
}
] | false | let mk_to_p256_comm_monoid : BE.to_comm_monoid U64 12ul 0ul = {
BE.a_spec = S.aff_point;
BE.comm_monoid = S.mk_p256_comm_monoid;
BE.linv_ctx = linv_ctx;
BE.linv = point_inv_seq;
BE.refl = refl;
} | val mk_to_p256_comm_monoid:BE.to_comm_monoid U64 12ul 0ul
let mk_to_p256_comm_monoid:BE.to_comm_monoid U64 12ul 0ul = | false | null | false | {
BE.a_spec = S.aff_point;
BE.comm_monoid = S.mk_p256_comm_monoid;
BE.linv_ctx = linv_ctx;
BE.linv = point_inv_seq;
BE.refl = refl
} | {
"checked_file": "Hacl.Impl.P256.Group.fst.checked",
"dependencies": [
"Spec.P256.Lemmas.fsti.checked",
"Spec.P256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.P256.PointDouble.fsti.checked",
"Hacl.Impl.P256.PointAdd.fsti.checked",
"Hacl.Impl.P256.Point.fsti.checked",
"Hacl.Impl.Exponentiation.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.P256.Group.fst"
} | [
"total"
] | [
"Hacl.Impl.Exponentiation.Definitions.Mkto_comm_monoid",
"Lib.IntTypes.U64",
"FStar.UInt32.uint_to_t",
"Spec.P256.PointOps.aff_point",
"Spec.P256.mk_p256_comm_monoid",
"Hacl.Impl.P256.Group.linv_ctx",
"Hacl.Impl.P256.Point.point_inv_seq",
"Hacl.Impl.P256.Group.refl"
] | [] | module Hacl.Impl.P256.Group
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BE = Hacl.Impl.Exponentiation.Definitions
module S = Spec.P256
module SL = Spec.P256.Lemmas
open Hacl.Impl.P256.Point
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
unfold
let linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True
unfold
let refl (p:LSeq.lseq uint64 12{point_inv_seq p}) : GTot S.aff_point =
S.to_aff_point (from_mont_point (as_point_nat_seq p))
inline_for_extraction noextract | false | false | Hacl.Impl.P256.Group.fst | {
"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"
} | null | val mk_to_p256_comm_monoid:BE.to_comm_monoid U64 12ul 0ul | [] | Hacl.Impl.P256.Group.mk_to_p256_comm_monoid | {
"file_name": "code/ecdsap256/Hacl.Impl.P256.Group.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Exponentiation.Definitions.to_comm_monoid Lib.IntTypes.U64
(FStar.UInt32.uint_to_t 12 <: FStar.UInt32.t)
(FStar.UInt32.uint_to_t 0 <: FStar.UInt32.t) | {
"end_col": 17,
"end_line": 35,
"start_col": 2,
"start_line": 31
} |
Prims.Tot | val mk_p256_concrete_ops:BE.concrete_ops U64 12ul 0ul | [
{
"abbrev": false,
"full_module": "Hacl.Impl.P256.Point",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.P256.Lemmas",
"short_module": "SL"
},
{
"abbrev": true,
"full_module": "Spec.P256",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Exponentiation.Definitions",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"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": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.P256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.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
}
] | false | let mk_p256_concrete_ops : BE.concrete_ops U64 12ul 0ul = {
BE.to = mk_to_p256_comm_monoid;
BE.lone = point_zero;
BE.lmul = point_add;
BE.lsqr = point_double;
} | val mk_p256_concrete_ops:BE.concrete_ops U64 12ul 0ul
let mk_p256_concrete_ops:BE.concrete_ops U64 12ul 0ul = | false | null | false | {
BE.to = mk_to_p256_comm_monoid;
BE.lone = point_zero;
BE.lmul = point_add;
BE.lsqr = point_double
} | {
"checked_file": "Hacl.Impl.P256.Group.fst.checked",
"dependencies": [
"Spec.P256.Lemmas.fsti.checked",
"Spec.P256.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.P256.PointDouble.fsti.checked",
"Hacl.Impl.P256.PointAdd.fsti.checked",
"Hacl.Impl.P256.Point.fsti.checked",
"Hacl.Impl.Exponentiation.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.P256.Group.fst"
} | [
"total"
] | [
"Hacl.Impl.Exponentiation.Definitions.Mkconcrete_ops",
"Lib.IntTypes.U64",
"FStar.UInt32.uint_to_t",
"FStar.Ghost.hide",
"Hacl.Impl.Exponentiation.Definitions.to_comm_monoid",
"Hacl.Impl.P256.Group.mk_to_p256_comm_monoid",
"Hacl.Impl.P256.Group.point_zero",
"Hacl.Impl.P256.Group.point_add",
"Hacl.Impl.P256.Group.point_double"
] | [] | module Hacl.Impl.P256.Group
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module BE = Hacl.Impl.Exponentiation.Definitions
module S = Spec.P256
module SL = Spec.P256.Lemmas
open Hacl.Impl.P256.Point
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
unfold
let linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True
unfold
let refl (p:LSeq.lseq uint64 12{point_inv_seq p}) : GTot S.aff_point =
S.to_aff_point (from_mont_point (as_point_nat_seq p))
inline_for_extraction noextract
let mk_to_p256_comm_monoid : BE.to_comm_monoid U64 12ul 0ul = {
BE.a_spec = S.aff_point;
BE.comm_monoid = S.mk_p256_comm_monoid;
BE.linv_ctx = linv_ctx;
BE.linv = point_inv_seq;
BE.refl = refl;
}
inline_for_extraction noextract
val point_add : BE.lmul_st U64 12ul 0ul mk_to_p256_comm_monoid
let point_add ctx x y xy =
let h0 = ST.get () in
SL.to_aff_point_add_lemma
(from_mont_point (as_point_nat h0 x)) (from_mont_point (as_point_nat h0 y));
Hacl.Impl.P256.PointAdd.point_add xy x y
inline_for_extraction noextract
val point_double : BE.lsqr_st U64 12ul 0ul mk_to_p256_comm_monoid
let point_double ctx x xx =
let h0 = ST.get () in
SL.to_aff_point_double_lemma (from_mont_point (as_point_nat h0 x));
Hacl.Impl.P256.PointDouble.point_double xx x
inline_for_extraction noextract
val point_zero : BE.lone_st U64 12ul 0ul mk_to_p256_comm_monoid
let point_zero ctx one =
let h0 = ST.get () in
SL.to_aff_point_at_infinity_lemma ();
make_point_at_inf one
inline_for_extraction noextract | false | false | Hacl.Impl.P256.Group.fst | {
"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"
} | null | val mk_p256_concrete_ops:BE.concrete_ops U64 12ul 0ul | [] | Hacl.Impl.P256.Group.mk_p256_concrete_ops | {
"file_name": "code/ecdsap256/Hacl.Impl.P256.Group.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Exponentiation.Definitions.concrete_ops Lib.IntTypes.U64
(FStar.UInt32.uint_to_t 12 <: FStar.UInt32.t)
(FStar.UInt32.uint_to_t 0 <: FStar.UInt32.t) | {
"end_col": 25,
"end_line": 69,
"start_col": 2,
"start_line": 66
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_subscript_FStar__Seq__Base__seq = Seq.index | let va_subscript_FStar__Seq__Base__seq = | false | null | false | Seq.index | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.index",
"FStar.Seq.Base.seq",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50" | false | false | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_subscript_FStar__Seq__Base__seq : s: FStar.Seq.Base.seq _ -> i: Prims.nat{i < FStar.Seq.Base.length s} -> _ | [] | Vale.AES.PPC64LE.GHash.va_subscript_FStar__Seq__Base__seq | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq _ -> i: Prims.nat{i < FStar.Seq.Base.length s} -> _ | {
"end_col": 57,
"end_line": 37,
"start_col": 48,
"start_line": 37
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2 | let hkeys_b_powers
(hkeys_b: buffer128)
(heap0: vale_heap)
(layout: vale_heap_layout)
(ptr: int)
(h: poly)
= | false | null | false | validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2 | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Prims.int",
"Vale.Math.Poly2_s.poly",
"Prims.l_and",
"Vale.PPC64LE.Decls.validSrcAddrs128",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.eq2",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Vale.AES.GHash_BE.gf128_power",
"Prims.logical"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index | false | true | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hkeys_b_powers : hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
heap0: Vale.PPC64LE.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
h: Vale.Math.Poly2_s.poly
-> Prims.logical | [] | Vale.AES.PPC64LE.GHash.hkeys_b_powers | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
heap0: Vale.PPC64LE.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
h: Vale.Math.Poly2_s.poly
-> Prims.logical | {
"end_col": 86,
"end_line": 42,
"start_col": 2,
"start_line": 40
} |
|
Prims.Tot | val va_wp_Ghash_register
(hkeys_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wp_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev) /\
(forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = 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 10 va_x_r10 va_s0))))))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==> va_k
va_sM (()))) | val va_wp_Ghash_register
(hkeys_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_Ghash_register
(hkeys_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let data:(FStar.Seq.Base.seq quad32) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg 5 va_s0)
h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev) /\
(forall (va_x_r10: nat64) (va_x_v0: quad32) (va_x_v1: quad32) (va_x_v2: quad32) (va_x_v3: quad32)
(va_x_v4: quad32) (va_x_v5: quad32) (va_x_v6: quad32) (va_x_v7: quad32) (va_x_v8: quad32)
(va_x_v9: quad32) (va_x_v10: quad32).
let va_sM =
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 10 va_x_r10 va_s0)))
))))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let data:(FStar.Seq.Base.seq quad32) =
FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.AES.PPC64LE.GHash.hkeys_b_powers",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.eq2",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Prims.int",
"Vale.AES.GHash_BE.poly128",
"Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128",
"FStar.Seq.Base.seq",
"Vale.Def.Types_s.quad32",
"FStar.Seq.Base.create",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Prims.l_imp",
"Vale.AES.GHash_BE.ghash_incremental",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : exactly2:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : exactly2:bool -> Tot va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> exactly2:bool -> in_b:buffer128 ->
index:nat -> h_BE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n exactly2) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\ va_state_eq 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 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = 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 4 va_x_v4 (va_upd_vec 3
va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128))
= Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let (n:Prims.nat) = FStar.Seq.Base.length
#quad32 data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : exactly2:bool -> in_b:buffer128 -> index:nat -> h_BE:quad32 ->
y_prev:quad32 -> data:(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_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n exactly2) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32)
(y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n exactly2)) =
(va_QProc (va_code_GhashUnroll_n exactly2) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) (va_wp_GhashUnroll_n exactly2 in_b index h_BE y_prev data) (va_wpProof_GhashUnroll_n
exactly2 in_b index h_BE y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_BE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\
va_state_eq 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 10 va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) (va_s0:va_state) | false | true | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Ghash_register
(hkeys_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.PPC64LE.GHash.va_wp_Ghash_register | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 16,
"end_line": 252,
"start_col": 2,
"start_line": 235
} |
Prims.Tot | val va_wp_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = 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 4 va_x_v4 (va_upd_vec 3
va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128))
= Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let (n:Prims.nat) = FStar.Seq.Base.length
#quad32 data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (()))) | val va_wp_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
(exactly2 ==> n == 2) /\ (~exactly2 ==> n == 1) /\
in_b_blocks in_b
index
n
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg 7 va_s0)
data /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 6 va_s0) ==
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 1)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 2) 64) /\
(exactly2 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 13 va_s0) ==
Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\
(exactly2 ==>
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 14 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))) /\
(forall (va_x_r10: nat64) (va_x_v0: quad32) (va_x_v1: quad32) (va_x_v2: quad32) (va_x_v3: quad32)
(va_x_v4: quad32) (va_x_v8: quad32) (va_x_v9: quad32) (va_x_v10: quad32) (va_x_v11: quad32).
let va_sM =
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 4
va_x_v4
(va_upd_vec 3
va_x_v3
(va_upd_vec 2
va_x_v2
(va_upd_vec 1
va_x_v1
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)))))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.l_imp",
"Prims.eq2",
"Prims.int",
"Prims.l_not",
"Vale.AES.PPC64LE.GHash.in_b_blocks",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.Math.Poly2.swap",
"Vale.AES.GHash_BE.gf128_power",
"Vale.Math.Poly2_s.mul",
"Vale.Math.Poly2_s.div",
"Vale.Math.Poly2_s.monomial",
"Vale.Math.Poly2_s.mod",
"FStar.Seq.Base.length",
"Vale.AES.GHash_BE.poly128",
"Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash_BE.ghash_incremental",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : exactly2:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : exactly2:bool -> Tot va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> exactly2:bool -> in_b:buffer128 ->
index:nat -> h_BE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n exactly2) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\ va_state_eq 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 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32) | false | true | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.PPC64LE.GHash.va_wp_GhashUnroll_n | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
exactly2: Prims.bool ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
index: Prims.nat ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
data: 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 | {
"end_col": 21,
"end_line": 188,
"start_col": 2,
"start_line": 160
} |
Prims.Tot | val va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_BE:quad32) (y_prev:quad32)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in hkeys_b_powers
hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg 5 va_s0) h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b
(va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\ va_get_reg 7 va_s0 + 16
`op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == y_prev) /\ (forall
(va_x_r7:nat64) (va_x_r6:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) (va_x_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_cr0:cr0_t) . let va_sM = va_upd_cr0
va_x_cr0 (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 10 va_x_r10
(va_upd_reg 6 va_x_r6 (va_upd_reg 7 va_x_r7 va_s0)))))))))))))))))) in va_get_ok va_sM /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg 6 va_s0 == 0 ==>
va_get_vec 1 va_sM == va_get_vec 1 va_s0)) ==> va_k va_sM (()))) | val va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg 5 va_s0)
h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg 7 va_s0)
in_b
(va_get_reg 6 va_s0)
(va_get_mem_layout va_s0)
Secret /\
Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\
va_get_reg 7 va_s0 + 16 `op_Multiply` (va_get_reg 6 va_s0) < pow2_64 /\
va_get_vec 1 va_s0 == y_prev) /\
(forall (va_x_r7: nat64) (va_x_r6: nat64) (va_x_r10: nat64) (va_x_v0: quad32) (va_x_v1: quad32)
(va_x_v2: quad32) (va_x_v3: quad32) (va_x_v4: quad32) (va_x_v5: quad32) (va_x_v6: quad32)
(va_x_v7: quad32) (va_x_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_cr0: cr0_t).
let va_sM =
va_upd_cr0 va_x_cr0
(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 10
va_x_r10
(va_upd_reg 6
va_x_r6
(va_upd_reg 7
va_x_r7
va_s0)))))))))))))
)))))
in
va_get_ok va_sM /\
(let h:poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE
y_prev
(Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1
va_sM)
in_b)) /\ (va_get_reg 6 va_s0 == 0 ==> va_get_vec 1 va_sM == va_get_vec 1 va_s0)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.AES.PPC64LE.GHash.hkeys_b_powers",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.validSrcAddrs128",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.eq2",
"Prims.nat",
"Vale.PPC64LE.Decls.buffer_length",
"Vale.PPC64LE.Memory.vuint128",
"Prims.op_LessThan",
"Prims.op_Addition",
"Prims.op_Multiply",
"Vale.PPC64LE.Machine_s.pow2_64",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Machine_s.cr0_t",
"Prims.l_imp",
"Vale.AES.GHash_BE.ghash_incremental0",
"Vale.Arch.Types.reverse_bytes_quad32_seq",
"Vale.PPC64LE.Decls.s128",
"Prims.int",
"Vale.PPC64LE.Machine_s.quad32",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_cr0",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : exactly2:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : exactly2:bool -> Tot va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> exactly2:bool -> in_b:buffer128 ->
index:nat -> h_BE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n exactly2) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\ va_state_eq 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 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = 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 4 va_x_v4 (va_upd_vec 3
va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128))
= Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let (n:Prims.nat) = FStar.Seq.Base.length
#quad32 data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : exactly2:bool -> in_b:buffer128 -> index:nat -> h_BE:quad32 ->
y_prev:quad32 -> data:(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_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n exactly2) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32)
(y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n exactly2)) =
(va_QProc (va_code_GhashUnroll_n exactly2) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) (va_wp_GhashUnroll_n exactly2 in_b index h_BE y_prev data) (va_wpProof_GhashUnroll_n
exactly2 in_b index h_BE y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_BE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\
va_state_eq 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 10 va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev) /\
(forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = 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 10 va_x_r10 va_s0))))))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==> va_k
va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_BE:quad32 -> y_prev: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_Ghash_register hkeys_b h_BE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([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 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([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 10]) (va_wp_Ghash_register hkeys_b h_BE y_prev) (va_wpProof_Ghash_register
hkeys_b h_BE y_prev))
//--
//-- Ghash_buffer
val va_code_Ghash_buffer : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_buffer : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_BE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in hkeys_b_powers hkeys_b (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) (va_get_reg 5 va_s0) h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b
(va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\ va_get_reg 7 va_s0 + 16
`op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == y_prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg 6 va_s0 == 0 ==>
va_get_vec 1 va_sM == va_get_vec 1 va_s0)) /\ va_state_eq va_sM (va_update_cr0 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 10 va_sM
(va_update_reg 6 va_sM (va_update_reg 7 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))
[@ va_qattr]
let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) | false | true | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Ghash_buffer
(hkeys_b in_b: buffer128)
(h_BE y_prev: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.PPC64LE.GHash.va_wp_Ghash_buffer | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 68,
"end_line": 316,
"start_col": 2,
"start_line": 298
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i) | let in_b_blocks
(in_b: buffer128)
(in_index count: int)
(heap_s: vale_heap)
(layout: vale_heap_layout)
(ptr: int)
(data: seq quad32)
= | false | null | false | validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i: nat). {:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.buffer128",
"Prims.int",
"Vale.PPC64LE.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_and",
"Vale.PPC64LE.Decls.validSrcAddrsOffset128",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.eq2",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Prims.op_Addition",
"FStar.Seq.Base.index",
"Prims.logical"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32) | false | true | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val in_b_blocks : in_b: Vale.PPC64LE.Memory.buffer128 ->
in_index: Prims.int ->
count: Prims.int ->
heap_s: Vale.PPC64LE.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
data: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32
-> Prims.logical | [] | Vale.AES.PPC64LE.GHash.in_b_blocks | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
in_b: Vale.PPC64LE.Memory.buffer128 ->
in_index: Prims.int ->
count: Prims.int ->
heap_s: Vale.PPC64LE.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
ptr: Prims.int ->
data: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32
-> Prims.logical | {
"end_col": 87,
"end_line": 50,
"start_col": 2,
"start_line": 47
} |
|
Prims.Tot | val va_wp_ReduceLast
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (()))) | val va_wp_ReduceLast
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_ReduceLast
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
va_get_vec 8 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64))
(Vale.Math.Poly2_s.shift (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\
(forall (va_x_v0: quad32)
(va_x_v1: quad32)
(va_x_v2: quad32)
(va_x_v3: quad32)
(va_x_v4: quad32)
(va_x_v8: quad32)
(va_x_v9: quad32)
(va_x_v10: quad32).
let va_sM =
va_upd_vec 10
va_x_v10
(va_upd_vec 9
va_x_v9
(va_upd_vec 8
va_x_v8
(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_s0)))
))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let prev:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in
let pdata:(Prims.int -> Vale.AES.GHash_BE.poly128) =
Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data
in
let n:Prims.nat = FStar.Seq.Base.length #quad32 data in
let xi = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in
Vale.Math.Poly2.Bits_s.to_quad32 xi == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\
xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.Def.Words_s.Mkfour",
"Prims.op_GreaterThan",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Math.Poly2_s.shift",
"Vale.AES.GHash_BE.ghash_unroll_back",
"Prims.op_Subtraction",
"Prims.nat",
"FStar.Seq.Base.length",
"Prims.int",
"Vale.AES.GHash_BE.poly128",
"Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128",
"Prims.l_Forall",
"Prims.l_imp",
"Vale.Def.Types_s.quad32",
"Vale.Math.Poly2.Bits_s.to_quad32",
"Vale.AES.GHash_BE.ghash_incremental",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state) | false | true | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_ReduceLast
(h_BE y_prev: quad32)
(data: (seq quad32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.PPC64LE.GHash.va_wp_ReduceLast | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
data: 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 | {
"end_col": 64,
"end_line": 103,
"start_col": 2,
"start_line": 84
} |
Prims.Tot | val va_quick_ReduceLast (h_BE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast ())) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data)) | val va_quick_ReduceLast (h_BE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast ()))
let va_quick_ReduceLast (h_BE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast ())) = | false | null | false | (va_QProc (va_code_ReduceLast ())
([
va_Mod_vec 10;
va_Mod_vec 9;
va_Mod_vec 8;
va_Mod_vec 4;
va_Mod_vec 3;
va_Mod_vec 2;
va_Mod_vec 1;
va_Mod_vec 0
])
(va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data)) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.GHash.va_code_ReduceLast",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Prims.Nil",
"Vale.AES.PPC64LE.GHash.va_wp_ReduceLast",
"Vale.AES.PPC64LE.GHash.va_wpProof_ReduceLast",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit | false | false | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_ReduceLast (h_BE y_prev: quad32) (data: (seq quad32))
: (va_quickCode unit (va_code_ReduceLast ())) | [] | Vale.AES.PPC64LE.GHash.va_quick_ReduceLast | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
data: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit (Vale.AES.PPC64LE.GHash.va_code_ReduceLast ()) | {
"end_col": 45,
"end_line": 117,
"start_col": 2,
"start_line": 115
} |
Prims.Tot | val va_quick_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n exactly2)) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_quick_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32)
(y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n exactly2)) =
(va_QProc (va_code_GhashUnroll_n exactly2) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) (va_wp_GhashUnroll_n exactly2 in_b index h_BE y_prev data) (va_wpProof_GhashUnroll_n
exactly2 in_b index h_BE y_prev data)) | val va_quick_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n exactly2))
let va_quick_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n exactly2)) = | false | null | false | (va_QProc (va_code_GhashUnroll_n exactly2)
([
va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10
])
(va_wp_GhashUnroll_n exactly2 in_b index h_BE y_prev data)
(va_wpProof_GhashUnroll_n exactly2 in_b index h_BE y_prev data)) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Prims.bool",
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.GHash.va_code_GhashUnroll_n",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.AES.PPC64LE.GHash.va_wp_GhashUnroll_n",
"Vale.AES.PPC64LE.GHash.va_wpProof_GhashUnroll_n",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : exactly2:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : exactly2:bool -> Tot va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> exactly2:bool -> in_b:buffer128 ->
index:nat -> h_BE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n exactly2) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\ va_state_eq 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 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = 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 4 va_x_v4 (va_upd_vec 3
va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128))
= Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let (n:Prims.nat) = FStar.Seq.Base.length
#quad32 data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : exactly2:bool -> in_b:buffer128 -> index:nat -> h_BE:quad32 ->
y_prev:quad32 -> data:(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_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n exactly2) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) | false | false | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_GhashUnroll_n
(exactly2: bool)
(in_b: buffer128)
(index: nat)
(h_BE y_prev: quad32)
(data: (seq quad32))
: (va_quickCode unit (va_code_GhashUnroll_n exactly2)) | [] | Vale.AES.PPC64LE.GHash.va_quick_GhashUnroll_n | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
exactly2: Prims.bool ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
index: Prims.nat ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32 ->
data: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.GHash.va_code_GhashUnroll_n exactly2) | {
"end_col": 42,
"end_line": 204,
"start_col": 2,
"start_line": 201
} |
Prims.Tot | val va_quick_Ghash_register (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_quick_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([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 10]) (va_wp_Ghash_register hkeys_b h_BE y_prev) (va_wpProof_Ghash_register
hkeys_b h_BE y_prev)) | val va_quick_Ghash_register (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ()))
let va_quick_Ghash_register (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) = | false | null | false | (va_QProc (va_code_Ghash_register ())
([
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 10
])
(va_wp_Ghash_register hkeys_b h_BE y_prev)
(va_wpProof_Ghash_register hkeys_b h_BE y_prev)) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_register",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.AES.PPC64LE.GHash.va_wp_Ghash_register",
"Vale.AES.PPC64LE.GHash.va_wpProof_Ghash_register",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : exactly2:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : exactly2:bool -> Tot va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> exactly2:bool -> in_b:buffer128 ->
index:nat -> h_BE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n exactly2) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\ va_state_eq 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 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = 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 4 va_x_v4 (va_upd_vec 3
va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128))
= Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let (n:Prims.nat) = FStar.Seq.Base.length
#quad32 data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : exactly2:bool -> in_b:buffer128 -> index:nat -> h_BE:quad32 ->
y_prev:quad32 -> data:(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_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n exactly2) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32)
(y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n exactly2)) =
(va_QProc (va_code_GhashUnroll_n exactly2) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) (va_wp_GhashUnroll_n exactly2 in_b index h_BE y_prev data) (va_wpProof_GhashUnroll_n
exactly2 in_b index h_BE y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_BE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\
va_state_eq 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 10 va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev) /\
(forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = 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 10 va_x_r10 va_s0))))))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==> va_k
va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_BE:quad32 -> y_prev: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_Ghash_register hkeys_b h_BE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([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 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) : (va_quickCode unit | false | false | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Ghash_register (hkeys_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_register ())) | [] | Vale.AES.PPC64LE.GHash.va_quick_Ghash_register | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.GHash.va_code_Ghash_register ()) | {
"end_col": 25,
"end_line": 267,
"start_col": 2,
"start_line": 264
} |
Prims.Tot | val va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ())) | [
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math // For lemma_poly_bits64()",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_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.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_quick_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) :
(va_quickCode unit (va_code_Ghash_buffer ())) =
(va_QProc (va_code_Ghash_buffer ()) ([va_Mod_cr0; 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
10; va_Mod_reg 6; va_Mod_reg 7]) (va_wp_Ghash_buffer hkeys_b in_b h_BE y_prev)
(va_wpProof_Ghash_buffer hkeys_b in_b h_BE y_prev)) | val va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ()))
let va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ())) = | false | null | false | (va_QProc (va_code_Ghash_buffer ())
([
va_Mod_cr0; 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 10; va_Mod_reg 6;
va_Mod_reg 7
])
(va_wp_Ghash_buffer hkeys_b in_b h_BE y_prev)
(va_wpProof_Ghash_buffer hkeys_b in_b h_BE y_prev)) | {
"checked_file": "Vale.AES.PPC64LE.GHash.fsti.checked",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.PPC64LE.PolyOps.fsti.checked",
"Vale.AES.PPC64LE.GF128_Mul.fsti.checked",
"Vale.AES.GHash_BE.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_BE_s.fst.checked",
"Vale.AES.GCTR_BE.fsti.checked",
"Vale.AES.GCM_helpers_BE.fsti.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_BE_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.AES.PPC64LE.GHash.fsti"
} | [
"total"
] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_cr0",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Vale.AES.PPC64LE.GHash.va_wp_Ghash_buffer",
"Vale.AES.PPC64LE.GHash.va_wpProof_Ghash_buffer",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | module Vale.AES.PPC64LE.GHash
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsVector
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.AES.AES_helpers
open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers_BE
open Vale.AES.GCTR_BE_s
open Vale.AES.GCTR_BE
open Vale.Arch.TypesNative
open Vale.AES.PPC64LE.PolyOps
open Vale.AES.PPC64LE.GF128_Mul
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash_BE
#reset-options "--z3rlimit 50"
unfold let va_subscript_FStar__Seq__Base__seq = Seq.index
let hkeys_b_powers (hkeys_b:buffer128) (heap0:vale_heap) (layout:vale_heap_layout) (ptr:int) (h:poly) =
validSrcAddrs128 heap0 ptr hkeys_b 3 layout Secret /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 0 heap0)) == gf128_power h 1 /\
of_quad32 (reverse_bytes_quad32 (buffer128_read hkeys_b 1 heap0)) == gf128_power h 2
let in_b_blocks
(in_b:buffer128) (in_index count:int) (heap_s:vale_heap) (layout:vale_heap_layout) (ptr:int) (data:seq quad32)
=
validSrcAddrsOffset128 heap_s ptr in_b in_index count layout Secret /\
(forall (i:nat).{:pattern (index data i)}
i < count /\ i < length data ==>
reverse_bytes_quad32 (buffer128_read in_b (in_index + i) heap_s) == index data i)
//-- ReduceLast
val va_code_ReduceLast : va_dummy:unit -> Tot va_code
val va_codegen_success_ReduceLast : va_dummy:unit -> Tot va_pbool
val va_lemma_ReduceLast : va_b0:va_code -> va_s0:va_state -> h_BE:quad32 -> y_prev:quad32 ->
data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ReduceLast ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) /\ va_state_eq va_sM (va_update_vec 10 va_sM
(va_update_vec 9 va_sM (va_update_vec 8 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_ok va_sM
va_s0)))))))))))
[@ va_qattr]
let va_wp_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 8 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 3254779904 0 0 /\ n > 0 /\ add (add
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 2 va_s0)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 3 va_s0)) 64)) (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 4 va_s0)) 128) ==
Vale.AES.GHash_BE.ghash_unroll_back h prev pdata 0 n (n - 1)) /\ (forall (va_x_v0:quad32)
(va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9
(va_upd_vec 8 va_x_v8 (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_s0))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in let xi =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_sM) in Vale.Math.Poly2.Bits_s.to_quad32 xi ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data /\ xi == Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 xi)) ==> va_k va_sM (())))
val va_wpProof_ReduceLast : h_BE:quad32 -> y_prev:quad32 -> data:(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_ReduceLast h_BE y_prev data va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ReduceLast ()) ([va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec
0]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_ReduceLast (h_BE:quad32) (y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit
(va_code_ReduceLast ())) =
(va_QProc (va_code_ReduceLast ()) ([va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4;
va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0]) (va_wp_ReduceLast h_BE y_prev data)
(va_wpProof_ReduceLast h_BE y_prev data))
//--
//-- GhashUnroll_n
val va_code_GhashUnroll_n : exactly2:bool -> Tot va_code
val va_codegen_success_GhashUnroll_n : exactly2:bool -> Tot va_pbool
val va_lemma_GhashUnroll_n : va_b0:va_code -> va_s0:va_state -> exactly2:bool -> in_b:buffer128 ->
index:nat -> h_BE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_GhashUnroll_n exactly2) va_s0 /\ va_get_ok va_s0 /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\ va_state_eq 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 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0
va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0)))))))))))))
[@ va_qattr]
let va_wp_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32) (y_prev:quad32)
(data:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in let (n:Prims.nat) = FStar.Seq.Base.length #quad32 data in (exactly2 ==> n == 2) /\
(~exactly2 ==> n == 1) /\ in_b_blocks in_b index n (va_get_mem_heaplet 1 va_s0)
(va_get_mem_layout va_s0) (va_get_reg 7 va_s0) data /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 1 va_s0) == prev /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 5 va_s0) ==
Vale.Math.Poly2.swap (Vale.AES.GHash_BE.gf128_power h 1) 64 /\ Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 6 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64) /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 7 va_s0) ==
Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 1) (Vale.Math.Poly2_s.monomial 64) /\
(exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 12 va_s0) == Vale.Math.Poly2.swap
(Vale.AES.GHash_BE.gf128_power h 2) 64) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32
(va_get_vec 13 va_s0) == Vale.Math.Poly2_s.mul (Vale.Math.Poly2_s.div
(Vale.AES.GHash_BE.gf128_power h 2) (Vale.Math.Poly2_s.monomial 64))
(Vale.Math.Poly2_s.monomial 64)) /\ (exactly2 ==> Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec
14 va_s0) == Vale.Math.Poly2_s.mod (Vale.AES.GHash_BE.gf128_power h 2)
(Vale.Math.Poly2_s.monomial 64))) /\ (forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v8:quad32) (va_x_v9:quad32)
(va_x_v10:quad32) (va_x_v11:quad32) . let va_sM = 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 4 va_x_v4 (va_upd_vec 3
va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10
va_x_r10 va_s0))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let (pdata:(Prims.int -> Vale.AES.GHash_BE.poly128))
= Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128 data in let (n:Prims.nat) = FStar.Seq.Base.length
#quad32 data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==>
va_k va_sM (())))
val va_wpProof_GhashUnroll_n : exactly2:bool -> in_b:buffer128 -> index:nat -> h_BE:quad32 ->
y_prev:quad32 -> data:(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_GhashUnroll_n exactly2 in_b index h_BE y_prev data va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_GhashUnroll_n exactly2) ([va_Mod_vec
11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_GhashUnroll_n (exactly2:bool) (in_b:buffer128) (index:nat) (h_BE:quad32)
(y_prev:quad32) (data:(seq quad32)) : (va_quickCode unit (va_code_GhashUnroll_n exactly2)) =
(va_QProc (va_code_GhashUnroll_n exactly2) ([va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg
10]) (va_wp_GhashUnroll_n exactly2 in_b index h_BE y_prev data) (va_wpProof_GhashUnroll_n
exactly2 in_b index h_BE y_prev data))
//--
//-- Ghash_register
val va_code_Ghash_register : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_register : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_register : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> h_BE:quad32
-> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_register ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) /\
va_state_eq 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 10 va_sM (va_update_ok va_sM va_s0)))))))))))))))
[@ va_qattr]
let va_wp_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in
let (data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0)
in let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in hkeys_b_powers hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0)
(va_get_reg 5 va_s0) h /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_vec 1 va_s0) == prev) /\
(forall (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32)
(va_x_v9:quad32) (va_x_v10:quad32) . let va_sM = 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 10 va_x_r10 va_s0))))))))))) in va_get_ok va_sM /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in let
(data:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.create #quad32 1 (va_get_vec 9 va_s0) in
let (prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 y_prev in let
(pdata:(Prims.int -> Vale.AES.GHash_BE.poly128)) = Vale.AES.GHash_BE.fun_seq_quad32_BE_poly128
data in va_get_vec 1 va_sM == Vale.AES.GHash_BE.ghash_incremental h_BE y_prev data) ==> va_k
va_sM (())))
val va_wpProof_Ghash_register : hkeys_b:buffer128 -> h_BE:quad32 -> y_prev: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_Ghash_register hkeys_b h_BE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_register ()) ([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 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_register (hkeys_b:buffer128) (h_BE:quad32) (y_prev:quad32) : (va_quickCode unit
(va_code_Ghash_register ())) =
(va_QProc (va_code_Ghash_register ()) ([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 10]) (va_wp_Ghash_register hkeys_b h_BE y_prev) (va_wpProof_Ghash_register
hkeys_b h_BE y_prev))
//--
//-- Ghash_buffer
val va_code_Ghash_buffer : va_dummy:unit -> Tot va_code
val va_codegen_success_Ghash_buffer : va_dummy:unit -> Tot va_pbool
val va_lemma_Ghash_buffer : va_b0:va_code -> va_s0:va_state -> hkeys_b:buffer128 -> in_b:buffer128
-> h_BE:quad32 -> y_prev:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Ghash_buffer ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in hkeys_b_powers hkeys_b (va_get_mem_heaplet
0 va_s0) (va_get_mem_layout va_s0) (va_get_reg 5 va_s0) h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b
(va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\ va_get_reg 7 va_s0 + 16
`op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == y_prev)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg 6 va_s0 == 0 ==>
va_get_vec 1 va_sM == va_get_vec 1 va_s0)) /\ va_state_eq va_sM (va_update_cr0 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 10 va_sM
(va_update_reg 6 va_sM (va_update_reg 7 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))
[@ va_qattr]
let va_wp_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_BE:quad32) (y_prev:quad32)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in hkeys_b_powers
hkeys_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg 5 va_s0) h /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 7 va_s0) in_b
(va_get_reg 6 va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.buffer_length
#Vale.PPC64LE.Memory.vuint128 in_b == va_get_reg 6 va_s0 /\ va_get_reg 7 va_s0 + 16
`op_Multiply` va_get_reg 6 va_s0 < pow2_64 /\ va_get_vec 1 va_s0 == y_prev) /\ (forall
(va_x_r7:nat64) (va_x_r6:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32)
(va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32)
(va_x_v7:quad32) (va_x_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_cr0:cr0_t) . let va_sM = va_upd_cr0
va_x_cr0 (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 10 va_x_r10
(va_upd_reg 6 va_x_r6 (va_upd_reg 7 va_x_r7 va_s0)))))))))))))))))) in va_get_ok va_sM /\ (let
(h:poly) = Vale.Math.Poly2.Bits_s.of_quad32 h_BE in va_get_vec 1 va_sM ==
Vale.AES.GHash_BE.ghash_incremental0 h_BE y_prev (Vale.Arch.Types.reverse_bytes_quad32_seq
(Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 1 va_sM) in_b)) /\ (va_get_reg 6 va_s0 == 0 ==>
va_get_vec 1 va_sM == va_get_vec 1 va_s0)) ==> va_k va_sM (())))
val va_wpProof_Ghash_buffer : hkeys_b:buffer128 -> in_b:buffer128 -> h_BE:quad32 -> y_prev: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_Ghash_buffer hkeys_b in_b h_BE y_prev va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Ghash_buffer ()) ([va_Mod_cr0;
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 10; va_Mod_reg 6; va_Mod_reg 7]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Ghash_buffer (hkeys_b:buffer128) (in_b:buffer128) (h_BE:quad32) (y_prev:quad32) : | false | false | Vale.AES.PPC64LE.GHash.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Ghash_buffer (hkeys_b in_b: buffer128) (h_BE y_prev: quad32)
: (va_quickCode unit (va_code_Ghash_buffer ())) | [] | Vale.AES.PPC64LE.GHash.va_quick_Ghash_buffer | {
"file_name": "obj/Vale.AES.PPC64LE.GHash.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
hkeys_b: Vale.PPC64LE.Memory.buffer128 ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
h_BE: Vale.PPC64LE.Memory.quad32 ->
y_prev: Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit (Vale.AES.PPC64LE.GHash.va_code_Ghash_buffer ()) | {
"end_col": 55,
"end_line": 334,
"start_col": 2,
"start_line": 330
} |
Steel.Effect.Atomic.SteelAtomicUT | val witness (#inames: _) (#a:Type) (#pcm:pcm a)
(r:erased (ref a pcm))
(fact:stable_property pcm)
(v:erased a)
(_:fact_valid_compat fact v)
: SteelAtomicUT (witnessed r fact) inames
(pts_to r v)
(fun _ -> pts_to r v) | [
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let witness r fact v s =
let w = witness' r fact v s in
w | val witness (#inames: _) (#a:Type) (#pcm:pcm a)
(r:erased (ref a pcm))
(fact:stable_property pcm)
(v:erased a)
(_:fact_valid_compat fact v)
: SteelAtomicUT (witnessed r fact) inames
(pts_to r v)
(fun _ -> pts_to r v)
let witness r fact v s = | true | null | false | let w = witness' r fact v s in
w | {
"checked_file": "Steel.PCMReference.fst.checked",
"dependencies": [
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked"
],
"interface_file": true,
"source_file": "Steel.PCMReference.fst"
} | [] | [
"Steel.Memory.inames",
"FStar.PCM.pcm",
"FStar.Ghost.erased",
"Steel.Memory.ref",
"Steel.Memory.stable_property",
"Steel.PCMReference.fact_valid_compat",
"Steel.Memory.witnessed",
"FStar.Ghost.reveal",
"Steel.PCMReference.witness'"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.PCMReference
module Mem = Steel.Memory
let read r v0 = let v = as_action (sel_action FStar.Set.empty r v0) in v
let write r v0 v1 = as_action (upd_action FStar.Set.empty r v0 v1)
val alloc' (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
(to_vprop Mem.emp)
(fun r -> pts_to r x)
(requires fun _ -> compatible pcm x x /\ pcm.refine x)
(ensures fun _ _ _ -> True)
let alloc' x = as_action (alloc_action FStar.Set.empty x)
let alloc #_ #pcm x = rewrite_slprop emp (to_vprop Mem.emp) (fun _ -> reveal_emp ());
compatible_refl pcm x;
alloc' x
let free r x = as_action (free_action FStar.Set.empty r x)
val split'
(#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a{composable p v0 v1})
: SteelGhostT unit inames (pts_to r (op p v0 v1))
(fun _ -> to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
let split' #inames #a #p r v0 v1 = as_atomic_action_ghost (split_action inames r v0 v1)
let split #_ #a #p r v v0 v1 =
let _:squash (composable p v0 v1) = () in
rewrite_slprop (pts_to r v) (pts_to r (op p v0 v1)) (fun _ -> ());
split' r v0 v1;
rewrite_slprop (to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(pts_to r v0 `star` pts_to r v1)
(fun _ -> ())
val gather'
(#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: SteelGhostT (_:unit{composable p v0 v1}) inames
(to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(fun _ -> pts_to r (op p v0 v1))
let gather' #inames r v0 v1 = as_atomic_action_ghost (gather_action inames r v0 v1)
let gather r v0 v1 =
rewrite_slprop (pts_to r v0 `star` pts_to r v1)
(to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(fun _ -> ());
gather' r v0 v1
val witness' (#inames: _) (#a:Type) (#pcm:pcm a)
(r:erased (ref a pcm))
(fact:stable_property pcm)
(v:erased a)
(_:fact_valid_compat fact v)
: SteelAtomicUT (witnessed r fact) inames (pts_to r v)
(fun _ -> to_vprop Mem.(pts_to r v))
let witness' #inames r fact v _ = as_atomic_unobservable_action (Steel.Memory.witness inames r fact v ()) | false | false | Steel.PCMReference.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val witness (#inames: _) (#a:Type) (#pcm:pcm a)
(r:erased (ref a pcm))
(fact:stable_property pcm)
(v:erased a)
(_:fact_valid_compat fact v)
: SteelAtomicUT (witnessed r fact) inames
(pts_to r v)
(fun _ -> pts_to r v) | [] | Steel.PCMReference.witness | {
"file_name": "lib/steel/Steel.PCMReference.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
r: FStar.Ghost.erased (Steel.Memory.ref a pcm) ->
fact: Steel.Memory.stable_property pcm ->
v: FStar.Ghost.erased a ->
s: Steel.PCMReference.fact_valid_compat fact v
-> Steel.Effect.Atomic.SteelAtomicUT (Steel.Memory.witnessed (FStar.Ghost.reveal r) fact) | {
"end_col": 3,
"end_line": 93,
"start_col": 24,
"start_line": 91
} |
Steel.Effect.Steel | val alloc (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
emp
(fun r -> pts_to r x)
(requires fun _ -> pcm.refine x)
(ensures fun _ _ _ -> True) | [
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let alloc #_ #pcm x = rewrite_slprop emp (to_vprop Mem.emp) (fun _ -> reveal_emp ());
compatible_refl pcm x;
alloc' x | val alloc (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
emp
(fun r -> pts_to r x)
(requires fun _ -> pcm.refine x)
(ensures fun _ _ _ -> True)
let alloc #_ #pcm x = | true | null | false | rewrite_slprop emp (to_vprop Mem.emp) (fun _ -> reveal_emp ());
compatible_refl pcm x;
alloc' x | {
"checked_file": "Steel.PCMReference.fst.checked",
"dependencies": [
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked"
],
"interface_file": true,
"source_file": "Steel.PCMReference.fst"
} | [] | [
"FStar.PCM.pcm",
"Steel.PCMReference.alloc'",
"Steel.Memory.ref",
"Prims.unit",
"FStar.PCM.compatible_refl",
"Steel.Effect.Atomic.rewrite_slprop",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.Effect.Common.emp",
"Steel.Effect.Common.to_vprop",
"Steel.Memory.emp",
"Steel.Memory.mem",
"Steel.Effect.Common.reveal_emp"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.PCMReference
module Mem = Steel.Memory
let read r v0 = let v = as_action (sel_action FStar.Set.empty r v0) in v
let write r v0 v1 = as_action (upd_action FStar.Set.empty r v0 v1)
val alloc' (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
(to_vprop Mem.emp)
(fun r -> pts_to r x)
(requires fun _ -> compatible pcm x x /\ pcm.refine x)
(ensures fun _ _ _ -> True)
let alloc' x = as_action (alloc_action FStar.Set.empty x) | false | false | Steel.PCMReference.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val alloc (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
emp
(fun r -> pts_to r x)
(requires fun _ -> pcm.refine x)
(ensures fun _ _ _ -> True) | [] | Steel.PCMReference.alloc | {
"file_name": "lib/steel/Steel.PCMReference.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | x: a -> Steel.Effect.Steel (Steel.Memory.ref a pcm) | {
"end_col": 22,
"end_line": 38,
"start_col": 22,
"start_line": 36
} |
Steel.Effect.Atomic.SteelGhostT | val gather (#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: SteelGhostT (_:unit{composable p v0 v1}) inames
(pts_to r v0 `star` pts_to r v1)
(fun _ -> pts_to r (op p v0 v1)) | [
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let gather r v0 v1 =
rewrite_slprop (pts_to r v0 `star` pts_to r v1)
(to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(fun _ -> ());
gather' r v0 v1 | val gather (#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: SteelGhostT (_:unit{composable p v0 v1}) inames
(pts_to r v0 `star` pts_to r v1)
(fun _ -> pts_to r (op p v0 v1))
let gather r v0 v1 = | true | null | false | rewrite_slprop ((pts_to r v0) `star` (pts_to r v1))
(to_vprop Mem.((pts_to r v0) `star` (pts_to r v1)))
(fun _ -> ());
gather' r v0 v1 | {
"checked_file": "Steel.PCMReference.fst.checked",
"dependencies": [
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked"
],
"interface_file": true,
"source_file": "Steel.PCMReference.fst"
} | [] | [
"Steel.Memory.inames",
"FStar.PCM.pcm",
"Steel.Memory.ref",
"FStar.Ghost.erased",
"Steel.PCMReference.gather'",
"Prims.unit",
"FStar.PCM.composable",
"FStar.Ghost.reveal",
"Steel.Effect.Atomic.rewrite_slprop",
"Steel.Effect.Common.star",
"Steel.PCMReference.pts_to",
"Steel.Effect.Common.to_vprop",
"Steel.Memory.star",
"Steel.Memory.pts_to",
"Steel.Memory.mem"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.PCMReference
module Mem = Steel.Memory
let read r v0 = let v = as_action (sel_action FStar.Set.empty r v0) in v
let write r v0 v1 = as_action (upd_action FStar.Set.empty r v0 v1)
val alloc' (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
(to_vprop Mem.emp)
(fun r -> pts_to r x)
(requires fun _ -> compatible pcm x x /\ pcm.refine x)
(ensures fun _ _ _ -> True)
let alloc' x = as_action (alloc_action FStar.Set.empty x)
let alloc #_ #pcm x = rewrite_slprop emp (to_vprop Mem.emp) (fun _ -> reveal_emp ());
compatible_refl pcm x;
alloc' x
let free r x = as_action (free_action FStar.Set.empty r x)
val split'
(#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a{composable p v0 v1})
: SteelGhostT unit inames (pts_to r (op p v0 v1))
(fun _ -> to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
let split' #inames #a #p r v0 v1 = as_atomic_action_ghost (split_action inames r v0 v1)
let split #_ #a #p r v v0 v1 =
let _:squash (composable p v0 v1) = () in
rewrite_slprop (pts_to r v) (pts_to r (op p v0 v1)) (fun _ -> ());
split' r v0 v1;
rewrite_slprop (to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(pts_to r v0 `star` pts_to r v1)
(fun _ -> ())
val gather'
(#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: SteelGhostT (_:unit{composable p v0 v1}) inames
(to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(fun _ -> pts_to r (op p v0 v1))
let gather' #inames r v0 v1 = as_atomic_action_ghost (gather_action inames r v0 v1) | false | false | Steel.PCMReference.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val gather (#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: SteelGhostT (_:unit{composable p v0 v1}) inames
(pts_to r v0 `star` pts_to r v1)
(fun _ -> pts_to r (op p v0 v1)) | [] | Steel.PCMReference.gather | {
"file_name": "lib/steel/Steel.PCMReference.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | r: Steel.Memory.ref a p -> v0: FStar.Ghost.erased a -> v1: FStar.Ghost.erased a
-> Steel.Effect.Atomic.SteelGhostT
(_: Prims.unit{FStar.PCM.composable p (FStar.Ghost.reveal v0) (FStar.Ghost.reveal v1)}) | {
"end_col": 17,
"end_line": 79,
"start_col": 2,
"start_line": 76
} |
Steel.Effect.Atomic.SteelGhost | val split (#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v:erased a)
(v0:erased a)
(v1:erased a)
: SteelGhost unit inames (pts_to r v)
(fun _ -> pts_to r v0 `star` pts_to r v1)
(requires fun _ ->
composable p v0 v1 /\
v == hide (op p v0 v1))
(ensures fun _ _ _ -> True) | [
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let split #_ #a #p r v v0 v1 =
let _:squash (composable p v0 v1) = () in
rewrite_slprop (pts_to r v) (pts_to r (op p v0 v1)) (fun _ -> ());
split' r v0 v1;
rewrite_slprop (to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(pts_to r v0 `star` pts_to r v1)
(fun _ -> ()) | val split (#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v:erased a)
(v0:erased a)
(v1:erased a)
: SteelGhost unit inames (pts_to r v)
(fun _ -> pts_to r v0 `star` pts_to r v1)
(requires fun _ ->
composable p v0 v1 /\
v == hide (op p v0 v1))
(ensures fun _ _ _ -> True)
let split #_ #a #p r v v0 v1 = | true | null | false | let _:squash (composable p v0 v1) = () in
rewrite_slprop (pts_to r v) (pts_to r (op p v0 v1)) (fun _ -> ());
split' r v0 v1;
rewrite_slprop (to_vprop Mem.((pts_to r v0) `star` (pts_to r v1)))
((pts_to r v0) `star` (pts_to r v1))
(fun _ -> ()) | {
"checked_file": "Steel.PCMReference.fst.checked",
"dependencies": [
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked"
],
"interface_file": true,
"source_file": "Steel.PCMReference.fst"
} | [] | [
"Steel.Memory.inames",
"FStar.PCM.pcm",
"Steel.Memory.ref",
"FStar.Ghost.erased",
"Steel.Effect.Atomic.rewrite_slprop",
"Steel.Effect.Common.to_vprop",
"Steel.Memory.star",
"Steel.Memory.pts_to",
"FStar.Ghost.reveal",
"Steel.Effect.Common.star",
"Steel.PCMReference.pts_to",
"Steel.Memory.mem",
"Prims.unit",
"Steel.PCMReference.split'",
"FStar.PCM.op",
"Prims.squash",
"FStar.PCM.composable"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.PCMReference
module Mem = Steel.Memory
let read r v0 = let v = as_action (sel_action FStar.Set.empty r v0) in v
let write r v0 v1 = as_action (upd_action FStar.Set.empty r v0 v1)
val alloc' (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
(to_vprop Mem.emp)
(fun r -> pts_to r x)
(requires fun _ -> compatible pcm x x /\ pcm.refine x)
(ensures fun _ _ _ -> True)
let alloc' x = as_action (alloc_action FStar.Set.empty x)
let alloc #_ #pcm x = rewrite_slprop emp (to_vprop Mem.emp) (fun _ -> reveal_emp ());
compatible_refl pcm x;
alloc' x
let free r x = as_action (free_action FStar.Set.empty r x)
val split'
(#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a{composable p v0 v1})
: SteelGhostT unit inames (pts_to r (op p v0 v1))
(fun _ -> to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
let split' #inames #a #p r v0 v1 = as_atomic_action_ghost (split_action inames r v0 v1) | false | false | Steel.PCMReference.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val split (#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v:erased a)
(v0:erased a)
(v1:erased a)
: SteelGhost unit inames (pts_to r v)
(fun _ -> pts_to r v0 `star` pts_to r v1)
(requires fun _ ->
composable p v0 v1 /\
v == hide (op p v0 v1))
(ensures fun _ _ _ -> True) | [] | Steel.PCMReference.split | {
"file_name": "lib/steel/Steel.PCMReference.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
r: Steel.Memory.ref a p ->
v: FStar.Ghost.erased a ->
v0: FStar.Ghost.erased a ->
v1: FStar.Ghost.erased a
-> Steel.Effect.Atomic.SteelGhost Prims.unit | {
"end_col": 30,
"end_line": 60,
"start_col": 30,
"start_line": 54
} |
Steel.Effect.Atomic.SteelAtomicU | val recall (#inames: _) (#a:Type u#1) (#pcm:pcm a)
(fact:property a)
(r:erased (ref a pcm))
(v:erased a)
(w:witnessed r fact)
: SteelAtomicU (erased a) inames
(pts_to r v)
(fun v1 -> pts_to r v)
(requires fun _ -> True)
(ensures fun _ v1 _ -> fact v1 /\ compatible pcm v v1) | [
{
"abbrev": true,
"full_module": "Steel.Memory",
"short_module": "Mem"
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let recall #inames #a #pcm fact r v w =
let v1 = recall' fact r v w in
rewrite_slprop (to_vprop Mem.(pts_to r v `star` pure (fact v1)))
(pts_to r v `star` pure (fact v1))
(fun _ -> ());
elim_pure (fact v1);
v1 | val recall (#inames: _) (#a:Type u#1) (#pcm:pcm a)
(fact:property a)
(r:erased (ref a pcm))
(v:erased a)
(w:witnessed r fact)
: SteelAtomicU (erased a) inames
(pts_to r v)
(fun v1 -> pts_to r v)
(requires fun _ -> True)
(ensures fun _ v1 _ -> fact v1 /\ compatible pcm v v1)
let recall #inames #a #pcm fact r v w = | true | null | false | let v1 = recall' fact r v w in
rewrite_slprop (to_vprop Mem.((pts_to r v) `star` (pure (fact v1))))
((pts_to r v) `star` (pure (fact v1)))
(fun _ -> ());
elim_pure (fact v1);
v1 | {
"checked_file": "Steel.PCMReference.fst.checked",
"dependencies": [
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked"
],
"interface_file": true,
"source_file": "Steel.PCMReference.fst"
} | [] | [
"Steel.Memory.inames",
"FStar.PCM.pcm",
"Steel.Memory.property",
"FStar.Ghost.erased",
"Steel.Memory.ref",
"Steel.Memory.witnessed",
"FStar.Ghost.reveal",
"Prims.unit",
"Steel.Effect.Atomic.elim_pure",
"Steel.Effect.Atomic.rewrite_slprop",
"Steel.Effect.Common.to_vprop",
"Steel.Memory.star",
"Steel.Memory.pts_to",
"Steel.Memory.pure",
"Steel.Effect.Common.star",
"Steel.PCMReference.pts_to",
"Steel.Effect.Common.pure",
"Steel.Memory.mem",
"FStar.PCM.compatible",
"Steel.PCMReference.recall'"
] | [] | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.PCMReference
module Mem = Steel.Memory
let read r v0 = let v = as_action (sel_action FStar.Set.empty r v0) in v
let write r v0 v1 = as_action (upd_action FStar.Set.empty r v0 v1)
val alloc' (#a:Type)
(#pcm:pcm a)
(x:a)
: Steel (ref a pcm)
(to_vprop Mem.emp)
(fun r -> pts_to r x)
(requires fun _ -> compatible pcm x x /\ pcm.refine x)
(ensures fun _ _ _ -> True)
let alloc' x = as_action (alloc_action FStar.Set.empty x)
let alloc #_ #pcm x = rewrite_slprop emp (to_vprop Mem.emp) (fun _ -> reveal_emp ());
compatible_refl pcm x;
alloc' x
let free r x = as_action (free_action FStar.Set.empty r x)
val split'
(#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a{composable p v0 v1})
: SteelGhostT unit inames (pts_to r (op p v0 v1))
(fun _ -> to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
let split' #inames #a #p r v0 v1 = as_atomic_action_ghost (split_action inames r v0 v1)
let split #_ #a #p r v v0 v1 =
let _:squash (composable p v0 v1) = () in
rewrite_slprop (pts_to r v) (pts_to r (op p v0 v1)) (fun _ -> ());
split' r v0 v1;
rewrite_slprop (to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(pts_to r v0 `star` pts_to r v1)
(fun _ -> ())
val gather'
(#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: SteelGhostT (_:unit{composable p v0 v1}) inames
(to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(fun _ -> pts_to r (op p v0 v1))
let gather' #inames r v0 v1 = as_atomic_action_ghost (gather_action inames r v0 v1)
let gather r v0 v1 =
rewrite_slprop (pts_to r v0 `star` pts_to r v1)
(to_vprop Mem.(pts_to r v0 `star` pts_to r v1))
(fun _ -> ());
gather' r v0 v1
val witness' (#inames: _) (#a:Type) (#pcm:pcm a)
(r:erased (ref a pcm))
(fact:stable_property pcm)
(v:erased a)
(_:fact_valid_compat fact v)
: SteelAtomicUT (witnessed r fact) inames (pts_to r v)
(fun _ -> to_vprop Mem.(pts_to r v))
let witness' #inames r fact v _ = as_atomic_unobservable_action (Steel.Memory.witness inames r fact v ())
let witness r fact v s =
let w = witness' r fact v s in
w
val recall' (#inames: _) (#a:Type u#1) (#pcm:pcm a) (fact:property a)
(r:erased (ref a pcm))
(v:erased a)
(w:witnessed r fact)
: SteelAtomicUT (v1:erased a{compatible pcm v v1}) inames
(to_vprop Mem.(pts_to r v))
(fun v1 -> to_vprop Mem.(pts_to r v `star` pure (fact v1)))
let recall' #inames #a #pcm fact r v w = as_atomic_unobservable_action (Steel.Memory.recall #a #pcm #fact inames r v w) | false | false | Steel.PCMReference.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val recall (#inames: _) (#a:Type u#1) (#pcm:pcm a)
(fact:property a)
(r:erased (ref a pcm))
(v:erased a)
(w:witnessed r fact)
: SteelAtomicU (erased a) inames
(pts_to r v)
(fun v1 -> pts_to r v)
(requires fun _ -> True)
(ensures fun _ v1 _ -> fact v1 /\ compatible pcm v v1) | [] | Steel.PCMReference.recall | {
"file_name": "lib/steel/Steel.PCMReference.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
fact: Steel.Memory.property a ->
r: FStar.Ghost.erased (Steel.Memory.ref a pcm) ->
v: FStar.Ghost.erased a ->
w: Steel.Memory.witnessed (FStar.Ghost.reveal r) fact
-> Steel.Effect.Atomic.SteelAtomicU (FStar.Ghost.erased a) | {
"end_col": 4,
"end_line": 111,
"start_col": 39,
"start_line": 105
} |
Prims.Tot | val blake2b_update_block:Impl.blake2_update_block_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256 | val blake2b_update_block:Impl.blake2_update_block_st Spec.Blake2B Core.M256
let blake2b_update_block:Impl.blake2_update_block_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_update_block #Spec.Blake2B #Core.M256 | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_block",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_update_block:Impl.blake2_update_block_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_update_block | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_block_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 51,
"end_line": 11,
"start_col": 2,
"start_line": 11
} |
Prims.Tot | val blake2b_update_key:Impl.blake2_update_key_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block | val blake2b_update_key:Impl.blake2_update_key_st Spec.Blake2B Core.M256
let blake2b_update_key:Impl.blake2_update_key_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_key",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256",
"Hacl.Blake2b_256.blake2b_update_block"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256 | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_update_key:Impl.blake2_update_key_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_update_key | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_key_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 70,
"end_line": 17,
"start_col": 2,
"start_line": 17
} |
Prims.Tot | val blake2b_update_multi:Impl.blake2_update_multi_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block | val blake2b_update_multi:Impl.blake2_update_multi_st Spec.Blake2B Core.M256
let blake2b_update_multi:Impl.blake2_update_multi_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_multi",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256",
"Hacl.Blake2b_256.blake2b_update_block"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_update_multi:Impl.blake2_update_multi_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_update_multi | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_multi_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 72,
"end_line": 20,
"start_col": 2,
"start_line": 20
} |
Prims.Tot | val blake2b_finish:Impl.blake2_finish_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_finish : Impl.blake2_finish_st Spec.Blake2B Core.M256 =
Impl.blake2_finish #Spec.Blake2B #Core.M256 | val blake2b_finish:Impl.blake2_finish_st Spec.Blake2B Core.M256
let blake2b_finish:Impl.blake2_finish_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_finish #Spec.Blake2B #Core.M256 | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_finish",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private
let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last
[@CInline]
private
let blake2b_update : Impl.blake2_update_st Spec.Blake2B Core.M256 =
Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_finish:Impl.blake2_finish_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_finish | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_finish_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 45,
"end_line": 36,
"start_col": 2,
"start_line": 36
} |
Prims.Tot | val blake2b_update_last:Impl.blake2_update_last_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block | val blake2b_update_last:Impl.blake2_update_last_st Spec.Blake2B Core.M256
let blake2b_update_last:Impl.blake2_update_last_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_last",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256",
"Hacl.Blake2b_256.blake2b_update_block"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_update_last:Impl.blake2_update_last_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_update_last | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_last_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 71,
"end_line": 23,
"start_col": 2,
"start_line": 23
} |
Prims.Tot | val blake2b:Impl.blake2_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b : Impl.blake2_st Spec.Blake2B Core.M256 =
Impl.blake2 #Spec.Blake2B #Core.M256 blake2b_init blake2b_update blake2b_finish | val blake2b:Impl.blake2_st Spec.Blake2B Core.M256
let blake2b:Impl.blake2_st Spec.Blake2B Core.M256 = | true | null | false | Impl.blake2 #Spec.Blake2B #Core.M256 blake2b_init blake2b_update blake2b_finish | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256",
"Hacl.Blake2b_256.blake2b_init",
"Hacl.Blake2b_256.blake2b_update",
"Hacl.Blake2b_256.blake2b_finish"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private
let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last
[@CInline]
private
let blake2b_update : Impl.blake2_update_st Spec.Blake2B Core.M256 =
Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks
let blake2b_finish : Impl.blake2_finish_st Spec.Blake2B Core.M256 =
Impl.blake2_finish #Spec.Blake2B #Core.M256
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2b digest of message `d` using key `k` into `output`.
@param nn Length of the to-be-generated digest with 1 <= `nn` <= 64.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."] | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b:Impl.blake2_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 81,
"end_line": 48,
"start_col": 2,
"start_line": 48
} |
Prims.Tot | val store_state256b_to_state32:Core.store_state_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let store_state256b_to_state32: Core.store_state_st Spec.Blake2B Core.M256 =
Core.store_state_to_state32 #Spec.Blake2B #Core.M256 | val store_state256b_to_state32:Core.store_state_st Spec.Blake2B Core.M256
let store_state256b_to_state32:Core.store_state_st Spec.Blake2B Core.M256 = | false | null | false | Core.store_state_to_state32 #Spec.Blake2B #Core.M256 | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Core.store_state_to_state32",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private
let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last
[@CInline]
private
let blake2b_update : Impl.blake2_update_st Spec.Blake2B Core.M256 =
Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks
let blake2b_finish : Impl.blake2_finish_st Spec.Blake2B Core.M256 =
Impl.blake2_finish #Spec.Blake2B #Core.M256
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2b digest of message `d` using key `k` into `output`.
@param nn Length of the to-be-generated digest with 1 <= `nn` <= 64.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."]
let blake2b : Impl.blake2_st Spec.Blake2B Core.M256 =
Impl.blake2 #Spec.Blake2B #Core.M256 blake2b_init blake2b_update blake2b_finish
let load_state256b_from_state32: Core.load_state_st Spec.Blake2B Core.M256 =
Core.load_state_from_state32 #Spec.Blake2B #Core.M256 | false | true | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val store_state256b_to_state32:Core.store_state_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.store_state256b_to_state32 | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Core.store_state_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 54,
"end_line": 53,
"start_col": 2,
"start_line": 53
} |
Prims.Tot | val blake2b_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last | val blake2b_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2B Core.M256
let blake2b_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update_blocks",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256",
"Hacl.Blake2b_256.blake2b_update_multi",
"Hacl.Blake2b_256.blake2b_update_last"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_update_blocks:Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_update_blocks | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_blocks_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 93,
"end_line": 28,
"start_col": 2,
"start_line": 28
} |
Prims.Tot | val load_state256b_from_state32:Core.load_state_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let load_state256b_from_state32: Core.load_state_st Spec.Blake2B Core.M256 =
Core.load_state_from_state32 #Spec.Blake2B #Core.M256 | val load_state256b_from_state32:Core.load_state_st Spec.Blake2B Core.M256
let load_state256b_from_state32:Core.load_state_st Spec.Blake2B Core.M256 = | false | null | false | Core.load_state_from_state32 #Spec.Blake2B #Core.M256 | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Core.load_state_from_state32",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private
let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last
[@CInline]
private
let blake2b_update : Impl.blake2_update_st Spec.Blake2B Core.M256 =
Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks
let blake2b_finish : Impl.blake2_finish_st Spec.Blake2B Core.M256 =
Impl.blake2_finish #Spec.Blake2B #Core.M256
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2b digest of message `d` using key `k` into `output`.
@param nn Length of the to-be-generated digest with 1 <= `nn` <= 64.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."]
let blake2b : Impl.blake2_st Spec.Blake2B Core.M256 =
Impl.blake2 #Spec.Blake2B #Core.M256 blake2b_init blake2b_update blake2b_finish | false | true | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val load_state256b_from_state32:Core.load_state_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.load_state256b_from_state32 | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Core.load_state_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 55,
"end_line": 51,
"start_col": 2,
"start_line": 51
} |
Prims.Tot | val blake2b_update:Impl.blake2_update_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_update : Impl.blake2_update_st Spec.Blake2B Core.M256 =
Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks | val blake2b_update:Impl.blake2_update_st Spec.Blake2B Core.M256
let blake2b_update:Impl.blake2_update_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_update",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256",
"Hacl.Blake2b_256.blake2b_update_key",
"Hacl.Blake2b_256.blake2b_update_blocks"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private
let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last
[@CInline]
private | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_update:Impl.blake2_update_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_update | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_update_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 86,
"end_line": 33,
"start_col": 2,
"start_line": 33
} |
Prims.Tot | val blake2b_init:Impl.blake2_init_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256 | val blake2b_init:Impl.blake2_init_st Spec.Blake2B Core.M256
let blake2b_init:Impl.blake2_init_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_init #Spec.Blake2B #Core.M256 | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_init",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256 | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_init:Impl.blake2_init_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_init | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_init_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 43,
"end_line": 14,
"start_col": 2,
"start_line": 14
} |
Prims.Tot | val blake2b_malloc:Impl.blake2_malloc_st Spec.Blake2B Core.M256 | [
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": "Core"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Blake2.Generic",
"short_module": "Impl"
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"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
}
] | false | let blake2b_malloc : Impl.blake2_malloc_st Spec.Blake2B Core.M256 =
Impl.blake2_malloc Spec.Blake2B Core.M256 | val blake2b_malloc:Impl.blake2_malloc_st Spec.Blake2B Core.M256
let blake2b_malloc:Impl.blake2_malloc_st Spec.Blake2B Core.M256 = | false | null | false | Impl.blake2_malloc Spec.Blake2B Core.M256 | {
"checked_file": "Hacl.Blake2b_256.fst.checked",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Hacl.Impl.Blake2.Generic.fst.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Blake2b_256.fst"
} | [
"total"
] | [
"Hacl.Impl.Blake2.Generic.blake2_malloc",
"Spec.Blake2.Blake2B",
"Hacl.Impl.Blake2.Core.M256"
] | [] | module Hacl.Blake2b_256
module Spec = Spec.Blake2
module Impl = Hacl.Impl.Blake2.Generic
module Core = Hacl.Impl.Blake2.Core
(* Some specialized components of blake2 *)
[@CInline]
private
let blake2b_update_block : Impl.blake2_update_block_st Spec.Blake2B Core.M256 =
Impl.blake2_update_block #Spec.Blake2B #Core.M256
let blake2b_init : Impl.blake2_init_st Spec.Blake2B Core.M256 =
Impl.blake2_init #Spec.Blake2B #Core.M256
let blake2b_update_key : Impl.blake2_update_key_st Spec.Blake2B Core.M256 =
Impl.blake2_update_key #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_multi : Impl.blake2_update_multi_st Spec.Blake2B Core.M256 =
Impl.blake2_update_multi #Spec.Blake2B #Core.M256 blake2b_update_block
let blake2b_update_last : Impl.blake2_update_last_st Spec.Blake2B Core.M256 =
Impl.blake2_update_last #Spec.Blake2B #Core.M256 blake2b_update_block
[@CInline]
private
let blake2b_update_blocks : Impl.blake2_update_blocks_st Spec.Blake2B Core.M256 =
Impl.blake2_update_blocks #Spec.Blake2B #Core.M256 blake2b_update_multi blake2b_update_last
[@CInline]
private
let blake2b_update : Impl.blake2_update_st Spec.Blake2B Core.M256 =
Impl.blake2_update #Spec.Blake2B #Core.M256 blake2b_update_key blake2b_update_blocks
let blake2b_finish : Impl.blake2_finish_st Spec.Blake2B Core.M256 =
Impl.blake2_finish #Spec.Blake2B #Core.M256
(* The one-shot hash *)
[@@ Comment "Write the BLAKE2b digest of message `d` using key `k` into `output`.
@param nn Length of the to-be-generated digest with 1 <= `nn` <= 64.
@param output Pointer to `nn` bytes of memory where the digest is written to.
@param ll Length of the input message.
@param d Pointer to `ll` bytes of memory where the input message is read from.
@param kk Length of the key. Can be 0.
@param k Pointer to `kk` bytes of memory where the key is read from."]
let blake2b : Impl.blake2_st Spec.Blake2B Core.M256 =
Impl.blake2 #Spec.Blake2B #Core.M256 blake2b_init blake2b_update blake2b_finish
let load_state256b_from_state32: Core.load_state_st Spec.Blake2B Core.M256 =
Core.load_state_from_state32 #Spec.Blake2B #Core.M256
let store_state256b_to_state32: Core.store_state_st Spec.Blake2B Core.M256 =
Core.store_state_to_state32 #Spec.Blake2B #Core.M256 | false | false | Hacl.Blake2b_256.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val blake2b_malloc:Impl.blake2_malloc_st Spec.Blake2B Core.M256 | [] | Hacl.Blake2b_256.blake2b_malloc | {
"file_name": "code/blake2/Hacl.Blake2b_256.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Blake2.Generic.blake2_malloc_st Spec.Blake2.Blake2B Hacl.Impl.Blake2.Core.M256 | {
"end_col": 43,
"end_line": 56,
"start_col": 2,
"start_line": 56
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it
*)
forall (p q:pure_post a). (forall (x:a). p x ==> q x) ==> (wp p ==> wp q) | let is_monotonic (#a: Type) (wp: pure_wp' a) = | false | null | false | forall (p: pure_post a) (q: pure_post a). (forall (x: a). p x ==> q x) ==> (wp p ==> wp q) | {
"checked_file": "FStar.Monotonic.Pure.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Monotonic.Pure.fst"
} | [
"total"
] | [
"Prims.pure_wp'",
"Prims.l_Forall",
"Prims.pure_post",
"Prims.l_imp",
"Prims.logical"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Monotonic.Pure
(*
* This module provides utilities to intro and elim the monotonicity
* property of pure wps
*
* Since pure_wp_monotonic predicate is marked opaque_to_smt in prims,
* reasoning with it requires explicit coercions
*)
unfold
let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it | false | false | FStar.Monotonic.Pure.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val is_monotonic : wp: Prims.pure_wp' a -> Prims.logical | [] | FStar.Monotonic.Pure.is_monotonic | {
"file_name": "ulib/FStar.Monotonic.Pure.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | wp: Prims.pure_wp' a -> Prims.logical | {
"end_col": 75,
"end_line": 34,
"start_col": 2,
"start_line": 34
} |
|
FStar.Pervasives.Lemma | val intro_pure_wp_monotonicity (#a: Type) (wp: pure_wp' a)
: Lemma (requires is_monotonic wp) (ensures pure_wp_monotonic a wp) | [
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let intro_pure_wp_monotonicity (#a:Type) (wp:pure_wp' a)
: Lemma
(requires is_monotonic wp)
(ensures pure_wp_monotonic a wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic | val intro_pure_wp_monotonicity (#a: Type) (wp: pure_wp' a)
: Lemma (requires is_monotonic wp) (ensures pure_wp_monotonic a wp)
let intro_pure_wp_monotonicity (#a: Type) (wp: pure_wp' a)
: Lemma (requires is_monotonic wp) (ensures pure_wp_monotonic a wp) = | false | null | true | reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic | {
"checked_file": "FStar.Monotonic.Pure.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Monotonic.Pure.fst"
} | [
"lemma"
] | [
"Prims.pure_wp'",
"FStar.Pervasives.reveal_opaque",
"Prims.logical",
"Prims.pure_wp_monotonic",
"Prims.unit",
"FStar.Monotonic.Pure.is_monotonic",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Monotonic.Pure
(*
* This module provides utilities to intro and elim the monotonicity
* property of pure wps
*
* Since pure_wp_monotonic predicate is marked opaque_to_smt in prims,
* reasoning with it requires explicit coercions
*)
unfold
let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it
*)
forall (p q:pure_post a). (forall (x:a). p x ==> q x) ==> (wp p ==> wp q)
let elim_pure_wp_monotonicity (#a:Type) (wp:pure_wp a)
: Lemma (is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let elim_pure_wp_monotonicity_forall (_:unit)
: Lemma
(forall (a:Type) (wp:pure_wp a). is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let intro_pure_wp_monotonicity (#a:Type) (wp:pure_wp' a)
: Lemma
(requires is_monotonic wp) | false | false | FStar.Monotonic.Pure.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val intro_pure_wp_monotonicity (#a: Type) (wp: pure_wp' a)
: Lemma (requires is_monotonic wp) (ensures pure_wp_monotonic a wp) | [] | FStar.Monotonic.Pure.intro_pure_wp_monotonicity | {
"file_name": "ulib/FStar.Monotonic.Pure.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | wp: Prims.pure_wp' a
-> FStar.Pervasives.Lemma (requires FStar.Monotonic.Pure.is_monotonic wp)
(ensures Prims.pure_wp_monotonic a wp) | {
"end_col": 57,
"end_line": 49,
"start_col": 4,
"start_line": 49
} |
Prims.Pure | val elim_pure (#a: Type) (#wp: pure_wp a) ($f: (unit -> PURE a wp)) (p: pure_post a)
: Pure a (requires (wp p)) (ensures (fun r -> p r)) | [
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_pure (#a:Type) (#wp:pure_wp a) ($f : unit -> PURE a wp) (p:pure_post a)
: Pure a (requires (wp p)) (ensures (fun r -> p r))
= elim_pure_wp_monotonicity wp;
f () | val elim_pure (#a: Type) (#wp: pure_wp a) ($f: (unit -> PURE a wp)) (p: pure_post a)
: Pure a (requires (wp p)) (ensures (fun r -> p r))
let elim_pure (#a: Type) (#wp: pure_wp a) ($f: (unit -> PURE a wp)) (p: pure_post a)
: Pure a (requires (wp p)) (ensures (fun r -> p r)) = | false | null | false | elim_pure_wp_monotonicity wp;
f () | {
"checked_file": "FStar.Monotonic.Pure.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Monotonic.Pure.fst"
} | [] | [
"Prims.pure_wp",
"Prims.unit",
"Prims.pure_post",
"FStar.Monotonic.Pure.elim_pure_wp_monotonicity"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Monotonic.Pure
(*
* This module provides utilities to intro and elim the monotonicity
* property of pure wps
*
* Since pure_wp_monotonic predicate is marked opaque_to_smt in prims,
* reasoning with it requires explicit coercions
*)
unfold
let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it
*)
forall (p q:pure_post a). (forall (x:a). p x ==> q x) ==> (wp p ==> wp q)
let elim_pure_wp_monotonicity (#a:Type) (wp:pure_wp a)
: Lemma (is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let elim_pure_wp_monotonicity_forall (_:unit)
: Lemma
(forall (a:Type) (wp:pure_wp a). is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let intro_pure_wp_monotonicity (#a:Type) (wp:pure_wp' a)
: Lemma
(requires is_monotonic wp)
(ensures pure_wp_monotonic a wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
unfold
let as_pure_wp (#a:Type) (wp:pure_wp' a)
: Pure (pure_wp a)
(requires is_monotonic wp)
(ensures fun r -> r == wp)
= intro_pure_wp_monotonicity wp;
wp
let elim_pure (#a:Type) (#wp:pure_wp a) ($f : unit -> PURE a wp) (p:pure_post a) | false | false | FStar.Monotonic.Pure.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val elim_pure (#a: Type) (#wp: pure_wp a) ($f: (unit -> PURE a wp)) (p: pure_post a)
: Pure a (requires (wp p)) (ensures (fun r -> p r)) | [] | FStar.Monotonic.Pure.elim_pure | {
"file_name": "ulib/FStar.Monotonic.Pure.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | $f: (_: Prims.unit -> Prims.PURE a) -> p: Prims.pure_post a -> Prims.Pure a | {
"end_col": 8,
"end_line": 62,
"start_col": 4,
"start_line": 61
} |
FStar.Pervasives.Lemma | val elim_pure_wp_monotonicity_forall: unit
-> Lemma (forall (a: Type) (wp: pure_wp a). is_monotonic wp) | [
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_pure_wp_monotonicity_forall (_:unit)
: Lemma
(forall (a:Type) (wp:pure_wp a). is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic | val elim_pure_wp_monotonicity_forall: unit
-> Lemma (forall (a: Type) (wp: pure_wp a). is_monotonic wp)
let elim_pure_wp_monotonicity_forall (_: unit)
: Lemma (forall (a: Type) (wp: pure_wp a). is_monotonic wp) = | false | null | true | reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic | {
"checked_file": "FStar.Monotonic.Pure.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Monotonic.Pure.fst"
} | [
"lemma"
] | [
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Prims.pure_wp",
"FStar.Monotonic.Pure.is_monotonic",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Monotonic.Pure
(*
* This module provides utilities to intro and elim the monotonicity
* property of pure wps
*
* Since pure_wp_monotonic predicate is marked opaque_to_smt in prims,
* reasoning with it requires explicit coercions
*)
unfold
let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it
*)
forall (p q:pure_post a). (forall (x:a). p x ==> q x) ==> (wp p ==> wp q)
let elim_pure_wp_monotonicity (#a:Type) (wp:pure_wp a)
: Lemma (is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let elim_pure_wp_monotonicity_forall (_:unit)
: Lemma | false | false | FStar.Monotonic.Pure.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val elim_pure_wp_monotonicity_forall: unit
-> Lemma (forall (a: Type) (wp: pure_wp a). is_monotonic wp) | [] | FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall | {
"file_name": "ulib/FStar.Monotonic.Pure.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit
-> FStar.Pervasives.Lemma
(ensures forall (a: Type) (wp: Prims.pure_wp a). FStar.Monotonic.Pure.is_monotonic wp) | {
"end_col": 57,
"end_line": 43,
"start_col": 4,
"start_line": 43
} |
Prims.Pure | val as_pure_wp (#a: Type) (wp: pure_wp' a)
: Pure (pure_wp a) (requires is_monotonic wp) (ensures fun r -> r == wp) | [
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_pure_wp (#a:Type) (wp:pure_wp' a)
: Pure (pure_wp a)
(requires is_monotonic wp)
(ensures fun r -> r == wp)
= intro_pure_wp_monotonicity wp;
wp | val as_pure_wp (#a: Type) (wp: pure_wp' a)
: Pure (pure_wp a) (requires is_monotonic wp) (ensures fun r -> r == wp)
let as_pure_wp (#a: Type) (wp: pure_wp' a)
: Pure (pure_wp a) (requires is_monotonic wp) (ensures fun r -> r == wp) = | false | null | false | intro_pure_wp_monotonicity wp;
wp | {
"checked_file": "FStar.Monotonic.Pure.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Monotonic.Pure.fst"
} | [] | [
"Prims.pure_wp'",
"Prims.unit",
"FStar.Monotonic.Pure.intro_pure_wp_monotonicity",
"Prims.pure_wp",
"FStar.Monotonic.Pure.is_monotonic",
"Prims.eq2"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Monotonic.Pure
(*
* This module provides utilities to intro and elim the monotonicity
* property of pure wps
*
* Since pure_wp_monotonic predicate is marked opaque_to_smt in prims,
* reasoning with it requires explicit coercions
*)
unfold
let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it
*)
forall (p q:pure_post a). (forall (x:a). p x ==> q x) ==> (wp p ==> wp q)
let elim_pure_wp_monotonicity (#a:Type) (wp:pure_wp a)
: Lemma (is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let elim_pure_wp_monotonicity_forall (_:unit)
: Lemma
(forall (a:Type) (wp:pure_wp a). is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
let intro_pure_wp_monotonicity (#a:Type) (wp:pure_wp' a)
: Lemma
(requires is_monotonic wp)
(ensures pure_wp_monotonic a wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic
unfold
let as_pure_wp (#a:Type) (wp:pure_wp' a)
: Pure (pure_wp a)
(requires is_monotonic wp) | false | false | FStar.Monotonic.Pure.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_pure_wp (#a: Type) (wp: pure_wp' a)
: Pure (pure_wp a) (requires is_monotonic wp) (ensures fun r -> r == wp) | [] | FStar.Monotonic.Pure.as_pure_wp | {
"file_name": "ulib/FStar.Monotonic.Pure.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | wp: Prims.pure_wp' a -> Prims.Pure (Prims.pure_wp a) | {
"end_col": 6,
"end_line": 57,
"start_col": 4,
"start_line": 56
} |
FStar.Pervasives.Lemma | val elim_pure_wp_monotonicity (#a: Type) (wp: pure_wp a) : Lemma (is_monotonic wp) | [
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Monotonic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_pure_wp_monotonicity (#a:Type) (wp:pure_wp a)
: Lemma (is_monotonic wp)
= reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic | val elim_pure_wp_monotonicity (#a: Type) (wp: pure_wp a) : Lemma (is_monotonic wp)
let elim_pure_wp_monotonicity (#a: Type) (wp: pure_wp a) : Lemma (is_monotonic wp) = | false | null | true | reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic | {
"checked_file": "FStar.Monotonic.Pure.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Monotonic.Pure.fst"
} | [
"lemma"
] | [
"Prims.pure_wp",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"FStar.Monotonic.Pure.is_monotonic",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2019 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Monotonic.Pure
(*
* This module provides utilities to intro and elim the monotonicity
* property of pure wps
*
* Since pure_wp_monotonic predicate is marked opaque_to_smt in prims,
* reasoning with it requires explicit coercions
*)
unfold
let is_monotonic (#a:Type) (wp:pure_wp' a) =
(*
* Once we support using tactics in ulib/,
* this would be written as: Prims.pure_wp_monotonic0,
* with a postprocessing tactic to norm it
*)
forall (p q:pure_post a). (forall (x:a). p x ==> q x) ==> (wp p ==> wp q)
let elim_pure_wp_monotonicity (#a:Type) (wp:pure_wp a) | false | false | FStar.Monotonic.Pure.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val elim_pure_wp_monotonicity (#a: Type) (wp: pure_wp a) : Lemma (is_monotonic wp) | [] | FStar.Monotonic.Pure.elim_pure_wp_monotonicity | {
"file_name": "ulib/FStar.Monotonic.Pure.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | wp: Prims.pure_wp a -> FStar.Pervasives.Lemma (ensures FStar.Monotonic.Pure.is_monotonic wp) | {
"end_col": 57,
"end_line": 38,
"start_col": 4,
"start_line": 38
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs | let is_map_of (m: regmap) (rs: reg_taint) = | false | null | false | FStar.FunctionalExtensionality.feq (map_to_regs m) rs | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.regmap",
"Vale.X64.Leakage_s.reg_taint",
"FStar.FunctionalExtensionality.feq",
"Vale.X64.Machine_s.reg",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_Helpers.map_to_regs",
"Prims.logical"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val is_map_of : m: Vale.X64.Leakage_Helpers.regmap -> rs: Vale.X64.Leakage_s.reg_taint -> Prims.logical | [] | Vale.X64.Leakage_Helpers.is_map_of | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.X64.Leakage_Helpers.regmap -> rs: Vale.X64.Leakage_s.reg_taint -> Prims.logical | {
"end_col": 55,
"end_line": 20,
"start_col": 2,
"start_line": 20
} |
|
Prims.Tot | val merge_taint (t1 t2: taint) : taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public | val merge_taint (t1 t2: taint) : taint
let merge_taint (t1 t2: taint) : taint = | false | null | false | if Secret? t1 || Secret? t2 then Secret else Public | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.taint",
"Prims.op_BarBar",
"Vale.Arch.HeapTypes_s.uu___is_Secret",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.bool",
"Vale.Arch.HeapTypes_s.Public"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val merge_taint (t1 t2: taint) : taint | [] | Vale.X64.Leakage_Helpers.merge_taint | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t1: Vale.Arch.HeapTypes_s.taint -> t2: Vale.Arch.HeapTypes_s.taint -> Vale.Arch.HeapTypes_s.taint | {
"end_col": 13,
"end_line": 44,
"start_col": 2,
"start_line": 43
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts) | let ins_consumes_fixed_time (ins: ins) (ts: analysis_taints) (res: bool & analysis_taints) = | false | null | false | let b, ts' = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.ins",
"Vale.X64.Leakage_Helpers.analysis_taints",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"Prims.l_imp",
"Prims.b2t",
"Vale.X64.Leakage_s.isConstantTime",
"Vale.X64.Machine_s.Ins",
"Vale.X64.Bytes_Code_s.instruction_t",
"Vale.X64.Machine_Semantics_s.instr_annotation",
"Vale.X64.Bytes_Code_s.ocmp",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__lts",
"Prims.logical"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val ins_consumes_fixed_time : ins: Vale.X64.Machine_Semantics_s.ins ->
ts: Vale.X64.Leakage_Helpers.analysis_taints ->
res: (Prims.bool * Vale.X64.Leakage_Helpers.analysis_taints)
-> Prims.logical | [] | Vale.X64.Leakage_Helpers.ins_consumes_fixed_time | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ins: Vale.X64.Machine_Semantics_s.ins ->
ts: Vale.X64.Leakage_Helpers.analysis_taints ->
res: (Prims.bool * Vale.X64.Leakage_Helpers.analysis_taints)
-> Prims.logical | {
"end_col": 45,
"end_line": 155,
"start_col": 89,
"start_line": 153
} |
|
Prims.Tot | val publicCfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret) | val publicCfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool
let publicCfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool = | false | null | false | (tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) ||
(tsExpected.lts.cfFlagsTaint = Secret) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.op_BarBar",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__cfFlagsTaint",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__lts",
"Vale.Arch.HeapTypes_s.Public",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicCfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.publicCfFlagValuesAreAsExpected | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints
-> Prims.bool | {
"end_col": 122,
"end_line": 163,
"start_col": 2,
"start_line": 163
} |
Prims.Tot | val publicTaintsAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let publicTaintsAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
publicFlagValuesAreAsExpected tsAnalysis tsExpected &&
publicCfFlagValuesAreAsExpected tsAnalysis tsExpected &&
publicOfFlagValuesAreAsExpected tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected tsAnalysis tsExpected | val publicTaintsAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool
let publicTaintsAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool = | false | null | false | publicFlagValuesAreAsExpected tsAnalysis tsExpected &&
publicCfFlagValuesAreAsExpected tsAnalysis tsExpected &&
publicOfFlagValuesAreAsExpected tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected tsAnalysis tsExpected | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.op_AmpAmp",
"Vale.X64.Leakage_Helpers.publicFlagValuesAreAsExpected",
"Vale.X64.Leakage_Helpers.publicCfFlagValuesAreAsExpected",
"Vale.X64.Leakage_Helpers.publicOfFlagValuesAreAsExpected",
"Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret)
let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret)
let publicOfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) || (tsExpected.lts.ofFlagsTaint = Secret)
let registerAsExpected (r:reg) (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(sel tsExpected.rts r = Public && sel tsAnalysis.rts r = Public) || (sel tsExpected.rts r = Secret)
let rec publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (rf:reg_file_id) (k:nat{k <= n_regs rf})
: bool =
if k = 0 then true
else
registerAsExpected (Reg rf (k - 1)) tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected rf (k - 1)
let rec publicRegisterValuesAreAsExpected_regs
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (k:nat{k <= n_reg_files})
: bool =
if k = 0 then true
else
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected (k - 1) (n_regs (k - 1)) &&
publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected (k - 1)
let publicRegisterValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected n_reg_files
// REVIEW: move to specs directory? | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicTaintsAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.publicTaintsAreAsExpected | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints
-> Prims.bool | {
"end_col": 57,
"end_line": 195,
"start_col": 2,
"start_line": 192
} |
Prims.Tot | val publicFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret) | val publicFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool
let publicFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool = | false | null | false | (tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) ||
(tsExpected.lts.flagsTaint = Secret) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.op_BarBar",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__flagsTaint",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__lts",
"Vale.Arch.HeapTypes_s.Public",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20" | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.publicFlagValuesAreAsExpected | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints
-> Prims.bool | {
"end_col": 116,
"end_line": 160,
"start_col": 2,
"start_line": 160
} |
Prims.Tot | val publicOfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let publicOfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) || (tsExpected.lts.ofFlagsTaint = Secret) | val publicOfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool
let publicOfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool = | false | null | false | (tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) ||
(tsExpected.lts.ofFlagsTaint = Secret) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.op_BarBar",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__ofFlagsTaint",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__lts",
"Vale.Arch.HeapTypes_s.Public",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret)
let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicOfFlagValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.publicOfFlagValuesAreAsExpected | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints
-> Prims.bool | {
"end_col": 122,
"end_line": 166,
"start_col": 2,
"start_line": 166
} |
Prims.Tot | val map_to_regs (m: regmap) : reg_taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m) | val map_to_regs (m: regmap) : reg_taint
let map_to_regs (m: regmap) : reg_taint = | false | null | false | FunctionalExtensionality.on reg (sel m) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.regmap",
"FStar.FunctionalExtensionality.on",
"Vale.X64.Machine_s.reg",
"Vale.Arch.HeapTypes_s.taint",
"Vale.Lib.MapTree.sel",
"Vale.X64.Leakage_s.reg_taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val map_to_regs (m: regmap) : reg_taint | [] | Vale.X64.Leakage_Helpers.map_to_regs | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | m: Vale.X64.Leakage_Helpers.regmap -> Vale.X64.Leakage_s.reg_taint | {
"end_col": 41,
"end_line": 17,
"start_col": 2,
"start_line": 17
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let regmap = map reg taint | let regmap = | false | null | false | map reg taint | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.Lib.MapTree.map",
"Vale.X64.Machine_s.reg",
"Vale.Arch.HeapTypes_s.taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val regmap : Type0 | [] | Vale.X64.Leakage_Helpers.regmap | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 26,
"end_line": 9,
"start_col": 13,
"start_line": 9
} |
|
Prims.Tot | val registerAsExpected (r: reg) (tsAnalysis tsExpected: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let registerAsExpected (r:reg) (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(sel tsExpected.rts r = Public && sel tsAnalysis.rts r = Public) || (sel tsExpected.rts r = Secret) | val registerAsExpected (r: reg) (tsAnalysis tsExpected: analysis_taints) : bool
let registerAsExpected (r: reg) (tsAnalysis tsExpected: analysis_taints) : bool = | false | null | false | (sel tsExpected.rts r = Public && sel tsAnalysis.rts r = Public) || (sel tsExpected.rts r = Secret) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.op_BarBar",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.taint",
"Vale.Lib.MapTree.sel",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__rts",
"Vale.Arch.HeapTypes_s.Public",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret)
let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret)
let publicOfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) || (tsExpected.lts.ofFlagsTaint = Secret) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val registerAsExpected (r: reg) (tsAnalysis tsExpected: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.registerAsExpected | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r: Vale.X64.Machine_s.reg ->
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints
-> Prims.bool | {
"end_col": 101,
"end_line": 169,
"start_col": 2,
"start_line": 169
} |
Prims.Tot | val regs_to_map (rs: reg_taint) : (m: regmap{is_map_of m rs}) | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0 | val regs_to_map (rs: reg_taint) : (m: regmap{is_map_of m rs})
let regs_to_map (rs: reg_taint) : (m: regmap{is_map_of m rs}) = | false | null | false | regs_to_map_rec rs n_reg_files 0 | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.reg_taint",
"Vale.X64.Leakage_Helpers.regs_to_map_rec",
"Vale.X64.Machine_s.n_reg_files",
"Vale.X64.Leakage_Helpers.regmap",
"Vale.X64.Leakage_Helpers.is_map_of"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val regs_to_map (rs: reg_taint) : (m: regmap{is_map_of m rs}) | [] | Vale.X64.Leakage_Helpers.regs_to_map | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | rs: Vale.X64.Leakage_s.reg_taint
-> m: Vale.X64.Leakage_Helpers.regmap{Vale.X64.Leakage_Helpers.is_map_of m rs} | {
"end_col": 34,
"end_line": 37,
"start_col": 2,
"start_line": 37
} |
Prims.Tot | val reg_le (r1 r2: reg) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2) | val reg_le (r1 r2: reg) : bool
let reg_le (r1 r2: reg) : bool = | false | null | false | let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg",
"Vale.X64.Machine_s.reg_file_id",
"Vale.X64.Machine_s.reg_id",
"Prims.op_BarBar",
"Prims.op_LessThan",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.op_LessThanOrEqual",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val reg_le (r1 r2: reg) : bool | [] | Vale.X64.Leakage_Helpers.reg_le | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | r1: Vale.X64.Machine_s.reg -> r2: Vale.X64.Machine_s.reg -> Prims.bool | {
"end_col": 34,
"end_line": 14,
"start_col": 31,
"start_line": 11
} |
Prims.Tot | val publicRegisterValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let publicRegisterValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected n_reg_files | val publicRegisterValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool
let publicRegisterValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool = | false | null | false | publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected n_reg_files | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected_regs",
"Vale.X64.Machine_s.n_reg_files",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret)
let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret)
let publicOfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) || (tsExpected.lts.ofFlagsTaint = Secret)
let registerAsExpected (r:reg) (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(sel tsExpected.rts r = Public && sel tsAnalysis.rts r = Public) || (sel tsExpected.rts r = Secret)
let rec publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (rf:reg_file_id) (k:nat{k <= n_regs rf})
: bool =
if k = 0 then true
else
registerAsExpected (Reg rf (k - 1)) tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected rf (k - 1)
let rec publicRegisterValuesAreAsExpected_regs
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (k:nat{k <= n_reg_files})
: bool =
if k = 0 then true
else
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected (k - 1) (n_regs (k - 1)) &&
publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected (k - 1) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicRegisterValuesAreAsExpected (tsAnalysis tsExpected: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints
-> Prims.bool | {
"end_col": 74,
"end_line": 188,
"start_col": 2,
"start_line": 188
} |
Prims.Tot | val set_taint_of_and_flags (ts: analysis_taints) (t: taint) : analysis_taints | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts | val set_taint_of_and_flags (ts: analysis_taints) (t: taint) : analysis_taints
let set_taint_of_and_flags (ts: analysis_taints) (t: taint) : analysis_taints = | false | null | false | let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.reg_taint",
"Vale.X64.Leakage_Helpers.regmap",
"Vale.X64.Leakage_Helpers.is_map_of",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__regTaint",
"Vale.X64.Leakage_s.LeakageTaints",
"Vale.X64.Leakage_Helpers.AnalysisTaints",
"Vale.X64.Leakage_Helpers.merge_taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val set_taint_of_and_flags (ts: analysis_taints) (t: taint) : analysis_taints | [] | Vale.X64.Leakage_Helpers.set_taint_of_and_flags | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ts: Vale.X64.Leakage_Helpers.analysis_taints -> t: Vale.Arch.HeapTypes_s.taint
-> Vale.X64.Leakage_Helpers.analysis_taints | {
"end_col": 66,
"end_line": 151,
"start_col": 77,
"start_line": 149
} |
Prims.Tot | val set_taint_cf_and_flags (ts: analysis_taints) (t: taint) : analysis_taints | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts | val set_taint_cf_and_flags (ts: analysis_taints) (t: taint) : analysis_taints
let set_taint_cf_and_flags (ts: analysis_taints) (t: taint) : analysis_taints = | false | null | false | let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.reg_taint",
"Vale.X64.Leakage_Helpers.regmap",
"Vale.X64.Leakage_Helpers.is_map_of",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__regTaint",
"Vale.X64.Leakage_s.LeakageTaints",
"Vale.X64.Leakage_Helpers.AnalysisTaints",
"Vale.X64.Leakage_Helpers.merge_taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val set_taint_cf_and_flags (ts: analysis_taints) (t: taint) : analysis_taints | [] | Vale.X64.Leakage_Helpers.set_taint_cf_and_flags | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ts: Vale.X64.Leakage_Helpers.analysis_taints -> t: Vale.Arch.HeapTypes_s.taint
-> Vale.X64.Leakage_Helpers.analysis_taints | {
"end_col": 67,
"end_line": 147,
"start_col": 77,
"start_line": 145
} |
Prims.Tot | val publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis tsExpected: analysis_taints)
(rf: reg_file_id)
(k: nat{k <= n_regs rf})
: bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (rf:reg_file_id) (k:nat{k <= n_regs rf})
: bool =
if k = 0 then true
else
registerAsExpected (Reg rf (k - 1)) tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected rf (k - 1) | val publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis tsExpected: analysis_taints)
(rf: reg_file_id)
(k: nat{k <= n_regs rf})
: bool
let rec publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis tsExpected: analysis_taints)
(rf: reg_file_id)
(k: nat{k <= n_regs rf})
: bool = | false | null | false | if k = 0
then true
else
registerAsExpected (Reg rf (k - 1)) tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected rf (k - 1) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Machine_s.reg_file_id",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Vale.X64.Machine_s.n_regs",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Prims.op_AmpAmp",
"Vale.X64.Leakage_Helpers.registerAsExpected",
"Vale.X64.Machine_s.Reg",
"Prims.op_Subtraction",
"Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected_reg_file"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret)
let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret)
let publicOfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) || (tsExpected.lts.ofFlagsTaint = Secret)
let registerAsExpected (r:reg) (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(sel tsExpected.rts r = Public && sel tsAnalysis.rts r = Public) || (sel tsExpected.rts r = Secret)
let rec publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (rf:reg_file_id) (k:nat{k <= n_regs rf}) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis tsExpected: analysis_taints)
(rf: reg_file_id)
(k: nat{k <= n_regs rf})
: bool | [
"recursion"
] | Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected_reg_file | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints ->
rf: Vale.X64.Machine_s.reg_file_id ->
k: Prims.nat{k <= Vale.X64.Machine_s.n_regs rf}
-> Prims.bool | {
"end_col": 79,
"end_line": 177,
"start_col": 2,
"start_line": 174
} |
Prims.Tot | val publicRegisterValuesAreAsExpected_regs
(tsAnalysis tsExpected: analysis_taints)
(k: nat{k <= n_reg_files})
: bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec publicRegisterValuesAreAsExpected_regs
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (k:nat{k <= n_reg_files})
: bool =
if k = 0 then true
else
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected (k - 1) (n_regs (k - 1)) &&
publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected (k - 1) | val publicRegisterValuesAreAsExpected_regs
(tsAnalysis tsExpected: analysis_taints)
(k: nat{k <= n_reg_files})
: bool
let rec publicRegisterValuesAreAsExpected_regs
(tsAnalysis tsExpected: analysis_taints)
(k: nat{k <= n_reg_files})
: bool = | false | null | false | if k = 0
then true
else
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected (k - 1) (n_regs (k - 1)) &&
publicRegisterValuesAreAsExpected_regs tsAnalysis tsExpected (k - 1) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Vale.X64.Machine_s.n_reg_files",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Prims.op_AmpAmp",
"Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected_reg_file",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.n_regs",
"Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected_regs"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public
let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts // Ensured by taint semantics
let set_taint_cf_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) t ovf) rts
let set_taint_of_and_flags (ts:analysis_taints) (t:taint) : analysis_taints =
let AnalysisTaints (LeakageTaints rs flags cf ovf) rts = ts in
AnalysisTaints (LeakageTaints rs (merge_taint t flags) cf t) rts
let ins_consumes_fixed_time (ins:ins) (ts:analysis_taints) (res:bool & analysis_taints) =
let (b, ts') = res in
(b2t b ==> isConstantTime (Ins ins) ts.lts)
#set-options "--z3rlimit 20"
let publicFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.flagsTaint = Public && tsAnalysis.lts.flagsTaint = Public) || (tsExpected.lts.flagsTaint = Secret)
let publicCfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.cfFlagsTaint = Public && tsAnalysis.lts.cfFlagsTaint = Public) || (tsExpected.lts.cfFlagsTaint = Secret)
let publicOfFlagValuesAreAsExpected (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(tsExpected.lts.ofFlagsTaint = Public && tsAnalysis.lts.ofFlagsTaint = Public) || (tsExpected.lts.ofFlagsTaint = Secret)
let registerAsExpected (r:reg) (tsAnalysis:analysis_taints) (tsExpected:analysis_taints) : bool =
(sel tsExpected.rts r = Public && sel tsAnalysis.rts r = Public) || (sel tsExpected.rts r = Secret)
let rec publicRegisterValuesAreAsExpected_reg_file
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (rf:reg_file_id) (k:nat{k <= n_regs rf})
: bool =
if k = 0 then true
else
registerAsExpected (Reg rf (k - 1)) tsAnalysis tsExpected &&
publicRegisterValuesAreAsExpected_reg_file tsAnalysis tsExpected rf (k - 1)
let rec publicRegisterValuesAreAsExpected_regs
(tsAnalysis:analysis_taints) (tsExpected:analysis_taints) (k:nat{k <= n_reg_files}) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val publicRegisterValuesAreAsExpected_regs
(tsAnalysis tsExpected: analysis_taints)
(k: nat{k <= n_reg_files})
: bool | [
"recursion"
] | Vale.X64.Leakage_Helpers.publicRegisterValuesAreAsExpected_regs | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
tsAnalysis: Vale.X64.Leakage_Helpers.analysis_taints ->
tsExpected: Vale.X64.Leakage_Helpers.analysis_taints ->
k: Prims.nat{k <= Vale.X64.Machine_s.n_reg_files}
-> Prims.bool | {
"end_col": 72,
"end_line": 185,
"start_col": 2,
"start_line": 182
} |
Prims.Tot | val operand_does_not_use_secrets (#tc #tr: eqtype) (o: operand tc tr) (ts: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts | val operand_does_not_use_secrets (#tc #tr: eqtype) (o: operand tc tr) (ts: analysis_taints) : bool
let operand_does_not_use_secrets (#tc #tr: eqtype) (o: operand tc tr) (ts: analysis_taints) : bool = | false | null | false | match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Prims.eqtype",
"Vale.X64.Machine_s.operand",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Machine_s.maddr",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_Helpers.maddr_does_not_use_secrets",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val operand_does_not_use_secrets (#tc #tr: eqtype) (o: operand tc tr) (ts: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.operand_does_not_use_secrets | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | o: Vale.X64.Machine_s.operand tc tr -> ts: Vale.X64.Leakage_Helpers.analysis_taints -> Prims.bool | {
"end_col": 66,
"end_line": 129,
"start_col": 2,
"start_line": 127
} |
Prims.Tot | val maddr_does_not_use_secrets (addr: maddr) (ts: analysis_taints) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint) | val maddr_does_not_use_secrets (addr: maddr) (ts: analysis_taints) : bool
let maddr_does_not_use_secrets (addr: maddr) (ts: analysis_taints) : bool = | false | null | false | match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.maddr",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Prims.int",
"Vale.X64.Machine_s.reg",
"Vale.Arch.HeapTypes_s.uu___is_Public",
"Vale.Lib.MapTree.sel",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__rts",
"Prims.op_AmpAmp",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val maddr_does_not_use_secrets (addr: maddr) (ts: analysis_taints) : bool | [] | Vale.X64.Leakage_Helpers.maddr_does_not_use_secrets | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | addr: Vale.X64.Machine_s.maddr -> ts: Vale.X64.Leakage_Helpers.analysis_taints -> Prims.bool | {
"end_col": 49,
"end_line": 124,
"start_col": 2,
"start_line": 118
} |
Prims.Tot | val operand_taint_allowed (#tc #tr: eqtype) (o: operand tc tr) (t_data: taint) : bool | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public | val operand_taint_allowed (#tc #tr: eqtype) (o: operand tc tr) (t_data: taint) : bool
let operand_taint_allowed (#tc #tr: eqtype) (o: operand tc tr) (t_data: taint) : bool = | false | null | false | match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Prims.eqtype",
"Vale.X64.Machine_s.operand",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Machine_s.maddr",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.Arch.HeapTypes_s.Public",
"Prims.bool"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val operand_taint_allowed (#tc #tr: eqtype) (o: operand tc tr) (t_data: taint) : bool | [] | Vale.X64.Leakage_Helpers.operand_taint_allowed | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | o: Vale.X64.Machine_s.operand tc tr -> t_data: Vale.Arch.HeapTypes_s.taint -> Prims.bool | {
"end_col": 88,
"end_line": 134,
"start_col": 2,
"start_line": 132
} |
Prims.Tot | val args_taint (args: list instr_operand) (oprs: instr_operands_t_args args) (ts: analysis_taints)
: taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts) | val args_taint (args: list instr_operand) (oprs: instr_operands_t_args args) (ts: analysis_taints)
: taint
let rec args_taint
(args: list instr_operand)
(oprs: instr_operands_t_args args)
(ts: analysis_taints)
: taint = | false | null | false | match args with
| [] -> Public
| i :: args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in
merge_taint (operand_taint_explicit i (fst oprs) ts) (args_taint args (snd oprs) ts)
| IOpIm i -> merge_taint (operand_taint_implicit i ts) (args_taint args (coerce oprs) ts) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Prims.list",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.instr_operands_t_args",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Instruction_s.instr_operand_explicit",
"Vale.X64.Leakage_Helpers.merge_taint",
"Vale.X64.Leakage_Helpers.operand_taint_explicit",
"FStar.Pervasives.Native.fst",
"Vale.X64.Instruction_s.instr_operand_t",
"Vale.X64.Leakage_Helpers.args_taint",
"FStar.Pervasives.Native.snd",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.Instruction_s.coerce",
"Vale.X64.Instruction_s.instr_operand_implicit",
"Vale.X64.Leakage_Helpers.operand_taint_implicit",
"Vale.Arch.HeapTypes_s.taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val args_taint (args: list instr_operand) (oprs: instr_operands_t_args args) (ts: analysis_taints)
: taint | [
"recursion"
] | Vale.X64.Leakage_Helpers.args_taint | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
args: Prims.list Vale.X64.Instruction_s.instr_operand ->
oprs: Vale.X64.Instruction_s.instr_operands_t_args args ->
ts: Vale.X64.Leakage_Helpers.analysis_taints
-> Vale.Arch.HeapTypes_s.taint | {
"end_col": 40,
"end_line": 91,
"start_col": 2,
"start_line": 80
} |
Prims.Tot | val operand_taint_explicit (i: instr_operand_explicit) (o: instr_operand_t i) (ts: analysis_taints)
: taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts | val operand_taint_explicit (i: instr_operand_explicit) (o: instr_operand_t i) (ts: analysis_taints)
: taint
let operand_taint_explicit (i: instr_operand_explicit) (o: instr_operand_t i) (ts: analysis_taints)
: taint = | false | null | false | match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Instruction_s.instr_operand_explicit",
"Vale.X64.Instruction_s.instr_operand_t",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Leakage_Helpers.operand_taint",
"Vale.X64.Machine_s.operand64",
"Vale.X64.Machine_s.operand128",
"Vale.Arch.HeapTypes_s.taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val operand_taint_explicit (i: instr_operand_explicit) (o: instr_operand_t i) (ts: analysis_taints)
: taint | [] | Vale.X64.Leakage_Helpers.operand_taint_explicit | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
i: Vale.X64.Instruction_s.instr_operand_explicit ->
o: Vale.X64.Instruction_s.instr_operand_t i ->
ts: Vale.X64.Leakage_Helpers.analysis_taints
-> Vale.Arch.HeapTypes_s.taint | {
"end_col": 50,
"end_line": 61,
"start_col": 2,
"start_line": 59
} |
Prims.Tot | val operand_taint_implicit (i: instr_operand_implicit) (ts: analysis_taints) : taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint | val operand_taint_implicit (i: instr_operand_implicit) (ts: analysis_taints) : taint
let operand_taint_implicit (i: instr_operand_implicit) (ts: analysis_taints) : taint = | false | null | false | match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Instruction_s.instr_operand_implicit",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Machine_s.operand64",
"Vale.X64.Leakage_Helpers.operand_taint",
"Vale.X64.Machine_s.operand128",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__cfFlagsTaint",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__lts",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__ofFlagsTaint",
"Vale.Arch.HeapTypes_s.taint"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints) | false | true | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val operand_taint_implicit (i: instr_operand_implicit) (ts: analysis_taints) : taint | [] | Vale.X64.Leakage_Helpers.operand_taint_implicit | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | i: Vale.X64.Instruction_s.instr_operand_implicit -> ts: Vale.X64.Leakage_Helpers.analysis_taints
-> Vale.Arch.HeapTypes_s.taint | {
"end_col": 37,
"end_line": 72,
"start_col": 2,
"start_line": 68
} |
Prims.Tot | val operand_taint (rf: reg_file_id) (o: operand_rf rf) (ts: analysis_taints) : taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t | val operand_taint (rf: reg_file_id) (o: operand_rf rf) (ts: analysis_taints) : taint
let operand_taint (rf: reg_file_id) (o: operand_rf rf) (ts: analysis_taints) : taint = | false | null | false | match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg_file_id",
"Vale.X64.Machine_s.operand_rf",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Machine_s.t_reg_file",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Machine_s.reg_id",
"Vale.Lib.MapTree.sel",
"Vale.X64.Machine_s.reg",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_Helpers.__proj__AnalysisTaints__item__rts",
"Vale.X64.Machine_s.Reg",
"Vale.X64.Machine_s.maddr"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val operand_taint (rf: reg_file_id) (o: operand_rf rf) (ts: analysis_taints) : taint | [] | Vale.X64.Leakage_Helpers.operand_taint | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
rf: Vale.X64.Machine_s.reg_file_id ->
o: Vale.X64.Machine_s.operand_rf rf ->
ts: Vale.X64.Leakage_Helpers.analysis_taints
-> Vale.Arch.HeapTypes_s.taint | {
"end_col": 36,
"end_line": 51,
"start_col": 2,
"start_line": 48
} |
Prims.Tot | val set_taint (rf: reg_file_id) (dst: operand_rf rf) (ts: analysis_taints) (t: taint)
: analysis_taints | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let set_taint (rf:reg_file_id) (dst:operand_rf rf) (ts:analysis_taints) (t:taint) : analysis_taints =
match dst with
| OConst _ -> ts // Shouldn't actually happen
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts | val set_taint (rf: reg_file_id) (dst: operand_rf rf) (ts: analysis_taints) (t: taint)
: analysis_taints
let set_taint (rf: reg_file_id) (dst: operand_rf rf) (ts: analysis_taints) (t: taint)
: analysis_taints = | false | null | false | match dst with
| OConst _ -> ts
| OReg r ->
let AnalysisTaints (LeakageTaints rs f c o) rts = ts in
let rts = upd rts (Reg rf r) t in
AnalysisTaints (LeakageTaints (map_to_regs rts) f c o) rts
| OMem _ | OStack _ -> ts | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Vale.X64.Machine_s.reg_file_id",
"Vale.X64.Machine_s.operand_rf",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Machine_s.t_reg_file",
"Vale.X64.Machine_s.reg_id",
"Vale.X64.Leakage_s.reg_taint",
"Vale.X64.Leakage_Helpers.regmap",
"Vale.X64.Leakage_Helpers.is_map_of",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__regTaint",
"Vale.X64.Leakage_s.LeakageTaints",
"Vale.X64.Leakage_Helpers.AnalysisTaints",
"Vale.X64.Leakage_Helpers.map_to_regs",
"Vale.Lib.MapTree.map",
"Vale.X64.Machine_s.reg",
"Vale.Lib.MapTree.upd",
"Vale.X64.Machine_s.Reg",
"Vale.X64.Machine_s.tmaddr"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts)
let maddr_does_not_use_secrets (addr:maddr) (ts:analysis_taints) : bool =
match addr with
| MConst _ -> true
| MReg r _ -> Public? (sel ts.rts r)
| MIndex base _ index _ ->
let baseTaint = sel ts.rts base in
let indexTaint = sel ts.rts index in
(Public? baseTaint) && (Public? indexTaint)
let operand_does_not_use_secrets (#tc #tr:eqtype) (o:operand tc tr) (ts:analysis_taints) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (m, _) | OStack (m, _) -> maddr_does_not_use_secrets m ts
let operand_taint_allowed (#tc #tr:eqtype) (o:operand tc tr) (t_data:taint) : bool =
match o with
| OConst _ | OReg _ -> true
| OMem (_, t_operand) | OStack (_, t_operand) -> t_operand = Secret || t_data = Public | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val set_taint (rf: reg_file_id) (dst: operand_rf rf) (ts: analysis_taints) (t: taint)
: analysis_taints | [] | Vale.X64.Leakage_Helpers.set_taint | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
rf: Vale.X64.Machine_s.reg_file_id ->
dst: Vale.X64.Machine_s.operand_rf rf ->
ts: Vale.X64.Leakage_Helpers.analysis_taints ->
t: Vale.Arch.HeapTypes_s.taint
-> Vale.X64.Leakage_Helpers.analysis_taints | {
"end_col": 27,
"end_line": 143,
"start_col": 2,
"start_line": 137
} |
Prims.Tot | val inouts_taint
(inouts: list instr_out)
(args: list instr_operand)
(oprs: instr_operands_t inouts args)
(ts: analysis_taints)
: taint | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints)
: taint =
match inouts with
| [] -> args_taint args oprs ts
| (Out, i)::inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in inouts_taint inouts args oprs ts
| (InOut, i)::inouts ->
let (v, oprs) =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in merge_taint v (inouts_taint inouts args oprs ts) | val inouts_taint
(inouts: list instr_out)
(args: list instr_operand)
(oprs: instr_operands_t inouts args)
(ts: analysis_taints)
: taint
let rec inouts_taint
(inouts: list instr_out)
(args: list instr_operand)
(oprs: instr_operands_t inouts args)
(ts: analysis_taints)
: taint = | false | null | false | match inouts with
| [] -> args_taint args oprs ts
| (Out, i) :: inouts ->
let oprs =
match i with
| IOpEx i -> snd #(instr_operand_t i) (coerce oprs)
| IOpIm i -> coerce oprs
in
inouts_taint inouts args oprs ts
| (InOut, i) :: inouts ->
let v, oprs =
match i with
| IOpEx i ->
let oprs = coerce oprs in
((operand_taint_explicit i (fst oprs) ts), snd oprs)
| IOpIm i -> (operand_taint_implicit i ts, coerce oprs)
in
merge_taint v (inouts_taint inouts args oprs ts) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
"total"
] | [
"Prims.list",
"Vale.X64.Instruction_s.instr_out",
"Vale.X64.Instruction_s.instr_operand",
"Vale.X64.Instruction_s.instr_operands_t",
"Vale.X64.Leakage_Helpers.analysis_taints",
"Vale.X64.Leakage_Helpers.args_taint",
"Vale.X64.Leakage_Helpers.inouts_taint",
"Vale.X64.Instruction_s.instr_operand_explicit",
"FStar.Pervasives.Native.snd",
"Vale.X64.Instruction_s.instr_operand_t",
"Vale.X64.Instruction_s.coerce",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.Instruction_s.instr_operand_implicit",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_Helpers.merge_taint",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Leakage_Helpers.operand_taint_explicit",
"FStar.Pervasives.Native.fst",
"Vale.X64.Leakage_Helpers.operand_taint_implicit"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r)
let regs_to_map (rs:reg_taint) : (m:regmap{is_map_of m rs}) =
regs_to_map_rec rs n_reg_files 0
noeq type analysis_taints =
| AnalysisTaints: lts:leakage_taints -> rts:regmap{is_map_of rts lts.regTaint} -> analysis_taints
let merge_taint (t1:taint) (t2:taint) :taint =
if Secret? t1 || Secret? t2 then Secret
else Public
// Also pass the taint of the instruction
let operand_taint (rf:reg_file_id) (o:operand_rf rf) (ts:analysis_taints) : taint =
match o with
| OConst _ -> Public
| OReg r -> sel ts.rts (Reg rf r)
| OMem (_, t) | OStack (_, t) -> t
[@instr_attr]
let operand_taint_explicit
(i:instr_operand_explicit)
(o:instr_operand_t i)
(ts:analysis_taints)
: taint =
match i with
| IOp64 -> operand_taint 0 (o <: operand64) ts
| IOpXmm -> operand_taint 1 (o <: operand128) ts
[@instr_attr]
let operand_taint_implicit
(i:instr_operand_implicit)
(ts:analysis_taints)
: taint =
match i with
| IOp64One o -> operand_taint 0 o ts
| IOpXmmOne o -> operand_taint 1 o ts
| IOpFlagsCf -> ts.lts.cfFlagsTaint
| IOpFlagsOf -> ts.lts.ofFlagsTaint
[@instr_attr]
let rec args_taint
(args:list instr_operand)
(oprs:instr_operands_t_args args)
(ts:analysis_taints)
: taint =
match args with
| [] -> Public
| i::args ->
match i with
| IOpEx i ->
let oprs = coerce oprs in merge_taint
(operand_taint_explicit i (fst oprs) ts)
(args_taint args (snd oprs) ts)
| IOpIm i ->
merge_taint
(operand_taint_implicit i ts)
(args_taint args (coerce oprs) ts)
[@instr_attr]
let rec inouts_taint
(inouts:list instr_out)
(args:list instr_operand)
(oprs:instr_operands_t inouts args)
(ts:analysis_taints) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val inouts_taint
(inouts: list instr_out)
(args: list instr_operand)
(oprs: instr_operands_t inouts args)
(ts: analysis_taints)
: taint | [
"recursion"
] | Vale.X64.Leakage_Helpers.inouts_taint | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
inouts: Prims.list Vale.X64.Instruction_s.instr_out ->
args: Prims.list Vale.X64.Instruction_s.instr_operand ->
oprs: Vale.X64.Instruction_s.instr_operands_t inouts args ->
ts: Vale.X64.Leakage_Helpers.analysis_taints
-> Vale.Arch.HeapTypes_s.taint | {
"end_col": 55,
"end_line": 115,
"start_col": 2,
"start_line": 100
} |
Prims.Pure | val regs_to_map_rec (rs: reg_taint) (f n: nat)
: Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures
(fun m ->
forall (r: reg). {:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f;n]) | [
{
"abbrev": false,
"full_module": "Vale.Lib.MapTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Leakage_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n])
=
if n = 0 then
if f = 0 then const reg taint reg_le Secret
else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r) | val regs_to_map_rec (rs: reg_taint) (f n: nat)
: Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures
(fun m ->
forall (r: reg). {:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f;n])
let rec regs_to_map_rec (rs: reg_taint) (f n: nat)
: Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures
(fun m ->
forall (r: reg). {:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f;n]) = | false | null | false | if n = 0
then if f = 0 then const reg taint reg_le Secret else regs_to_map_rec rs (f - 1) (n_regs (f - 1))
else
let m = regs_to_map_rec rs f (n - 1) in
let r = Reg f (n - 1) in
upd m r (rs r) | {
"checked_file": "Vale.X64.Leakage_Helpers.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Leakage_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.Lib.MapTree.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_Helpers.fst"
} | [
""
] | [
"Vale.X64.Leakage_s.reg_taint",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Vale.Lib.MapTree.const",
"Vale.X64.Machine_s.reg",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_Helpers.reg_le",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.bool",
"Vale.X64.Leakage_Helpers.regs_to_map_rec",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.n_regs",
"Vale.X64.Leakage_Helpers.regmap",
"Vale.Lib.MapTree.upd",
"Vale.X64.Machine_s.Reg",
"Prims.l_or",
"Prims.l_and",
"Prims.eq2",
"Vale.X64.Machine_s.n_reg_files",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Prims.l_Forall",
"Prims.l_imp",
"Vale.X64.Machine_s.__proj__Reg__item__rf",
"Vale.X64.Machine_s.__proj__Reg__item__r",
"Vale.Lib.MapTree.sel"
] | [] | module Vale.X64.Leakage_Helpers
open FStar.Mul
open Vale.X64.Machine_Semantics_s
open Vale.X64.Machine_s
open Vale.X64.Leakage_s
open Vale.X64.Instruction_s
open Vale.Lib.MapTree
let regmap = map reg taint
let reg_le (r1 r2:reg) : bool =
let Reg f1 n1 = r1 in
let Reg f2 n2 = r2 in
f1 < f2 || (f1 = f2 && n1 <= n2)
let map_to_regs (m:regmap) : reg_taint =
FunctionalExtensionality.on reg (sel m)
let is_map_of (m:regmap) (rs:reg_taint) =
FStar.FunctionalExtensionality.feq (map_to_regs m) rs
let rec regs_to_map_rec (rs:reg_taint) (f n:nat) : Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures (fun m -> forall (r:reg).{:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f; n]) | false | false | Vale.X64.Leakage_Helpers.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val regs_to_map_rec (rs: reg_taint) (f n: nat)
: Pure regmap
(requires (f == n_reg_files /\ n == 0) \/ (f < n_reg_files /\ n <= n_regs f))
(ensures
(fun m ->
forall (r: reg). {:pattern sel m r}
r.rf < f \/ (r.rf == f /\ r.r < n) ==> sel m r == rs r))
(decreases %[f;n]) | [
"recursion"
] | Vale.X64.Leakage_Helpers.regs_to_map_rec | {
"file_name": "vale/code/arch/x64/Vale.X64.Leakage_Helpers.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | rs: Vale.X64.Leakage_s.reg_taint -> f: Prims.nat -> n: Prims.nat
-> Prims.Pure Vale.X64.Leakage_Helpers.regmap | {
"end_col": 18,
"end_line": 34,
"start_col": 2,
"start_line": 28
} |
Prims.Tot | val op_and_Question (x: option 'a) (y: option 'b) : option ('a * 'b) | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (and?) (x: option 'a) (y: option 'b): option ('a * 'b)
= match x, y with
| Some x, Some y -> Some (x, y)
| _ -> None | val op_and_Question (x: option 'a) (y: option 'b) : option ('a * 'b)
let op_and_Question (x: option 'a) (y: option 'b) : option ('a * 'b) = | false | null | false | match x, y with
| Some x, Some y -> Some (x, y)
| _ -> None | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.None"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool
inline_for_extraction
let isNone = function
| None -> true
| Some _ -> false
inline_for_extraction
val isSome: option 'a -> Tot bool
inline_for_extraction
let isSome = function
| Some _ -> true
| None -> false
inline_for_extraction
val map: ('a -> ML 'b) -> option 'a -> ML (option 'b)
inline_for_extraction
let map f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction
val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
inline_for_extraction
let mapTot f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction
val get: option 'a -> ML 'a
let get = function
| Some x -> x
| None -> failwith "empty option"
let (let?) (x: option 'a) (f: 'a -> option 'b): option 'b
= match x with
| Some x -> f x
| None -> None | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_and_Question (x: option 'a) (y: option 'b) : option ('a * 'b) | [] | FStar.Option.op_and_Question | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Pervasives.Native.option 'a -> y: FStar.Pervasives.Native.option 'b
-> FStar.Pervasives.Native.option ('a * 'b) | {
"end_col": 13,
"end_line": 62,
"start_col": 4,
"start_line": 60
} |
FStar.All.ML | val map: ('a -> ML 'b) -> option 'a -> ML (option 'b) | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let map f = function
| Some x -> Some (f x)
| None -> None | val map: ('a -> ML 'b) -> option 'a -> ML (option 'b)
let map f = | true | null | false | function
| Some x -> Some (f x)
| None -> None | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"ml"
] | [
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.None"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool
inline_for_extraction
let isNone = function
| None -> true
| Some _ -> false
inline_for_extraction
val isSome: option 'a -> Tot bool
inline_for_extraction
let isSome = function
| Some _ -> true
| None -> false
inline_for_extraction
val map: ('a -> ML 'b) -> option 'a -> ML (option 'b) | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val map: ('a -> ML 'b) -> option 'a -> ML (option 'b) | [] | FStar.Option.map | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | f: (_: 'a -> FStar.All.ML 'b) -> _: FStar.Pervasives.Native.option 'a
-> FStar.All.ML (FStar.Pervasives.Native.option 'b) | {
"end_col": 16,
"end_line": 39,
"start_col": 12,
"start_line": 37
} |
Prims.Tot | val isNone: option 'a -> Tot bool | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let isNone = function
| None -> true
| Some _ -> false | val isNone: option 'a -> Tot bool
let isNone = | false | null | false | function
| None -> true
| Some _ -> false | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.option",
"Prims.bool"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val isNone: option 'a -> Tot bool | [] | FStar.Option.isNone | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: FStar.Pervasives.Native.option 'a -> Prims.bool | {
"end_col": 19,
"end_line": 25,
"start_col": 13,
"start_line": 23
} |
Prims.Tot | val isSome: option 'a -> Tot bool | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let isSome = function
| Some _ -> true
| None -> false | val isSome: option 'a -> Tot bool
let isSome = | false | null | false | function
| Some _ -> true
| None -> false | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.option",
"Prims.bool"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool
inline_for_extraction
let isNone = function
| None -> true
| Some _ -> false
inline_for_extraction
val isSome: option 'a -> Tot bool | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val isSome: option 'a -> Tot bool | [] | FStar.Option.isSome | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: FStar.Pervasives.Native.option 'a -> Prims.bool | {
"end_col": 17,
"end_line": 32,
"start_col": 13,
"start_line": 30
} |
Prims.Tot | val op_let_Question (x: option 'a) (f: ('a -> option 'b)) : option 'b | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let (let?) (x: option 'a) (f: 'a -> option 'b): option 'b
= match x with
| Some x -> f x
| None -> None | val op_let_Question (x: option 'a) (f: ('a -> option 'b)) : option 'b
let op_let_Question (x: option 'a) (f: ('a -> option 'b)) : option 'b = | false | null | false | match x with
| Some x -> f x
| None -> None | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.None"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool
inline_for_extraction
let isNone = function
| None -> true
| Some _ -> false
inline_for_extraction
val isSome: option 'a -> Tot bool
inline_for_extraction
let isSome = function
| Some _ -> true
| None -> false
inline_for_extraction
val map: ('a -> ML 'b) -> option 'a -> ML (option 'b)
inline_for_extraction
let map f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction
val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
inline_for_extraction
let mapTot f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction
val get: option 'a -> ML 'a
let get = function
| Some x -> x
| None -> failwith "empty option" | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_let_Question (x: option 'a) (f: ('a -> option 'b)) : option 'b | [] | FStar.Option.op_let_Question | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Pervasives.Native.option 'a -> f: (_: 'a -> FStar.Pervasives.Native.option 'b)
-> FStar.Pervasives.Native.option 'b | {
"end_col": 18,
"end_line": 57,
"start_col": 4,
"start_line": 55
} |
Prims.Tot | val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b) | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mapTot f = function
| Some x -> Some (f x)
| None -> None | val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let mapTot f = | false | null | false | function
| Some x -> Some (f x)
| None -> None | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.None"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool
inline_for_extraction
let isNone = function
| None -> true
| Some _ -> false
inline_for_extraction
val isSome: option 'a -> Tot bool
inline_for_extraction
let isSome = function
| Some _ -> true
| None -> false
inline_for_extraction
val map: ('a -> ML 'b) -> option 'a -> ML (option 'b)
inline_for_extraction
let map f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction
val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b) | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b) | [] | FStar.Option.mapTot | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | f: (_: 'a -> 'b) -> _: FStar.Pervasives.Native.option 'a -> FStar.Pervasives.Native.option 'b | {
"end_col": 16,
"end_line": 46,
"start_col": 15,
"start_line": 44
} |
FStar.All.ML | val get: option 'a -> ML 'a | [
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let get = function
| Some x -> x
| None -> failwith "empty option" | val get: option 'a -> ML 'a
let get = | true | null | false | function
| Some x -> x
| None -> failwith "empty option" | {
"checked_file": "FStar.Option.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Option.fst"
} | [
"ml"
] | [
"FStar.Pervasives.Native.option",
"FStar.All.failwith"
] | [] | (*
Copyright 2008-2014 Nikhil Swamy and Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Option
open FStar.All
inline_for_extraction
val isNone: option 'a -> Tot bool
inline_for_extraction
let isNone = function
| None -> true
| Some _ -> false
inline_for_extraction
val isSome: option 'a -> Tot bool
inline_for_extraction
let isSome = function
| Some _ -> true
| None -> false
inline_for_extraction
val map: ('a -> ML 'b) -> option 'a -> ML (option 'b)
inline_for_extraction
let map f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction
val mapTot: ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
inline_for_extraction
let mapTot f = function
| Some x -> Some (f x)
| None -> None
inline_for_extraction | false | false | FStar.Option.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get: option 'a -> ML 'a | [] | FStar.Option.get | {
"file_name": "ulib/FStar.Option.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: FStar.Pervasives.Native.option 'a -> FStar.All.ML 'a | {
"end_col": 35,
"end_line": 52,
"start_col": 10,
"start_line": 50
} |
FStar.Tactics.Effect.Tac | val forall_intro: Prims.unit -> Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro () | val forall_intro: Prims.unit -> Tac binder
let forall_intro () : Tac binder = | true | null | false | apply_lemma (`fa_intro_lem);
intro () | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Builtins.intro",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val forall_intro: Prims.unit -> Tac binder | [] | FStar.Tactics.V1.Logic.forall_intro | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 12,
"end_line": 51,
"start_col": 4,
"start_line": 50
} |
FStar.Tactics.Effect.Tac | val implies_intro_as (s: string) : Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s | val implies_intro_as (s: string) : Tac binder
let implies_intro_as (s: string) : Tac binder = | true | null | false | apply_lemma (`imp_intro_lem);
intro_as s | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.string",
"FStar.Tactics.V1.Derived.intro_as",
"FStar.Reflection.Types.binder",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val implies_intro_as (s: string) : Tac binder | [] | FStar.Tactics.V1.Logic.implies_intro_as | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: Prims.string -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 14,
"end_line": 83,
"start_col": 4,
"start_line": 82
} |
FStar.Tactics.Effect.Tac | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs | let skolem () = | true | null | false | let bs = binders_of_env (cur_env ()) in
map sk_binder bs | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.Util.map",
"FStar.Reflection.Types.binder",
"FStar.Pervasives.Native.tuple2",
"FStar.Reflection.Types.binders",
"FStar.Tactics.V1.Logic.sk_binder",
"Prims.list",
"FStar.Reflection.V1.Builtins.binders_of_env",
"FStar.Reflection.Types.env",
"FStar.Tactics.V1.Derived.cur_env"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val skolem : _: Prims.unit
-> FStar.Tactics.Effect.Tac
(Prims.list (FStar.Reflection.Types.binders * FStar.Reflection.Types.binder)) | [] | FStar.Tactics.V1.Logic.skolem | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit
-> FStar.Tactics.Effect.Tac
(Prims.list (FStar.Reflection.Types.binders * FStar.Reflection.Types.binder)) | {
"end_col": 18,
"end_line": 312,
"start_col": 15,
"start_line": 310
} |
|
FStar.Pervasives.Lemma | val fa_intro_lem (#a: Type) (#p: (a -> Type)) (f: (x: a -> squash (p x)))
: Lemma (forall (x: a). p x) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x))) | val fa_intro_lem (#a: Type) (#p: (a -> Type)) (f: (x: a -> squash (p x)))
: Lemma (forall (x: a). p x)
let fa_intro_lem (#a: Type) (#p: (a -> Type)) (f: (x: a -> squash (p x)))
: Lemma (forall (x: a). p x) = | false | null | true | FStar.Classical.lemma_forall_intro_gtot ((fun x -> FStar.IndefiniteDescription.elim_squash (f x))
<:
(x: a -> GTot (p x))) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.squash",
"FStar.Classical.lemma_forall_intro_gtot",
"FStar.IndefiniteDescription.elim_squash",
"Prims.unit",
"Prims.l_True",
"Prims.l_Forall",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val fa_intro_lem (#a: Type) (#p: (a -> Type)) (f: (x: a -> squash (p x)))
: Lemma (forall (x: a). p x) | [] | FStar.Tactics.V1.Logic.fa_intro_lem | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | f: (x: a -> Prims.squash (p x)) -> FStar.Pervasives.Lemma (ensures forall (x: a). p x) | {
"end_col": 85,
"end_line": 46,
"start_col": 2,
"start_line": 45
} |
FStar.Tactics.Effect.Tac | val implies_intros: Prims.unit -> Tac binders | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let implies_intros () : Tac binders = repeat1 implies_intro | val implies_intros: Prims.unit -> Tac binders
let implies_intros () : Tac binders = | true | null | false | repeat1 implies_intro | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.repeat1",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.implies_intro",
"Prims.list",
"FStar.Reflection.Types.binders"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val implies_intros: Prims.unit -> Tac binders | [] | FStar.Tactics.V1.Logic.implies_intros | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binders | {
"end_col": 59,
"end_line": 86,
"start_col": 38,
"start_line": 86
} |
FStar.Tactics.Effect.Tac | val cases_or (o: term) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o]) | val cases_or (o: term) : Tac unit
let cases_or (o: term) : Tac unit = | true | null | false | apply_lemma (mk_e_app (`or_ind) [o]) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.apply_lemma",
"FStar.Reflection.V1.Derived.mk_e_app",
"Prims.Cons",
"Prims.Nil",
"Prims.unit"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val cases_or (o: term) : Tac unit | [] | FStar.Tactics.V1.Logic.cases_or | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | o: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 40,
"end_line": 205,
"start_col": 4,
"start_line": 205
} |
FStar.Tactics.Effect.Tac | val l_revert: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let l_revert () : Tac unit =
revert ();
apply (`revert_squash) | val l_revert: Prims.unit -> Tac unit
let l_revert () : Tac unit = | true | null | false | revert ();
apply (`revert_squash) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.apply",
"FStar.Tactics.V1.Builtins.revert"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val l_revert: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.l_revert | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 26,
"end_line": 36,
"start_col": 4,
"start_line": 35
} |
FStar.Tactics.Effect.Tac | val hyp (b: binder) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hyp (b:binder) : Tac unit = l_exact (binder_to_term b) | val hyp (b: binder) : Tac unit
let hyp (b: binder) : Tac unit = | true | null | false | l_exact (binder_to_term b) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.l_exact",
"Prims.unit",
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.binder_to_term"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hyp (b: binder) : Tac unit | [] | FStar.Tactics.V1.Logic.hyp | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Reflection.Types.binder -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 58,
"end_line": 101,
"start_col": 32,
"start_line": 101
} |
FStar.Tactics.Effect.Tac | val cur_formula: Prims.unit -> Tac formula | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let cur_formula () : Tac formula = term_as_formula (cur_goal ()) | val cur_formula: Prims.unit -> Tac formula
let cur_formula () : Tac formula = | true | null | false | term_as_formula (cur_goal ()) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Reflection.V1.Formula.term_as_formula",
"FStar.Reflection.V1.Formula.formula",
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.cur_goal",
"FStar.Reflection.Types.typ"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val cur_formula: Prims.unit -> Tac formula | [] | FStar.Tactics.V1.Logic.cur_formula | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.V1.Formula.formula | {
"end_col": 64,
"end_line": 26,
"start_col": 35,
"start_line": 26
} |
FStar.Tactics.Effect.Tac | val right: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let right () : Tac unit =
apply_lemma (`or_intro_2) | val right: Prims.unit -> Tac unit
let right () : Tac unit = | true | null | false | apply_lemma (`or_intro_2) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val right: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.right | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 29,
"end_line": 227,
"start_col": 4,
"start_line": 227
} |
FStar.Tactics.Effect.Tac | val rewrite_all_equalities: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication | val rewrite_all_equalities: Prims.unit -> Tac unit
let rewrite_all_equalities () : Tac unit = | true | null | false | visit simplify_eq_implication | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Logic.visit",
"FStar.Tactics.V1.Logic.simplify_eq_implication"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val rewrite_all_equalities: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.rewrite_all_equalities | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 33,
"end_line": 166,
"start_col": 4,
"start_line": 166
} |
FStar.Tactics.Effect.Tac | val witness (t: term) : Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t | val witness (t: term) : Tac unit
let witness (t: term) : Tac unit = | true | null | false | apply_raw (`__witness);
exact t | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.exact",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_raw"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val witness (t: term) : Tac unit | [] | FStar.Tactics.V1.Logic.witness | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 11,
"end_line": 256,
"start_col": 4,
"start_line": 255
} |
FStar.Tactics.Effect.Tac | val explode: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))])) | val explode: Prims.unit -> Tac unit
let explode () : Tac unit = | true | null | false | ignore (repeatseq (fun () -> first [(fun () -> ignore (l_intro ())); (fun () -> ignore (split ()))])
) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Pervasives.ignore",
"FStar.Tactics.V1.Derived.repeatseq",
"FStar.Tactics.V1.Derived.first",
"Prims.Cons",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.l_intro",
"FStar.Tactics.V1.Logic.split",
"Prims.Nil"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val explode: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.explode | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 64,
"end_line": 131,
"start_col": 4,
"start_line": 129
} |
FStar.Tactics.Effect.Tac | val forall_intros: Prims.unit -> Tac binders | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let forall_intros () : Tac binders = repeat1 forall_intro | val forall_intros: Prims.unit -> Tac binders
let forall_intros () : Tac binders = | true | null | false | repeat1 forall_intro | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.repeat1",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.forall_intro",
"Prims.list",
"FStar.Reflection.Types.binders"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val forall_intros: Prims.unit -> Tac binders | [] | FStar.Tactics.V1.Logic.forall_intros | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binders | {
"end_col": 57,
"end_line": 59,
"start_col": 37,
"start_line": 59
} |
FStar.Pervasives.Lemma | val lem2_fa
(#a #b #pre #post: _)
($lem: (x: a -> y: b -> Lemma (requires pre x y) (ensures post x y)))
: Lemma (forall (x: a) (y: b). pre x y ==> post x y) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lem2_fa #a #b #pre #post
($lem : (x:a -> y:b -> Lemma (requires pre x y) (ensures post x y))) :
Lemma (forall (x:a) (y:b). pre x y ==> post x y) =
let l' x y : Lemma (pre x y ==> post x y) =
Classical.move_requires (lem x) y
in
Classical.forall_intro_2 l' | val lem2_fa
(#a #b #pre #post: _)
($lem: (x: a -> y: b -> Lemma (requires pre x y) (ensures post x y)))
: Lemma (forall (x: a) (y: b). pre x y ==> post x y)
let lem2_fa #a #b #pre #post ($lem: (x: a -> y: b -> Lemma (requires pre x y) (ensures post x y)))
: Lemma (forall (x: a) (y: b). pre x y ==> post x y) = | false | null | true | let l' x y : Lemma (pre x y ==> post x y) = Classical.move_requires (lem x) y in
Classical.forall_intro_2 l' | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Classical.forall_intro_2",
"Prims.l_imp",
"Prims.l_True",
"FStar.Classical.move_requires",
"Prims.l_Forall"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
private
let lemma_from_squash #a #b f x = let _ = f x in assert (b x)
private
let easy_fill () =
let _ = repeat intro in
(* If the goal is `a -> Lemma b`, intro will fail, try to use this switch *)
let _ = trytac (fun () -> apply (`lemma_from_squash); intro ()) in
smt ()
val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a
let easy #a #x = x
private
let lem1_fa #a #pre #post
($lem : (x:a -> Lemma (requires pre x) (ensures post x))) :
Lemma (forall (x:a). pre x ==> post x) =
let l' x : Lemma (pre x ==> post x) =
Classical.move_requires lem x
in
Classical.forall_intro l'
private
let lem2_fa #a #b #pre #post | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lem2_fa
(#a #b #pre #post: _)
($lem: (x: a -> y: b -> Lemma (requires pre x y) (ensures post x y)))
: Lemma (forall (x: a) (y: b). pre x y ==> post x y) | [] | FStar.Tactics.V1.Logic.lem2_fa | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | $lem: (x: a -> y: b -> FStar.Pervasives.Lemma (requires pre x y) (ensures post x y))
-> FStar.Pervasives.Lemma (ensures forall (x: a) (y: b). pre x y ==> post x y) | {
"end_col": 29,
"end_line": 345,
"start_col": 52,
"start_line": 341
} |
FStar.Tactics.Effect.Tac | val left: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let left () : Tac unit =
apply_lemma (`or_intro_1) | val left: Prims.unit -> Tac unit
let left () : Tac unit = | true | null | false | apply_lemma (`or_intro_1) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val left: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.left | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 29,
"end_line": 224,
"start_col": 4,
"start_line": 224
} |
FStar.Tactics.Effect.Tac | val squash_intro: Prims.unit -> Tac unit | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash) | val squash_intro: Prims.unit -> Tac unit
let squash_intro () : Tac unit = | true | null | false | apply (`FStar.Squash.return_squash) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.apply"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val squash_intro: Prims.unit -> Tac unit | [] | FStar.Tactics.V1.Logic.squash_intro | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 39,
"end_line": 95,
"start_col": 4,
"start_line": 95
} |
FStar.Tactics.Effect.Tac | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t) | let l_exact (t: term) = | true | null | false | try exact t
with
| _ ->
(squash_intro ();
exact t) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.try_with",
"Prims.unit",
"FStar.Tactics.V1.Derived.exact",
"Prims.exn",
"FStar.Tactics.V1.Logic.squash_intro"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val l_exact : t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | [] | FStar.Tactics.V1.Logic.l_exact | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 37,
"end_line": 99,
"start_col": 4,
"start_line": 98
} |
|
FStar.Tactics.Effect.Tac | val forall_intro_as (s: string) : Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s | val forall_intro_as (s: string) : Tac binder
let forall_intro_as (s: string) : Tac binder = | true | null | false | apply_lemma (`fa_intro_lem);
intro_as s | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.string",
"FStar.Tactics.V1.Derived.intro_as",
"FStar.Reflection.Types.binder",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val forall_intro_as (s: string) : Tac binder | [] | FStar.Tactics.V1.Logic.forall_intro_as | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | s: Prims.string -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 14,
"end_line": 56,
"start_col": 4,
"start_line": 55
} |
Prims.Tot | val __forall_inst_sq (#t: _) (#pred: (t -> Type0)) (h: squash (forall x. pred x)) (x: t)
: squash (pred x) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x) | val __forall_inst_sq (#t: _) (#pred: (t -> Type0)) (h: squash (forall x. pred x)) (x: t)
: squash (pred x)
let __forall_inst_sq #t (#pred: (t -> Type0)) (h: squash (forall x. pred x)) (x: t)
: squash (pred x) = | false | null | true | FStar.Squash.bind_squash h (fun (f: (forall x. pred x)) -> __forall_inst f x) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"total"
] | [
"Prims.squash",
"Prims.l_Forall",
"FStar.Squash.bind_squash",
"FStar.Tactics.V1.Logic.__forall_inst"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val __forall_inst_sq (#t: _) (#pred: (t -> Type0)) (h: squash (forall x. pred x)) (x: t)
: squash (pred x) | [] | FStar.Tactics.V1.Logic.__forall_inst_sq | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | h: Prims.squash (forall (x: t). pred x) -> x: t -> Prims.squash (pred x) | {
"end_col": 82,
"end_line": 277,
"start_col": 4,
"start_line": 277
} |
Prims.Tot | val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let easy #a #x = x | val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a
let easy #a #x = | false | null | false | x | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"total"
] | [] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
private
let lemma_from_squash #a #b f x = let _ = f x in assert (b x)
private
let easy_fill () =
let _ = repeat intro in
(* If the goal is `a -> Lemma b`, intro will fail, try to use this switch *)
let _ = trytac (fun () -> apply (`lemma_from_squash); intro ()) in
smt () | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a | [] | FStar.Tactics.V1.Logic.easy | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | a | {
"end_col": 18,
"end_line": 327,
"start_col": 17,
"start_line": 327
} |
FStar.Tactics.Effect.Tac | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let l_intros () = repeat l_intro | let l_intros () = | true | null | false | repeat l_intro | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.repeat",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.l_intro",
"Prims.list"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val l_intros : _: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Reflection.Types.binder) | [] | FStar.Tactics.V1.Logic.l_intros | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac (Prims.list FStar.Reflection.Types.binder) | {
"end_col": 32,
"end_line": 92,
"start_col": 18,
"start_line": 92
} |
|
FStar.Tactics.Effect.Tac | val instantiate (fa x: term) : Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate" | val instantiate (fa x: term) : Tac binder
let instantiate (fa x: term) : Tac binder = | true | null | false | try pose (`__forall_inst_sq (`#fa) (`#x))
with
| _ -> try pose (`__forall_inst (`#fa) (`#x)) with | _ -> fail "could not instantiate" | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.try_with",
"FStar.Reflection.Types.binder",
"Prims.unit",
"FStar.Tactics.V1.Derived.pose",
"Prims.exn",
"FStar.Tactics.V1.Derived.fail"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val instantiate (fa x: term) : Tac binder | [] | FStar.Tactics.V1.Logic.instantiate | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | fa: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term
-> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 32,
"end_line": 282,
"start_col": 4,
"start_line": 280
} |
FStar.Tactics.Effect.Tac | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let sk_binder b = sk_binder' [] b | let sk_binder b = | true | null | false | sk_binder' [] b | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Logic.sk_binder'",
"Prims.Nil",
"FStar.Pervasives.Native.tuple2",
"FStar.Reflection.Types.binders"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sk_binder : b: FStar.Reflection.Types.binder
-> FStar.Tactics.Effect.Tac (FStar.Reflection.Types.binders * FStar.Reflection.Types.binder) | [] | FStar.Tactics.V1.Logic.sk_binder | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | b: FStar.Reflection.Types.binder
-> FStar.Tactics.Effect.Tac (FStar.Reflection.Types.binders * FStar.Reflection.Types.binder) | {
"end_col": 33,
"end_line": 308,
"start_col": 18,
"start_line": 308
} |
|
FStar.Pervasives.Lemma | val lem1_fa (#a #pre #post: _) ($lem: (x: a -> Lemma (requires pre x) (ensures post x)))
: Lemma (forall (x: a). pre x ==> post x) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lem1_fa #a #pre #post
($lem : (x:a -> Lemma (requires pre x) (ensures post x))) :
Lemma (forall (x:a). pre x ==> post x) =
let l' x : Lemma (pre x ==> post x) =
Classical.move_requires lem x
in
Classical.forall_intro l' | val lem1_fa (#a #pre #post: _) ($lem: (x: a -> Lemma (requires pre x) (ensures post x)))
: Lemma (forall (x: a). pre x ==> post x)
let lem1_fa #a #pre #post ($lem: (x: a -> Lemma (requires pre x) (ensures post x)))
: Lemma (forall (x: a). pre x ==> post x) = | false | null | true | let l' x : Lemma (pre x ==> post x) = Classical.move_requires lem x in
Classical.forall_intro l' | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [
"lemma"
] | [
"Prims.unit",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Classical.forall_intro",
"Prims.l_imp",
"Prims.l_True",
"FStar.Classical.move_requires",
"Prims.l_Forall"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
private
let lemma_from_squash #a #b f x = let _ = f x in assert (b x)
private
let easy_fill () =
let _ = repeat intro in
(* If the goal is `a -> Lemma b`, intro will fail, try to use this switch *)
let _ = trytac (fun () -> apply (`lemma_from_squash); intro ()) in
smt ()
val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a
let easy #a #x = x
private
let lem1_fa #a #pre #post | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lem1_fa (#a #pre #post: _) ($lem: (x: a -> Lemma (requires pre x) (ensures post x)))
: Lemma (forall (x: a). pre x ==> post x) | [] | FStar.Tactics.V1.Logic.lem1_fa | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | $lem: (x: a -> FStar.Pervasives.Lemma (requires pre x) (ensures post x))
-> FStar.Pervasives.Lemma (ensures forall (x: a). pre x ==> post x) | {
"end_col": 27,
"end_line": 336,
"start_col": 42,
"start_line": 332
} |
FStar.Tactics.Effect.Tac | val using_lemma (t: term) : Tac binder | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let using_lemma (t : term) : Tac binder =
try pose_lemma (`(lem1_fa (`#t))) with | _ ->
try pose_lemma (`(lem2_fa (`#t))) with | _ ->
try pose_lemma (`(lem3_fa (`#t))) with | _ ->
fail #binder "using_lemma: failed to instantiate" | val using_lemma (t: term) : Tac binder
let using_lemma (t: term) : Tac binder = | true | null | false | try pose_lemma (`(lem1_fa (`#t)))
with
| _ ->
try pose_lemma (`(lem2_fa (`#t)))
with
| _ ->
try pose_lemma (`(lem3_fa (`#t))) with | _ -> fail #binder "using_lemma: failed to instantiate" | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.Derived.try_with",
"FStar.Reflection.Types.binder",
"Prims.unit",
"FStar.Tactics.V1.Logic.pose_lemma",
"Prims.exn",
"FStar.Tactics.V1.Derived.fail"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *)
let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf)
private
let __forall_inst #t (#pred : t -> Type0) (h : (forall x. pred x)) (x : t) : squash (pred x) =
()
(* GM: annoying that this doesn't just work by SMT *)
private
let __forall_inst_sq #t (#pred : t -> Type0) (h : squash (forall x. pred x)) (x : t) : squash (pred x) =
FStar.Squash.bind_squash h (fun (f : (forall x. pred x)) -> __forall_inst f x)
let instantiate (fa : term) (x : term) : Tac binder =
try pose (`__forall_inst_sq (`#fa) (`#x)) with | _ ->
try pose (`__forall_inst (`#fa) (`#x)) with | _ ->
fail "could not instantiate"
let instantiate_as (fa : term) (x : term) (s : string) : Tac binder =
let b = instantiate fa x in
rename_to b s
private
let sklem0 (#a:Type) (#p : a -> Type0) ($v : (exists (x:a). p x)) (phi:Type0) :
Lemma (requires (forall x. p x ==> phi))
(ensures phi) = ()
private
let rec sk_binder' (acc:binders) (b:binder) : Tac (binders * binder) =
focus (fun () ->
try
apply_lemma (`(sklem0 (`#(binder_to_term b))));
if ngoals () <> 1 then fail "no";
clear b;
let bx = forall_intro () in
let b' = implies_intro () in
sk_binder' (bx::acc) b' (* We might have introduced a new existential, so possibly recurse *)
with | _ -> (acc, b) (* If the above failed, just return *)
)
(* Skolemizes a given binder for an existential, returning the introduced new binders
* and the skolemized formula. *)
let sk_binder b = sk_binder' [] b
let skolem () =
let bs = binders_of_env (cur_env ()) in
map sk_binder bs
private
val lemma_from_squash : #a:Type -> #b:(a -> Type) -> (x:a -> squash (b x)) -> x:a -> Lemma (b x)
private
let lemma_from_squash #a #b f x = let _ = f x in assert (b x)
private
let easy_fill () =
let _ = repeat intro in
(* If the goal is `a -> Lemma b`, intro will fail, try to use this switch *)
let _ = trytac (fun () -> apply (`lemma_from_squash); intro ()) in
smt ()
val easy : #a:Type -> (#[easy_fill ()] _ : a) -> a
let easy #a #x = x
private
let lem1_fa #a #pre #post
($lem : (x:a -> Lemma (requires pre x) (ensures post x))) :
Lemma (forall (x:a). pre x ==> post x) =
let l' x : Lemma (pre x ==> post x) =
Classical.move_requires lem x
in
Classical.forall_intro l'
private
let lem2_fa #a #b #pre #post
($lem : (x:a -> y:b -> Lemma (requires pre x y) (ensures post x y))) :
Lemma (forall (x:a) (y:b). pre x y ==> post x y) =
let l' x y : Lemma (pre x y ==> post x y) =
Classical.move_requires (lem x) y
in
Classical.forall_intro_2 l'
private
let lem3_fa #a #b #c #pre #post
($lem : (x:a -> y:b -> z:c -> Lemma (requires pre x y z) (ensures post x y z))) :
Lemma (forall (x:a) (y:b) (z:c). pre x y z ==> post x y z) =
let l' x y z : Lemma (pre x y z ==> post x y z) =
Classical.move_requires (lem x y) z
in
Classical.forall_intro_3 l'
(** Add a lemma into the local context, quantified for all arguments.
Only works for lemmas with up to 3 arguments for now. It is expected
that `t` is a top-level name, this has not been battle-tested for other
kinds of terms. *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val using_lemma (t: term) : Tac binder | [] | FStar.Tactics.V1.Logic.using_lemma | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 51,
"end_line": 364,
"start_col": 2,
"start_line": 361
} |
FStar.Tactics.Effect.Tac | val elim_exists (t: term) : Tac (binder & binder) | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let elim_exists (t : term) : Tac (binder & binder) =
apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf) | val elim_exists (t: term) : Tac (binder & binder)
let elim_exists (t: term) : Tac (binder & binder) = | true | null | false | apply_lemma (`(__elim_exists' (`#(t))));
let x = intro () in
let pf = intro () in
(x, pf) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.Types.binder",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.V1.Builtins.intro",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking
for [unsquash_term]. *)
let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b))
private val or_ind : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p \/ q) ->
(squash (p ==> phi)) ->
(squash (q ==> phi)) ->
Lemma phi
let or_ind #p #q #phi o l r = ()
let cases_or (o:term) : Tac unit =
apply_lemma (mk_e_app (`or_ind) [o])
private val bool_ind : (b:bool) -> (phi:Type) -> (squash (b == true ==> phi)) ->
(squash (b == false ==> phi)) ->
Lemma phi
let bool_ind b phi l r = ()
let cases_bool (b:term) : Tac unit =
let bi = `bool_ind in
seq (fun () -> apply_lemma (mk_e_app bi [b]))
(fun () -> let _ = trytac (fun () -> let b = implies_intro () in rewrite b; clear_top ()) in ())
private val or_intro_1 : (#p:Type) -> (#q:Type) -> squash p -> Lemma (p \/ q)
let or_intro_1 #p #q _ = ()
private val or_intro_2 : (#p:Type) -> (#q:Type) -> squash q -> Lemma (p \/ q)
let or_intro_2 #p #q _ = ()
let left () : Tac unit =
apply_lemma (`or_intro_1)
let right () : Tac unit =
apply_lemma (`or_intro_2)
private val __and_elim : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
(p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim #p #q #phi p_and_q f = ()
private val __and_elim' : (#p:Type) -> (#q:Type) -> (#phi:Type) ->
squash (p /\ q) ->
squash (p ==> q ==> phi) ->
Lemma phi
let __and_elim' #p #q #phi p_and_q f = ()
let and_elim (t : term) : Tac unit =
begin
try apply_lemma (`(__and_elim (`#t)))
with | _ -> apply_lemma (`(__and_elim' (`#t)))
end
let destruct_and (t : term) : Tac (binder * binder) =
and_elim t;
(implies_intro (), implies_intro ())
private val __witness : (#a:Type) -> (x:a) -> (#p:(a -> Type)) -> squash (p x) -> squash (exists (x:a). p x)
private let __witness #a x #p _ = ()
let witness (t : term) : Tac unit =
apply_raw (`__witness);
exact t
private
let __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))
(k : (x:t -> pred x -> squash goal)) : squash goal =
FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)
(* returns witness and proof as binders *) | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val elim_exists (t: term) : Tac (binder & binder) | [] | FStar.Tactics.V1.Logic.elim_exists | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term
-> FStar.Tactics.Effect.Tac (FStar.Reflection.Types.binder * FStar.Reflection.Types.binder) | {
"end_col": 9,
"end_line": 268,
"start_col": 2,
"start_line": 265
} |
FStar.Tactics.Effect.Tac | val unsquash (t: term) : Tac term | [
{
"abbrev": false,
"full_module": "FStar.Reflection.V1.Formula",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Derived",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1.Builtins",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V1",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let unsquash (t:term) : Tac term =
let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b)) | val unsquash (t: term) : Tac term
let unsquash (t: term) : Tac term = | true | null | false | let v = `vbind in
apply_lemma (mk_e_app v [t]);
let b = intro () in
pack_ln (Tv_Var (bv_of_binder b)) | {
"checked_file": "FStar.Tactics.V1.Logic.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V1.Derived.fst.checked",
"FStar.Tactics.V1.Builtins.fsti.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Reflection.V1.Formula.fst.checked",
"FStar.Reflection.V1.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.IndefiniteDescription.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.V1.Logic.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V1.Builtins.pack_ln",
"FStar.Reflection.V1.Data.Tv_Var",
"FStar.Reflection.V1.Derived.bv_of_binder",
"FStar.Reflection.Types.binder",
"FStar.Tactics.V1.Builtins.intro",
"Prims.unit",
"FStar.Tactics.V1.Derived.apply_lemma",
"FStar.Reflection.V1.Derived.mk_e_app",
"Prims.Cons",
"Prims.Nil"
] | [] | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.V1.Logic
open FStar.Tactics.Effect
open FStar.Tactics.V1.Builtins
open FStar.Tactics.V1.Derived
open FStar.Tactics.Util
open FStar.Reflection.V1
open FStar.Reflection.V1.Formula
(** Returns the current goal as a [formula]. *)
let cur_formula () : Tac formula = term_as_formula (cur_goal ())
private val revert_squash : (#a:Type) -> (#b : (a -> Type)) ->
(squash (forall (x:a). b x)) ->
x:a -> squash (b x)
let revert_squash #a #b s x = let x : (_:unit{forall x. b x}) = s in ()
(** Revert an introduced binder as a forall. *)
let l_revert () : Tac unit =
revert ();
apply (`revert_squash)
(** Repeated [l_revert]. *)
let rec l_revert_all (bs:binders) : Tac unit =
match bs with
| [] -> ()
| _::tl -> begin l_revert (); l_revert_all tl end
private let fa_intro_lem (#a:Type) (#p:a -> Type) (f:(x:a -> squash (p x))) : Lemma (forall (x:a). p x) =
FStar.Classical.lemma_forall_intro_gtot
((fun x -> FStar.IndefiniteDescription.elim_squash (f x)) <: (x:a -> GTot (p x)))
(** Introduce a forall. *)
let forall_intro () : Tac binder =
apply_lemma (`fa_intro_lem);
intro ()
(** Introduce a forall, with some given name. *)
let forall_intro_as (s:string) : Tac binder =
apply_lemma (`fa_intro_lem);
intro_as s
(** Repeated [forall_intro]. *)
let forall_intros () : Tac binders = repeat1 forall_intro
private val split_lem : (#a:Type) -> (#b:Type) ->
squash a -> squash b -> Lemma (a /\ b)
let split_lem #a #b sa sb = ()
(** Split a conjunction into two goals. *)
let split () : Tac unit =
try apply_lemma (`split_lem)
with | _ -> fail "Could not split goal"
private val imp_intro_lem : (#a:Type) -> (#b : Type) ->
(a -> squash b) ->
Lemma (a ==> b)
let imp_intro_lem #a #b f =
FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (fun (x:squash a) -> FStar.Squash.bind_squash x f))
(** Introduce an implication. *)
let implies_intro () : Tac binder =
apply_lemma (`imp_intro_lem);
intro ()
let implies_intro_as (s:string) : Tac binder =
apply_lemma (`imp_intro_lem);
intro_as s
(** Repeated [implies_intro]. *)
let implies_intros () : Tac binders = repeat1 implies_intro
(** "Logical" intro: introduce a forall or an implication. *)
let l_intro () = forall_intro `or_else` implies_intro
(** Repeated [l]. *)
let l_intros () = repeat l_intro
let squash_intro () : Tac unit =
apply (`FStar.Squash.return_squash)
let l_exact (t:term) =
try exact t with
| _ -> (squash_intro (); exact t)
let hyp (b:binder) : Tac unit = l_exact (binder_to_term b)
private
let __lemma_to_squash #req #ens (_ : squash req) (h : (unit -> Lemma (requires req) (ensures ens))) : squash ens =
h ()
let pose_lemma (t : term) : Tac binder =
let c = tcc (cur_env ()) t in
let pre, post =
match inspect_comp c with
| C_Lemma pre post _ -> pre, post
| _ -> fail ""
in
let post = `((`#post) ()) in (* unthunk *)
let post = norm_term [] post in
(* If the precondition is trivial, do not cut by it *)
match term_as_formula' pre with
| True_ ->
pose (`(__lemma_to_squash #(`#pre) #(`#post) () (fun () -> (`#t))))
| _ ->
let reqb = tcut (`squash (`#pre)) in
let b = pose (`(__lemma_to_squash #(`#pre) #(`#post) (`#(binder_to_term reqb)) (fun () -> (`#t)))) in
flip ();
ignore (trytac trivial);
b
let explode () : Tac unit =
ignore (
repeatseq (fun () -> first [(fun () -> ignore (l_intro ()));
(fun () -> ignore (split ()))]))
let rec visit (callback:unit -> Tac unit) : Tac unit =
focus (fun () ->
or_else callback
(fun () ->
let g = cur_goal () in
match term_as_formula g with
| Forall _b _sort _phi ->
let binders = forall_intros () in
seq (fun () -> visit callback) (fun () -> l_revert_all binders)
| And p q ->
seq split (fun () -> visit callback)
| Implies p q ->
let _ = implies_intro () in
seq (fun () -> visit callback) l_revert
| _ ->
()
)
)
let rec simplify_eq_implication () : Tac unit =
let e = cur_env () in
let g = cur_goal () in
let r = destruct_equality_implication g in
match r with
| None ->
fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in // G, eq_h:x=e |- P
rewrite eq_h; // G, eq_h:x=e |- P[e/x]
clear_top (); // G |- P[e/x]
visit simplify_eq_implication
let rewrite_all_equalities () : Tac unit =
visit simplify_eq_implication
let rec unfold_definition_and_simplify_eq (tm:term) : Tac unit =
let g = cur_goal () in
match term_as_formula g with
| App hd arg ->
if term_eq hd tm
then trivial ()
else ()
| _ -> begin
let r = destruct_equality_implication g in
match r with
| None -> fail "Not an equality implication"
| Some (_, rhs) ->
let eq_h = implies_intro () in
rewrite eq_h;
clear_top ();
visit (fun () -> unfold_definition_and_simplify_eq tm)
end
private val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q
let vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)
(** A tactic to unsquash a hypothesis. Perhaps you are looking | false | false | FStar.Tactics.V1.Logic.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val unsquash (t: term) : Tac term | [] | FStar.Tactics.V1.Logic.unsquash | {
"file_name": "ulib/FStar.Tactics.V1.Logic.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.term | {
"end_col": 37,
"end_line": 195,
"start_col": 34,
"start_line": 191
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.