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 elab_pats (ps: list pattern) : Tot (list R.pattern)
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_pats (ps:list pattern) : Tot (list R.pattern) = L.map elab_pat ps
val elab_pats (ps: list pattern) : Tot (list R.pattern) let elab_pats (ps: list pattern) : Tot (list R.pattern) =
false
null
false
L.map elab_pat ps
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "Prims.list", "Pulse.Syntax.Base.pattern", "FStar.List.Tot.Base.map", "FStar.Reflection.V2.Data.pattern", "Pulse.Elaborate.Pure.elab_pat" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t let rec elab_pat (p:pattern) : Tot R.pattern = let elab_fv (f:fv) : R.fv = R.pack_fv f.fv_name in match p with | Pat_Constant c -> R.Pat_Constant c | Pat_Var v ty -> R.Pat_Var RT.sort_default v | Pat_Cons fv vs -> R.Pat_Cons (elab_fv fv) None (Pulse.Common.map_dec p vs elab_sub_pat) | Pat_Dot_Term None -> R.Pat_Dot_Term None | Pat_Dot_Term (Some t) -> R.Pat_Dot_Term (Some (elab_term t)) and elab_sub_pat (pi : pattern & bool) : R.pattern & bool = let (p, i) = pi in elab_pat p, i
false
true
Pulse.Elaborate.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 elab_pats (ps: list pattern) : Tot (list R.pattern)
[]
Pulse.Elaborate.Pure.elab_pats
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
ps: Prims.list Pulse.Syntax.Base.pattern -> Prims.list FStar.Reflection.V2.Data.pattern
{ "end_col": 74, "end_line": 80, "start_col": 57, "start_line": 80 }
Prims.Tot
val elab_st_comp (c: st_comp) : R.universe & R.term & R.term & R.term
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_st_comp (c:st_comp) : R.universe & R.term & R.term & R.term = let res = elab_term c.res in let pre = elab_term c.pre in let post = elab_term c.post in c.u, res, pre, post
val elab_st_comp (c: st_comp) : R.universe & R.term & R.term & R.term let elab_st_comp (c: st_comp) : R.universe & R.term & R.term & R.term =
false
null
false
let res = elab_term c.res in let pre = elab_term c.pre in let post = elab_term c.post in c.u, res, pre, post
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.st_comp", "FStar.Pervasives.Native.Mktuple4", "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Syntax.Base.__proj__Mkst_comp__item__u", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Syntax.Base.__proj__Mkst_comp__item__pre", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "FStar.Pervasives.Native.tuple4" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t let rec elab_pat (p:pattern) : Tot R.pattern = let elab_fv (f:fv) : R.fv = R.pack_fv f.fv_name in match p with | Pat_Constant c -> R.Pat_Constant c | Pat_Var v ty -> R.Pat_Var RT.sort_default v | Pat_Cons fv vs -> R.Pat_Cons (elab_fv fv) None (Pulse.Common.map_dec p vs elab_sub_pat) | Pat_Dot_Term None -> R.Pat_Dot_Term None | Pat_Dot_Term (Some t) -> R.Pat_Dot_Term (Some (elab_term t)) and elab_sub_pat (pi : pattern & bool) : R.pattern & bool = let (p, i) = pi in elab_pat p, i let elab_pats (ps:list pattern) : Tot (list R.pattern) = L.map elab_pat ps let elab_st_comp (c:st_comp)
false
true
Pulse.Elaborate.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 elab_st_comp (c: st_comp) : R.universe & R.term & R.term & R.term
[]
Pulse.Elaborate.Pure.elab_st_comp
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.st_comp -> ((FStar.Reflection.Types.universe * FStar.Reflection.Types.term) * FStar.Reflection.Types.term) * FStar.Reflection.Types.term
{ "end_col": 23, "end_line": 87, "start_col": 3, "start_line": 84 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit
let elab_qual =
false
null
false
function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "FStar.Pervasives.Native.option", "Pulse.Syntax.Base.qualifier", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Reflection.V2.Data.aqualv" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x
false
true
Pulse.Elaborate.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 elab_qual : _: FStar.Pervasives.Native.option Pulse.Syntax.Base.qualifier -> FStar.Reflection.V2.Data.aqualv
[]
Pulse.Elaborate.Pure.elab_qual
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
_: FStar.Pervasives.Native.option Pulse.Syntax.Base.qualifier -> FStar.Reflection.V2.Data.aqualv
{ "end_col": 33, "end_line": 18, "start_col": 16, "start_line": 16 }
Prims.Tot
val op_let_Bang (f: option 'a) (g: ('a -> option 'b)) : option 'b
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x
val op_let_Bang (f: option 'a) (g: ('a -> option 'b)) : option 'b let op_let_Bang (f: option 'a) (g: ('a -> option 'b)) : option 'b =
false
null
false
match f with | None -> None | Some x -> g x
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.None" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util
false
false
Pulse.Elaborate.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 op_let_Bang (f: option 'a) (g: ('a -> option 'b)) : option 'b
[]
Pulse.Elaborate.Pure.op_let_Bang
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
f: FStar.Pervasives.Native.option 'a -> g: (_: 'a -> FStar.Pervasives.Native.option 'b) -> FStar.Pervasives.Native.option 'b
{ "end_col": 17, "end_line": 14, "start_col": 2, "start_line": 12 }
Prims.Tot
val elab_comp (c: comp) : R.term
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_comp (c:comp) : R.term = match c with | C_Tot t -> elab_term t | C_ST c -> let u, res, pre, post = elab_st_comp c in mk_stt_comp u res pre (mk_abs res R.Q_Explicit post) | C_STAtomic inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_atomic_comp u res inames pre (mk_abs res R.Q_Explicit post) | C_STGhost inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_ghost_comp u res inames pre (mk_abs res R.Q_Explicit post)
val elab_comp (c: comp) : R.term let elab_comp (c: comp) : R.term =
false
null
false
match c with | C_Tot t -> elab_term t | C_ST c -> let u, res, pre, post = elab_st_comp c in mk_stt_comp u res pre (mk_abs res R.Q_Explicit post) | C_STAtomic inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_atomic_comp u res inames pre (mk_abs res R.Q_Explicit post) | C_STGhost inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_ghost_comp u res inames pre (mk_abs res R.Q_Explicit post)
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.comp", "Pulse.Syntax.Base.term", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.st_comp", "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_stt_comp", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Pervasives.Native.tuple4", "Pulse.Elaborate.Pure.elab_st_comp", "Pulse.Reflection.Util.mk_stt_atomic_comp", "Pulse.Reflection.Util.mk_stt_ghost_comp" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t let rec elab_pat (p:pattern) : Tot R.pattern = let elab_fv (f:fv) : R.fv = R.pack_fv f.fv_name in match p with | Pat_Constant c -> R.Pat_Constant c | Pat_Var v ty -> R.Pat_Var RT.sort_default v | Pat_Cons fv vs -> R.Pat_Cons (elab_fv fv) None (Pulse.Common.map_dec p vs elab_sub_pat) | Pat_Dot_Term None -> R.Pat_Dot_Term None | Pat_Dot_Term (Some t) -> R.Pat_Dot_Term (Some (elab_term t)) and elab_sub_pat (pi : pattern & bool) : R.pattern & bool = let (p, i) = pi in elab_pat p, i let elab_pats (ps:list pattern) : Tot (list R.pattern) = L.map elab_pat ps let elab_st_comp (c:st_comp) : R.universe & R.term & R.term & R.term = let res = elab_term c.res in let pre = elab_term c.pre in let post = elab_term c.post in c.u, res, pre, post let elab_comp (c:comp)
false
true
Pulse.Elaborate.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 elab_comp (c: comp) : R.term
[]
Pulse.Elaborate.Pure.elab_comp
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp -> FStar.Reflection.Types.term
{ "end_col": 71, "end_line": 107, "start_col": 4, "start_line": 91 }
Prims.Tot
val elab_term (top: term) : R.term
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t
val elab_term (top: term) : R.term let rec elab_term (top: term) : R.term =
false
null
false
let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body )) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body )) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.__proj__Mkterm__item__t", "FStar.Reflection.V2.Builtins.pack_ln", "FStar.Reflection.V2.Data.Tv_FVar", "FStar.Reflection.V2.Builtins.pack_fv", "Pulse.Reflection.Util.vprop_lid", "Pulse.Reflection.Util.emp_lid", "FStar.Reflection.V2.Data.Tv_App", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Reflection.Util.pure_lid", "Pulse.Elaborate.Pure.elab_term", "Pulse.Reflection.Util.mk_star", "Pulse.Syntax.Base.universe", "Pulse.Syntax.Base.binder", "Pulse.Syntax.Base.uu___is_Tm_ExistsSL", "Pulse.Reflection.Util.mk_exists", "Pulse.Reflection.Util.mk_abs_with_name_and_range", "Pulse.Syntax.Base.__proj__Mkppname__item__name", "Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ppname", "Pulse.Syntax.Base.__proj__Mkppname__item__range", "Prims.bool", "Pulse.Reflection.Util.mk_forall", "range", "binder_ppname", "Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty", "Pulse.Reflection.Util.inames_lid", "Pulse.Reflection.Util.emp_inames_tm", "FStar.Reflection.V2.Data.Tv_Unknown", "Pulse.Syntax.Base.host_term", "Prims.eq2", "Pulse.RuntimeUtils.set_range", "Pulse.Syntax.Base.__proj__Mkterm__item__range" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term)
false
true
Pulse.Elaborate.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 elab_term (top: term) : R.term
[ "recursion" ]
Pulse.Elaborate.Pure.elab_term
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
top: Pulse.Syntax.Base.term -> FStar.Reflection.Types.term
{ "end_col": 9, "end_line": 60, "start_col": 4, "start_line": 22 }
Prims.Tot
val elab_stt_equiv (g: R.env) (c: comp{C_ST? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST { u = u ; res = res } = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c)
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_stt_equiv (g:R.env) (c:comp{C_ST? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST {u;res} = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c) = mk_stt_comp_equiv _ (comp_u c) (elab_term (comp_res c)) _ _ _ _ _ (RT.Rel_refl _ _ _) eq_pre eq_post
val elab_stt_equiv (g: R.env) (c: comp{C_ST? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST { u = u ; res = res } = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c) let elab_stt_equiv (g: R.env) (c: comp{C_ST? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST { u = u ; res = res } = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c) =
false
null
false
mk_stt_comp_equiv _ (comp_u c) (elab_term (comp_res c)) _ _ _ _ _ (RT.Rel_refl _ _ _) eq_pre eq_post
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "FStar.Reflection.Types.env", "Pulse.Syntax.Base.comp", "Prims.b2t", "Pulse.Syntax.Base.uu___is_C_ST", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.equiv", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.comp_pre", "Pulse.Reflection.Util.mk_abs", "Pulse.Syntax.Base.comp_res", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Syntax.Base.comp_post", "Pulse.Reflection.Util.mk_stt_comp_equiv", "Pulse.Syntax.Base.comp_u", "FStar.Reflection.Typing.Rel_refl", "FStar.Reflection.Typing.R_Eq", "Pulse.Syntax.Base.universe", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.vprop", "Pulse.Reflection.Util.mk_stt_comp", "Pulse.Elaborate.Pure.elab_comp" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t let rec elab_pat (p:pattern) : Tot R.pattern = let elab_fv (f:fv) : R.fv = R.pack_fv f.fv_name in match p with | Pat_Constant c -> R.Pat_Constant c | Pat_Var v ty -> R.Pat_Var RT.sort_default v | Pat_Cons fv vs -> R.Pat_Cons (elab_fv fv) None (Pulse.Common.map_dec p vs elab_sub_pat) | Pat_Dot_Term None -> R.Pat_Dot_Term None | Pat_Dot_Term (Some t) -> R.Pat_Dot_Term (Some (elab_term t)) and elab_sub_pat (pi : pattern & bool) : R.pattern & bool = let (p, i) = pi in elab_pat p, i let elab_pats (ps:list pattern) : Tot (list R.pattern) = L.map elab_pat ps let elab_st_comp (c:st_comp) : R.universe & R.term & R.term & R.term = let res = elab_term c.res in let pre = elab_term c.pre in let post = elab_term c.post in c.u, res, pre, post let elab_comp (c:comp) : R.term = match c with | C_Tot t -> elab_term t | C_ST c -> let u, res, pre, post = elab_st_comp c in mk_stt_comp u res pre (mk_abs res R.Q_Explicit post) | C_STAtomic inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_atomic_comp u res inames pre (mk_abs res R.Q_Explicit post) | C_STGhost inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_ghost_comp u res inames pre (mk_abs res R.Q_Explicit post) let elab_stt_equiv (g:R.env) (c:comp{C_ST? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST {u;res} = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c) =
false
false
Pulse.Elaborate.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 elab_stt_equiv (g: R.env) (c: comp{C_ST? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST { u = u ; res = res } = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c)
[]
Pulse.Elaborate.Pure.elab_stt_equiv
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: FStar.Reflection.Types.env -> c: Pulse.Syntax.Base.comp{C_ST? c} -> pre: FStar.Reflection.Types.term -> post: FStar.Reflection.Types.term -> eq_pre: FStar.Reflection.Typing.equiv g pre (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_pre c)) -> eq_post: FStar.Reflection.Typing.equiv g post (Pulse.Reflection.Util.mk_abs (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_res c) ) FStar.Reflection.V2.Data.Q_Explicit (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_post c))) -> FStar.Reflection.Typing.equiv g (let _ = c in (let Pulse.Syntax.Base.C_ST { u = u25 ; res = res ; pre = _ ; post = _ } = _ in Pulse.Reflection.Util.mk_stt_comp u25 (Pulse.Elaborate.Pure.elab_term res) pre post) <: FStar.Reflection.Types.term) (Pulse.Elaborate.Pure.elab_comp c)
{ "end_col": 48, "end_line": 124, "start_col": 2, "start_line": 121 }
Prims.Tot
val elab_statomic_equiv (g: R.env) (c: comp{C_STAtomic? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames { u = u ; res = res } = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c)
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_statomic_equiv (g:R.env) (c:comp{C_STAtomic? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames {u;res} = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) = let C_STAtomic inames _ = c in mk_stt_atomic_comp_equiv _ (comp_u c) (elab_term (comp_res c)) (elab_term inames) _ _ _ _ eq_pre eq_post
val elab_statomic_equiv (g: R.env) (c: comp{C_STAtomic? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames { u = u ; res = res } = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) let elab_statomic_equiv (g: R.env) (c: comp{C_STAtomic? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames { u = u ; res = res } = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) =
false
null
false
let C_STAtomic inames _ = c in mk_stt_atomic_comp_equiv _ (comp_u c) (elab_term (comp_res c)) (elab_term inames) _ _ _ _ eq_pre eq_post
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "FStar.Reflection.Types.env", "Pulse.Syntax.Base.comp", "Prims.b2t", "Pulse.Syntax.Base.uu___is_C_STAtomic", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.equiv", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.comp_pre", "Pulse.Reflection.Util.mk_abs", "Pulse.Syntax.Base.comp_res", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Syntax.Base.comp_post", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.st_comp", "Pulse.Reflection.Util.mk_stt_atomic_comp_equiv", "Pulse.Syntax.Base.comp_u", "Pulse.Syntax.Base.universe", "Pulse.Syntax.Base.vprop", "Pulse.Reflection.Util.mk_stt_atomic_comp", "Pulse.Elaborate.Pure.elab_comp" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t let rec elab_pat (p:pattern) : Tot R.pattern = let elab_fv (f:fv) : R.fv = R.pack_fv f.fv_name in match p with | Pat_Constant c -> R.Pat_Constant c | Pat_Var v ty -> R.Pat_Var RT.sort_default v | Pat_Cons fv vs -> R.Pat_Cons (elab_fv fv) None (Pulse.Common.map_dec p vs elab_sub_pat) | Pat_Dot_Term None -> R.Pat_Dot_Term None | Pat_Dot_Term (Some t) -> R.Pat_Dot_Term (Some (elab_term t)) and elab_sub_pat (pi : pattern & bool) : R.pattern & bool = let (p, i) = pi in elab_pat p, i let elab_pats (ps:list pattern) : Tot (list R.pattern) = L.map elab_pat ps let elab_st_comp (c:st_comp) : R.universe & R.term & R.term & R.term = let res = elab_term c.res in let pre = elab_term c.pre in let post = elab_term c.post in c.u, res, pre, post let elab_comp (c:comp) : R.term = match c with | C_Tot t -> elab_term t | C_ST c -> let u, res, pre, post = elab_st_comp c in mk_stt_comp u res pre (mk_abs res R.Q_Explicit post) | C_STAtomic inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_atomic_comp u res inames pre (mk_abs res R.Q_Explicit post) | C_STGhost inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_ghost_comp u res inames pre (mk_abs res R.Q_Explicit post) let elab_stt_equiv (g:R.env) (c:comp{C_ST? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST {u;res} = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c) = mk_stt_comp_equiv _ (comp_u c) (elab_term (comp_res c)) _ _ _ _ _ (RT.Rel_refl _ _ _) eq_pre eq_post let elab_statomic_equiv (g:R.env) (c:comp{C_STAtomic? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames {u;res} = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre
false
false
Pulse.Elaborate.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 elab_statomic_equiv (g: R.env) (c: comp{C_STAtomic? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames { u = u ; res = res } = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c)
[]
Pulse.Elaborate.Pure.elab_statomic_equiv
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: FStar.Reflection.Types.env -> c: Pulse.Syntax.Base.comp{C_STAtomic? c} -> pre: FStar.Reflection.Types.term -> post: FStar.Reflection.Types.term -> eq_pre: FStar.Reflection.Typing.equiv g pre (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_pre c)) -> eq_post: FStar.Reflection.Typing.equiv g post (Pulse.Reflection.Util.mk_abs (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_res c) ) FStar.Reflection.V2.Data.Q_Explicit (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_post c))) -> FStar.Reflection.Typing.equiv g (let _ = c in (let Pulse.Syntax.Base.C_STAtomic inames { u = u32 ; res = res ; pre = _ ; post = _ } = _ in Pulse.Reflection.Util.mk_stt_atomic_comp u32 (Pulse.Elaborate.Pure.elab_term res) (Pulse.Elaborate.Pure.elab_term inames) pre post) <: FStar.Reflection.Types.term) (Pulse.Elaborate.Pure.elab_comp c)
{ "end_col": 26, "end_line": 144, "start_col": 21, "start_line": 137 }
Prims.Tot
val elab_stghost_equiv (g: R.env) (c: comp{C_STGhost? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STGhost inames { u = u ; res = res } = c in mk_stt_ghost_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c)
[ { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": 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 elab_stghost_equiv (g:R.env) (c:comp{C_STGhost? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STGhost inames {u;res} = c in mk_stt_ghost_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) = let C_STGhost inames _ = c in mk_stt_ghost_comp_equiv _ (comp_u c) (elab_term (comp_res c)) (elab_term inames) _ _ _ _ eq_pre eq_post
val elab_stghost_equiv (g: R.env) (c: comp{C_STGhost? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STGhost inames { u = u ; res = res } = c in mk_stt_ghost_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) let elab_stghost_equiv (g: R.env) (c: comp{C_STGhost? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STGhost inames { u = u ; res = res } = c in mk_stt_ghost_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) =
false
null
false
let C_STGhost inames _ = c in mk_stt_ghost_comp_equiv _ (comp_u c) (elab_term (comp_res c)) (elab_term inames) _ _ _ _ eq_pre eq_post
{ "checked_file": "Pulse.Elaborate.Pure.fst.checked", "dependencies": [ "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Common.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Elaborate.Pure.fst" }
[ "total" ]
[ "FStar.Reflection.Types.env", "Pulse.Syntax.Base.comp", "Prims.b2t", "Pulse.Syntax.Base.uu___is_C_STGhost", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.equiv", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.comp_pre", "Pulse.Reflection.Util.mk_abs", "Pulse.Syntax.Base.comp_res", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Syntax.Base.comp_post", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.st_comp", "Pulse.Reflection.Util.mk_stt_ghost_comp_equiv", "Pulse.Syntax.Base.comp_u", "Pulse.Syntax.Base.universe", "Pulse.Syntax.Base.vprop", "Pulse.Reflection.Util.mk_stt_ghost_comp", "Pulse.Elaborate.Pure.elab_comp" ]
[]
module Pulse.Elaborate.Pure module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module RU = Pulse.RuntimeUtils open FStar.List.Tot open Pulse.Syntax.Base open Pulse.Reflection.Util let (let!) (f:option 'a) (g: 'a -> option 'b) : option 'b = match f with | None -> None | Some x -> g x let elab_qual = function | None -> R.Q_Explicit | Some Implicit -> R.Q_Implicit let rec elab_term (top:term) : R.term = let open R in let w t' = RU.set_range t' top.range in match top.t with | Tm_VProp -> w (pack_ln (Tv_FVar (pack_fv vprop_lid))) | Tm_Emp -> w (pack_ln (Tv_FVar (pack_fv emp_lid))) | Tm_Pure p -> let p = elab_term p in let head = pack_ln (Tv_FVar (pack_fv pure_lid)) in w (pack_ln (Tv_App head (p, Q_Explicit))) | Tm_Star l r -> let l = elab_term l in let r = elab_term r in w (mk_star l r) | Tm_ExistsSL u b body | Tm_ForallSL u b body -> let t = elab_term b.binder_ty in let body = elab_term body in let t = set_range_of t b.binder_ppname.range in if Tm_ExistsSL? top.t then w (mk_exists u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) else w (mk_forall u t (mk_abs_with_name_and_range b.binder_ppname.name b.binder_ppname.range t R.Q_Explicit body)) | Tm_Inames -> w (pack_ln (Tv_FVar (pack_fv inames_lid))) | Tm_EmpInames -> w (emp_inames_tm) | Tm_Unknown -> w (pack_ln R.Tv_Unknown) | Tm_FStar t -> w t let rec elab_pat (p:pattern) : Tot R.pattern = let elab_fv (f:fv) : R.fv = R.pack_fv f.fv_name in match p with | Pat_Constant c -> R.Pat_Constant c | Pat_Var v ty -> R.Pat_Var RT.sort_default v | Pat_Cons fv vs -> R.Pat_Cons (elab_fv fv) None (Pulse.Common.map_dec p vs elab_sub_pat) | Pat_Dot_Term None -> R.Pat_Dot_Term None | Pat_Dot_Term (Some t) -> R.Pat_Dot_Term (Some (elab_term t)) and elab_sub_pat (pi : pattern & bool) : R.pattern & bool = let (p, i) = pi in elab_pat p, i let elab_pats (ps:list pattern) : Tot (list R.pattern) = L.map elab_pat ps let elab_st_comp (c:st_comp) : R.universe & R.term & R.term & R.term = let res = elab_term c.res in let pre = elab_term c.pre in let post = elab_term c.post in c.u, res, pre, post let elab_comp (c:comp) : R.term = match c with | C_Tot t -> elab_term t | C_ST c -> let u, res, pre, post = elab_st_comp c in mk_stt_comp u res pre (mk_abs res R.Q_Explicit post) | C_STAtomic inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_atomic_comp u res inames pre (mk_abs res R.Q_Explicit post) | C_STGhost inames c -> let inames = elab_term inames in let u, res, pre, post = elab_st_comp c in mk_stt_ghost_comp u res inames pre (mk_abs res R.Q_Explicit post) let elab_stt_equiv (g:R.env) (c:comp{C_ST? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_ST {u;res} = c in mk_stt_comp u (elab_term res) pre post) (elab_comp c) = mk_stt_comp_equiv _ (comp_u c) (elab_term (comp_res c)) _ _ _ _ _ (RT.Rel_refl _ _ _) eq_pre eq_post let elab_statomic_equiv (g:R.env) (c:comp{C_STAtomic? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STAtomic inames {u;res} = c in mk_stt_atomic_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c) = let C_STAtomic inames _ = c in mk_stt_atomic_comp_equiv _ (comp_u c) (elab_term (comp_res c)) (elab_term inames) _ _ _ _ eq_pre eq_post let elab_stghost_equiv (g:R.env) (c:comp{C_STGhost? c}) (pre:R.term) (post:R.term) (eq_pre:RT.equiv g pre (elab_term (comp_pre c))) (eq_post:RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STGhost inames {u;res} = c in mk_stt_ghost_comp u (elab_term res) (elab_term inames) pre
false
false
Pulse.Elaborate.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 elab_stghost_equiv (g: R.env) (c: comp{C_STGhost? c}) (pre post: R.term) (eq_pre: RT.equiv g pre (elab_term (comp_pre c))) (eq_post: RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c)))) : RT.equiv g (let C_STGhost inames { u = u ; res = res } = c in mk_stt_ghost_comp u (elab_term res) (elab_term inames) pre post) (elab_comp c)
[]
Pulse.Elaborate.Pure.elab_stghost_equiv
{ "file_name": "lib/steel/pulse/Pulse.Elaborate.Pure.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: FStar.Reflection.Types.env -> c: Pulse.Syntax.Base.comp{C_STGhost? c} -> pre: FStar.Reflection.Types.term -> post: FStar.Reflection.Types.term -> eq_pre: FStar.Reflection.Typing.equiv g pre (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_pre c)) -> eq_post: FStar.Reflection.Typing.equiv g post (Pulse.Reflection.Util.mk_abs (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_res c) ) FStar.Reflection.V2.Data.Q_Explicit (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Base.comp_post c))) -> FStar.Reflection.Typing.equiv g (let _ = c in (let Pulse.Syntax.Base.C_STGhost inames { u = u38 ; res = res ; pre = _ ; post = _ } = _ in Pulse.Reflection.Util.mk_stt_ghost_comp u38 (Pulse.Elaborate.Pure.elab_term res) (Pulse.Elaborate.Pure.elab_term inames) pre post) <: FStar.Reflection.Types.term) (Pulse.Elaborate.Pure.elab_comp c)
{ "end_col": 26, "end_line": 164, "start_col": 21, "start_line": 157 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x)
let arrow (a: Type) (b: (a -> Type)) =
false
null
false
x: a -> Tot (b x)
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val arrow : a: Type -> b: (_: a -> Type) -> Type
[]
FStar.FunctionalExtensionality.arrow
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: (_: a -> Type) -> Type
{ "end_col": 56, "end_line": 41, "start_col": 39, "start_line": 41 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b)
let op_Hat_Subtraction_Greater (a b: Type) =
false
null
false
restricted_t a (fun _ -> b)
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.restricted_t" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *)
false
true
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Hat_Subtraction_Greater : a: Type -> b: Type -> Type
[]
FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: Type -> Type
{ "end_col": 72, "end_line": 111, "start_col": 45, "start_line": 111 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x)
let arrow_g (a: Type) (b: (a -> Type)) =
false
null
false
x: a -> GTot (b x)
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val arrow_g : a: Type -> b: (_: a -> Type) -> Type
[]
FStar.FunctionalExtensionality.arrow_g
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: (_: a -> Type) -> Type
{ "end_col": 59, "end_line": 139, "start_col": 41, "start_line": 139 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let efun (a: Type) (b: (a -> Type)) = arrow a b
let efun (a: Type) (b: (a -> Type)) =
false
null
false
arrow a b
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val efun : a: Type -> b: (_: a -> Type) -> Type
[]
FStar.FunctionalExtensionality.efun
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: (_: a -> Type) -> Type
{ "end_col": 47, "end_line": 45, "start_col": 38, "start_line": 45 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f}
let restricted_t (a: Type) (b: (a -> Type)) =
false
null
false
f: arrow a b {is_restricted a f}
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow", "FStar.FunctionalExtensionality.is_restricted" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b].
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val restricted_t : a: Type -> b: (_: a -> Type) -> Type
[]
FStar.FunctionalExtensionality.restricted_t
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: (_: a -> Type) -> Type
{ "end_col": 78, "end_line": 102, "start_col": 46, "start_line": 102 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f
let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) =
false
null
false
on_domain a f == f
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow", "Prims.eq2", "FStar.FunctionalExtensionality.on_domain", "Prims.logical" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g]
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_restricted : a: Type -> f: FStar.FunctionalExtensionality.arrow a b -> Prims.logical
[]
FStar.FunctionalExtensionality.is_restricted
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> f: FStar.FunctionalExtensionality.arrow a b -> Prims.logical
{ "end_col": 81, "end_line": 94, "start_col": 63, "start_line": 94 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b
let efun_g (a: Type) (b: (a -> Type)) =
false
null
false
arrow_g a b
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow_g" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val efun_g : a: Type -> b: (_: a -> Type) -> Type
[]
FStar.FunctionalExtensionality.efun_g
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: (_: a -> Type) -> Type
{ "end_col": 51, "end_line": 143, "start_col": 40, "start_line": 143 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x
let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) =
false
null
false
forall x. {:pattern (f x)\/(g x)} f x == g x
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow", "Prims.l_Forall", "Prims.eq2", "Prims.logical" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val feq : f: FStar.FunctionalExtensionality.arrow a b -> g: FStar.FunctionalExtensionality.arrow a b -> Prims.logical
[]
FStar.FunctionalExtensionality.feq
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
f: FStar.FunctionalExtensionality.arrow a b -> g: FStar.FunctionalExtensionality.arrow a b -> Prims.logical
{ "end_col": 100, "end_line": 48, "start_col": 56, "start_line": 48 }
Prims.Tot
val on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b)
[ { "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 on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b) = on_dom_g a f
val on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b) let on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b) =
false
null
false
on_dom_g a f
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.on_dom_g", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *) [@@ (deprecated "Use arrow_g instead")] let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b (** [feq_g #a #b f g]: pointwise equality of [f] and [g] on domain [a] **) let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** The counterpart of [on_domain] for ghost functions *) val on_domain_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Tot (arrow_g a b) (** [on_domain_g a f] is pointwise equal to [f] *) val feq_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (feq_g (on_domain_g a f) f) [SMTPat (on_domain_g a f)] (** on_domain_g is idempotent *) val idempotence_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (on_domain_g a (on_domain_g a f) == on_domain_g a f) [SMTPat (on_domain_g a (on_domain_g a f))] (** Counterpart of [is_restricted] for ghost functions *) let is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) = on_domain_g a f == f (** Counterpart of [restricted_t] for ghost functions *) let restricted_g_t (a: Type) (b: (a -> Type)) = f: arrow_g a b {is_restricted_g a f} (** [a ^->> b]: Notation for ghost, non-dependent restricted functions from [a] a to [b]. *) unfold let op_Hat_Subtraction_Greater_Greater (a b: Type) = restricted_g_t a (fun _ -> b) (** [on_dom_g a f]: A convenience function to introduce a restricted, ghost, dependent function *) unfold let on_dom_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : restricted_g_t a b = on_domain_g a f (** [on_g a f]: A convenience function to introduce a restricted, ghost, non-dependent function *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b)
[]
FStar.FunctionalExtensionality.on_g
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> f: (_: a -> Prims.GTot b) -> a ^->> b
{ "end_col": 68, "end_line": 185, "start_col": 56, "start_line": 185 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) = on_domain_g a f == f
let is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) =
false
null
false
on_domain_g a f == f
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow_g", "Prims.eq2", "FStar.FunctionalExtensionality.on_domain_g", "Prims.logical" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *) [@@ (deprecated "Use arrow_g instead")] let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b (** [feq_g #a #b f g]: pointwise equality of [f] and [g] on domain [a] **) let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** The counterpart of [on_domain] for ghost functions *) val on_domain_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Tot (arrow_g a b) (** [on_domain_g a f] is pointwise equal to [f] *) val feq_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (feq_g (on_domain_g a f) f) [SMTPat (on_domain_g a f)] (** on_domain_g is idempotent *) val idempotence_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (on_domain_g a (on_domain_g a f) == on_domain_g a f) [SMTPat (on_domain_g a (on_domain_g a f))]
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val is_restricted_g : a: Type -> f: FStar.FunctionalExtensionality.arrow_g a b -> Prims.logical
[]
FStar.FunctionalExtensionality.is_restricted_g
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> f: FStar.FunctionalExtensionality.arrow_g a b -> Prims.logical
{ "end_col": 87, "end_line": 162, "start_col": 67, "start_line": 162 }
Prims.Tot
val on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b)
[ { "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 on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f
val on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) =
false
null
false
on_dom a f
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.on_dom", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b)
[]
FStar.FunctionalExtensionality.on
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> f: (_: a -> b) -> a ^-> b
{ "end_col": 62, "end_line": 123, "start_col": 52, "start_line": 123 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let op_Hat_Subtraction_Greater_Greater (a b: Type) = restricted_g_t a (fun _ -> b)
let op_Hat_Subtraction_Greater_Greater (a b: Type) =
false
null
false
restricted_g_t a (fun _ -> b)
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.restricted_g_t" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *) [@@ (deprecated "Use arrow_g instead")] let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b (** [feq_g #a #b f g]: pointwise equality of [f] and [g] on domain [a] **) let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** The counterpart of [on_domain] for ghost functions *) val on_domain_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Tot (arrow_g a b) (** [on_domain_g a f] is pointwise equal to [f] *) val feq_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (feq_g (on_domain_g a f) f) [SMTPat (on_domain_g a f)] (** on_domain_g is idempotent *) val idempotence_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (on_domain_g a (on_domain_g a f) == on_domain_g a f) [SMTPat (on_domain_g a (on_domain_g a f))] (** Counterpart of [is_restricted] for ghost functions *) let is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) = on_domain_g a f == f (** Counterpart of [restricted_t] for ghost functions *) let restricted_g_t (a: Type) (b: (a -> Type)) = f: arrow_g a b {is_restricted_g a f} (** [a ^->> b]: Notation for ghost, non-dependent restricted functions from [a] a to [b]. *)
false
true
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Hat_Subtraction_Greater_Greater : a: Type -> b: Type -> Type
[]
FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: Type -> Type
{ "end_col": 82, "end_line": 173, "start_col": 53, "start_line": 173 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let restricted_g_t (a: Type) (b: (a -> Type)) = f: arrow_g a b {is_restricted_g a f}
let restricted_g_t (a: Type) (b: (a -> Type)) =
false
null
false
f: arrow_g a b {is_restricted_g a f}
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow_g", "FStar.FunctionalExtensionality.is_restricted_g" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *) [@@ (deprecated "Use arrow_g instead")] let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b (** [feq_g #a #b f g]: pointwise equality of [f] and [g] on domain [a] **) let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** The counterpart of [on_domain] for ghost functions *) val on_domain_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Tot (arrow_g a b) (** [on_domain_g a f] is pointwise equal to [f] *) val feq_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (feq_g (on_domain_g a f) f) [SMTPat (on_domain_g a f)] (** on_domain_g is idempotent *) val idempotence_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (on_domain_g a (on_domain_g a f) == on_domain_g a f) [SMTPat (on_domain_g a (on_domain_g a f))] (** Counterpart of [is_restricted] for ghost functions *) let is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) = on_domain_g a f == f
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val restricted_g_t : a: Type -> b: (_: a -> Type) -> Type
[]
FStar.FunctionalExtensionality.restricted_g_t
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> b: (_: a -> Type) -> Type
{ "end_col": 84, "end_line": 165, "start_col": 48, "start_line": 165 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) = forall x. {:pattern (f x)\/(g x)} f x == g x
let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) =
false
null
false
forall x. {:pattern (f x)\/(g x)} f x == g x
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow_g", "Prims.l_Forall", "Prims.eq2", "Prims.logical" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *) [@@ (deprecated "Use arrow_g instead")] let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b (** [feq_g #a #b f g]: pointwise equality of [f] and [g] on domain [a] **)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val feq_g : f: FStar.FunctionalExtensionality.arrow_g a b -> g: FStar.FunctionalExtensionality.arrow_g a b -> Prims.logical
[]
FStar.FunctionalExtensionality.feq_g
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
f: FStar.FunctionalExtensionality.arrow_g a b -> g: FStar.FunctionalExtensionality.arrow_g a b -> Prims.logical
{ "end_col": 46, "end_line": 147, "start_col": 2, "start_line": 147 }
Prims.Tot
val on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b
[ { "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 on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f
val on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b =
false
null
false
on_domain a f
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow", "FStar.FunctionalExtensionality.on_domain", "FStar.FunctionalExtensionality.restricted_t" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b
[]
FStar.FunctionalExtensionality.on_dom
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> f: FStar.FunctionalExtensionality.arrow a b -> FStar.FunctionalExtensionality.restricted_t a b
{ "end_col": 88, "end_line": 117, "start_col": 75, "start_line": 117 }
Prims.Tot
val on_dom_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : restricted_g_t a b
[ { "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 on_dom_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : restricted_g_t a b = on_domain_g a f
val on_dom_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : restricted_g_t a b let on_dom_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : restricted_g_t a b =
false
null
false
on_domain_g a f
{ "checked_file": "FStar.FunctionalExtensionality.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.FunctionalExtensionality.fsti" }
[ "total" ]
[ "FStar.FunctionalExtensionality.arrow_g", "FStar.FunctionalExtensionality.on_domain_g", "FStar.FunctionalExtensionality.restricted_g_t" ]
[]
(* 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.FunctionalExtensionality /// Functional extensionality asserts the equality of pointwise-equal /// functions. /// /// The formulation of this axiom is particularly subtle in F* because /// of its interaction with subtyping. In fact, prior formulations of /// this axiom were discovered to be unsound by Aseem Rastogi. /// /// The predicate [feq #a #b f g] asserts that [f, g: x:a -> (b x)] are /// pointwise equal on the domain [a]. /// /// However, due to subtyping [f] and [g] may also be defined on some /// domain larger than [a]. We need to be careful to ensure that merely /// proving [f] and [g] equal on their sub-domain [a] does not lead us /// to conclude that they are equal everywhere. /// /// For more context on how functional extensionality works in F*, see /// 1. tests/micro-benchmarks/Test.FunctionalExtensionality.fst /// 2. ulib/FStar.Map.fst and ulib/FStar.Map.fsti /// 3. Issue #1542 on github.com/FStarLang/FStar/issues/1542 (** The type of total, dependent functions *) unfold let arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x) (** Using [arrow] instead *) [@@ (deprecated "Use arrow instead")] let efun (a: Type) (b: (a -> Type)) = arrow a b (** feq #a #b f g: pointwise equality of [f] and [g] on domain [a] *) let feq (#a: Type) (#b: (a -> Type)) (f g: arrow a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** [on_domain a f]: This is a key function provided by the module. It has several features. 1. Intuitively, [on_domain a f] can be seen as a function whose maximal domain is [a]. 2. While, [on_domain a f] is proven to be *pointwise* equal to [f], crucially it is not provably equal to [f], since [f] may actually have a domain larger than [a]. 3. [on_domain] is idempotent 4. [on_domain a f x] has special treatment in F*'s normalizer. It reduces to [f x], reflecting the pointwise equality of [on_domain a f] and [f]. 5. [on_domain] is marked [inline_for_extraction], to eliminate the overhead of an indirection in extracted code. (This feature will be exercised as part of cross-module inlining across interface boundaries) *) inline_for_extraction val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b) (** feq_on_domain: [on_domain a f] is pointwise equal to [f] *) val feq_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (feq (on_domain a f) f) [SMTPat (on_domain a f)] (** on_domain is idempotent *) val idempotence_on_domain (#a: Type) (#b: (a -> Type)) (f: arrow a b) : Lemma (on_domain a (on_domain a f) == on_domain a f) [SMTPat (on_domain a (on_domain a f))] (** [is_restricted a f]: Though stated indirectly, [is_restricted a f] is valid when [f] is a function whose maximal domain is equal to [a]. Equivalently, one may see its definition as [exists g. f == on_domain a g] *) let is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f (** restricted_t a b: Lifts the [is_restricted] predicate into a refinement type This is the type of functions whose maximal domain is [a] and whose (dependent) co-domain is [b]. *) let restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f} (** [a ^-> b]: Notation for non-dependent restricted functions from [a] to [b]. The first symbol [^] makes it right associative, as expected for arrows. *) unfold let op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b) (** [on_dom a f]: A convenience function to introduce a restricted, dependent function *) unfold let on_dom (a: Type) (#b: (a -> Type)) (f: arrow a b) : restricted_t a b = on_domain a f (** [on a f]: A convenience function to introduce a restricted, non-dependent function *) unfold let on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f (**** MAIN AXIOM *) (** [extensionality]: The main axiom of this module states that functions [f] and [g] that are pointwise equal on domain [a] are provably equal when restricted to [a] *) val extensionality (a: Type) (b: (a -> Type)) (f g: arrow a b) : Lemma (ensures (feq #a #b f g <==> on_domain a f == on_domain a g)) [SMTPat (feq #a #b f g)] (**** DUPLICATED FOR GHOST FUNCTIONS *) (** The type of ghost, total, dependent functions *) unfold let arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x) (** Use [arrow_g] instead *) [@@ (deprecated "Use arrow_g instead")] let efun_g (a: Type) (b: (a -> Type)) = arrow_g a b (** [feq_g #a #b f g]: pointwise equality of [f] and [g] on domain [a] **) let feq_g (#a: Type) (#b: (a -> Type)) (f g: arrow_g a b) = forall x. {:pattern (f x)\/(g x)} f x == g x (** The counterpart of [on_domain] for ghost functions *) val on_domain_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Tot (arrow_g a b) (** [on_domain_g a f] is pointwise equal to [f] *) val feq_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (feq_g (on_domain_g a f) f) [SMTPat (on_domain_g a f)] (** on_domain_g is idempotent *) val idempotence_on_domain_g (#a: Type) (#b: (a -> Type)) (f: arrow_g a b) : Lemma (on_domain_g a (on_domain_g a f) == on_domain_g a f) [SMTPat (on_domain_g a (on_domain_g a f))] (** Counterpart of [is_restricted] for ghost functions *) let is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) = on_domain_g a f == f (** Counterpart of [restricted_t] for ghost functions *) let restricted_g_t (a: Type) (b: (a -> Type)) = f: arrow_g a b {is_restricted_g a f} (** [a ^->> b]: Notation for ghost, non-dependent restricted functions from [a] a to [b]. *) unfold let op_Hat_Subtraction_Greater_Greater (a b: Type) = restricted_g_t a (fun _ -> b) (** [on_dom_g a f]: A convenience function to introduce a restricted, ghost, dependent function *)
false
false
FStar.FunctionalExtensionality.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val on_dom_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) : restricted_g_t a b
[]
FStar.FunctionalExtensionality.on_dom_g
{ "file_name": "ulib/FStar.FunctionalExtensionality.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: Type -> f: FStar.FunctionalExtensionality.arrow_g a b -> FStar.FunctionalExtensionality.restricted_g_t a b
{ "end_col": 96, "end_line": 179, "start_col": 81, "start_line": 179 }
Prims.Tot
[ { "abbrev": false, "full_module": "Steel.ST.Util", "short_module": null }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let u32_between (s f:US.t) = x:US.t { US.v s <= US.v x /\ US.v x < US.v f}
let u32_between (s f: US.t) =
false
null
false
x: US.t{US.v s <= US.v x /\ US.v x < US.v f}
{ "checked_file": "Steel.ST.Loops.fsti.checked", "dependencies": [ "Steel.ST.Util.fsti.checked", "prims.fst.checked", "FStar.SizeT.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Steel.ST.Loops.fsti" }
[ "total" ]
[ "FStar.SizeT.t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.SizeT.v", "Prims.op_LessThan" ]
[]
(* Copyright 2021 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.ST.Loops module US = FStar.SizeT open Steel.ST.Util (* This module provides some common iterative looping combinators *) let nat_at_most (f:US.t) = x:nat{ x <= US.v f }
false
true
Steel.ST.Loops.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val u32_between : s: FStar.SizeT.t -> f: FStar.SizeT.t -> Type0
[]
Steel.ST.Loops.u32_between
{ "file_name": "lib/steel/Steel.ST.Loops.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
s: FStar.SizeT.t -> f: FStar.SizeT.t -> Type0
{ "end_col": 49, "end_line": 26, "start_col": 4, "start_line": 26 }
Prims.Tot
[ { "abbrev": false, "full_module": "Steel.ST.Util", "short_module": null }, { "abbrev": true, "full_module": "FStar.SizeT", "short_module": "US" }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let nat_at_most (f:US.t) = x:nat{ x <= US.v f }
let nat_at_most (f: US.t) =
false
null
false
x: nat{x <= US.v f}
{ "checked_file": "Steel.ST.Loops.fsti.checked", "dependencies": [ "Steel.ST.Util.fsti.checked", "prims.fst.checked", "FStar.SizeT.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Steel.ST.Loops.fsti" }
[ "total" ]
[ "FStar.SizeT.t", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.SizeT.v" ]
[]
(* Copyright 2021 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Steel.ST.Loops module US = FStar.SizeT open Steel.ST.Util (* This module provides some common iterative looping combinators *)
false
true
Steel.ST.Loops.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val nat_at_most : f: FStar.SizeT.t -> Type0
[]
Steel.ST.Loops.nat_at_most
{ "file_name": "lib/steel/Steel.ST.Loops.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
f: FStar.SizeT.t -> Type0
{ "end_col": 24, "end_line": 23, "start_col": 4, "start_line": 23 }
FStar.Tactics.Effect.Tac
val forall_maybe_enum_key_unknown_tac: Prims.unit -> T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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_maybe_enum_key_unknown_tac () : T.Tac unit = let open T in let x = intro () in norm [delta; iota; zeta; primops]; trivial (); qed ()
val forall_maybe_enum_key_unknown_tac: Prims.unit -> T.Tac unit let forall_maybe_enum_key_unknown_tac () : T.Tac unit =
true
null
false
let open T in let x = intro () in norm [delta; iota; zeta; primops]; trivial (); qed ()
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "Prims.unit", "FStar.Tactics.V1.Derived.qed", "FStar.Tactics.V1.Derived.trivial", "FStar.Tactics.V1.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta", "FStar.Pervasives.iota", "FStar.Pervasives.zeta", "FStar.Pervasives.primops", "Prims.Nil", "FStar.Reflection.Types.binder", "FStar.Tactics.V1.Builtins.intro" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate // let apply (t:T.term) : T.Tac unit = T.t_apply true false true t noextract let rec enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [ T.solve_vc; T.solve_vc; ]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [ T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_); ]; T.qed () noextract let maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote maybe_enum_key_of_repr'_t_cons_nil') (quote maybe_enum_key_of_repr'_t_cons') e noextract let enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote enum_repr_of_key_cons_nil') (quote enum_repr_of_key_cons') e noextract let synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit = let open T in destruct (quote x); to_all_goals (fun () -> let breq = intros_until_squash () in rewrite breq; norm [delta; iota; zeta; primops]; trivial (); qed () ); qed () noextract let forall_maybe_enum_key_known_tac () : T.Tac unit = let open T in norm [delta; iota; zeta; primops]; trivial (); qed () noextract
false
false
LowParse.Spec.Tac.Enum.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_maybe_enum_key_unknown_tac: Prims.unit -> T.Tac unit
[]
LowParse.Spec.Tac.Enum.forall_maybe_enum_key_unknown_tac
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 12, "end_line": 84, "start_col": 6, "start_line": 80 }
FStar.Tactics.Effect.Tac
val forall_maybe_enum_key_known_tac: Prims.unit -> T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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_maybe_enum_key_known_tac () : T.Tac unit = let open T in norm [delta; iota; zeta; primops]; trivial (); qed ()
val forall_maybe_enum_key_known_tac: Prims.unit -> T.Tac unit let forall_maybe_enum_key_known_tac () : T.Tac unit =
true
null
false
let open T in norm [delta; iota; zeta; primops]; trivial (); qed ()
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "Prims.unit", "FStar.Tactics.V1.Derived.qed", "FStar.Tactics.V1.Derived.trivial", "FStar.Tactics.V1.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta", "FStar.Pervasives.iota", "FStar.Pervasives.zeta", "FStar.Pervasives.primops", "Prims.Nil" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate // let apply (t:T.term) : T.Tac unit = T.t_apply true false true t noextract let rec enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [ T.solve_vc; T.solve_vc; ]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [ T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_); ]; T.qed () noextract let maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote maybe_enum_key_of_repr'_t_cons_nil') (quote maybe_enum_key_of_repr'_t_cons') e noextract let enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote enum_repr_of_key_cons_nil') (quote enum_repr_of_key_cons') e noextract let synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit = let open T in destruct (quote x); to_all_goals (fun () -> let breq = intros_until_squash () in rewrite breq; norm [delta; iota; zeta; primops]; trivial (); qed () ); qed () noextract
false
false
LowParse.Spec.Tac.Enum.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_maybe_enum_key_known_tac: Prims.unit -> T.Tac unit
[]
LowParse.Spec.Tac.Enum.forall_maybe_enum_key_known_tac
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 12, "end_line": 76, "start_col": 6, "start_line": 73 }
FStar.Tactics.Effect.Tac
val apply (t: T.term) : T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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 apply (t:T.term) : T.Tac unit = T.t_apply true false true t
val apply (t: T.term) : T.Tac unit let apply (t: T.term) : T.Tac unit =
true
null
false
T.t_apply true false true t
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "FStar.Reflection.Types.term", "FStar.Tactics.V1.Builtins.t_apply", "Prims.unit" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate //
false
false
LowParse.Spec.Tac.Enum.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 apply (t: T.term) : T.Tac unit
[]
LowParse.Spec.Tac.Enum.apply
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
t: FStar.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 29, "end_line": 18, "start_col": 2, "start_line": 18 }
FStar.Tactics.Effect.Tac
val maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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 maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote maybe_enum_key_of_repr'_t_cons_nil') (quote maybe_enum_key_of_repr'_t_cons') e
val maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit let maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit =
true
null
false
enum_tac_gen (quote maybe_enum_key_of_repr'_t_cons_nil') (quote maybe_enum_key_of_repr'_t_cons') e
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "Prims.list", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Tac.Enum.enum_tac_gen", "Prims.unit", "FStar.Reflection.Types.term", "LowParse.Spec.Enum.maybe_enum_key_of_repr'_t_cons'", "LowParse.Spec.Enum.maybe_enum_key_of_repr'_t_cons_nil'" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate // let apply (t:T.term) : T.Tac unit = T.t_apply true false true t noextract let rec enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [ T.solve_vc; T.solve_vc; ]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [ T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_); ]; T.qed () noextract let maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr))
false
false
LowParse.Spec.Tac.Enum.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 maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit
[]
LowParse.Spec.Tac.Enum.maybe_enum_key_of_repr_tac
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
e: Prims.list (key * repr) -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 100, "end_line": 49, "start_col": 2, "start_line": 49 }
FStar.Tactics.Effect.Tac
val enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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 enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote enum_repr_of_key_cons_nil') (quote enum_repr_of_key_cons') e
val enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit let enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit =
true
null
false
enum_tac_gen (quote enum_repr_of_key_cons_nil') (quote enum_repr_of_key_cons') e
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "Prims.list", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Tac.Enum.enum_tac_gen", "Prims.unit", "FStar.Reflection.Types.term", "LowParse.Spec.Enum.enum_repr_of_key_cons'", "LowParse.Spec.Enum.enum_repr_of_key_cons_nil'" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate // let apply (t:T.term) : T.Tac unit = T.t_apply true false true t noextract let rec enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [ T.solve_vc; T.solve_vc; ]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [ T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_); ]; T.qed () noextract let maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote maybe_enum_key_of_repr'_t_cons_nil') (quote maybe_enum_key_of_repr'_t_cons') e noextract let enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr))
false
false
LowParse.Spec.Tac.Enum.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 enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit
[]
LowParse.Spec.Tac.Enum.enum_repr_of_key_tac
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
e: Prims.list (key * repr) -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 82, "end_line": 56, "start_col": 2, "start_line": 56 }
FStar.Tactics.Effect.Tac
val synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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 synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit = let open T in destruct (quote x); to_all_goals (fun () -> let breq = intros_until_squash () in rewrite breq; norm [delta; iota; zeta; primops]; trivial (); qed () ); qed ()
val synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit let synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit =
true
null
false
let open T in destruct (quote x); to_all_goals (fun () -> let breq = intros_until_squash () in rewrite breq; norm [delta; iota; zeta; primops]; trivial (); qed ()); qed ()
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "FStar.Tactics.V1.Derived.qed", "Prims.unit", "LowParse.TacLib.to_all_goals", "FStar.Tactics.V1.Derived.trivial", "FStar.Tactics.V1.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta", "FStar.Pervasives.iota", "FStar.Pervasives.zeta", "FStar.Pervasives.primops", "Prims.Nil", "FStar.Tactics.V1.Builtins.rewrite", "FStar.Reflection.Types.binder", "LowParse.TacLib.intros_until_squash", "FStar.Tactics.V1.Derived.destruct", "FStar.Reflection.Types.term" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate // let apply (t:T.term) : T.Tac unit = T.t_apply true false true t noextract let rec enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [ T.solve_vc; T.solve_vc; ]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [ T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_); ]; T.qed () noextract let maybe_enum_key_of_repr_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote maybe_enum_key_of_repr'_t_cons_nil') (quote maybe_enum_key_of_repr'_t_cons') e noextract let enum_repr_of_key_tac (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = enum_tac_gen (quote enum_repr_of_key_cons_nil') (quote enum_repr_of_key_cons') e noextract
false
false
LowParse.Spec.Tac.Enum.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 synth_maybe_enum_key_inv_unknown_tac (#key: Type) (x: key) : T.Tac unit
[]
LowParse.Spec.Tac.Enum.synth_maybe_enum_key_inv_unknown_tac
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
x: key -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 10, "end_line": 69, "start_col": 2, "start_line": 60 }
FStar.Tactics.Effect.Tac
val enum_tac_gen (t_cons_nil t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit
[ { "abbrev": true, "full_module": "LowParse.TacLib", "short_module": "T" }, { "abbrev": false, "full_module": "LowParse.Spec.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Tac", "short_module": null }, { "abbrev": 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 enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit = match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [ T.solve_vc; T.solve_vc; ]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [ T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_); ]; T.qed ()
val enum_tac_gen (t_cons_nil t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit let rec enum_tac_gen (t_cons_nil t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit =
true
null
false
match e with | [] -> T.fail "enum_tac_gen: e must be cons" | [_] -> apply t_cons_nil; T.iseq [T.solve_vc; T.solve_vc]; T.qed () | _ :: e_ -> apply t_cons; T.iseq [T.solve_vc; (fun () -> enum_tac_gen t_cons_nil t_cons e_)]; T.qed ()
{ "checked_file": "LowParse.Spec.Tac.Enum.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.TacLib.fst.checked", "LowParse.Spec.Enum.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.Tac.Enum.fst" }
[]
[ "FStar.Reflection.Types.term", "Prims.list", "FStar.Pervasives.Native.tuple2", "FStar.Tactics.V1.Derived.fail", "Prims.unit", "FStar.Tactics.V1.Derived.qed", "FStar.Tactics.V1.Derived.iseq", "Prims.Cons", "LowParse.TacLib.solve_vc", "Prims.Nil", "LowParse.Spec.Tac.Enum.apply", "LowParse.Spec.Tac.Enum.enum_tac_gen" ]
[]
module LowParse.Spec.Tac.Enum include LowParse.Spec.Enum module T = LowParse.TacLib // // The enum tactic solves goals of type ?u:eqtype with enum types that are // in the environment at type Type0 // So typechecking such uvars fails since F* 2635 bug fix // (since uvar solutions are checked with smt off) // // To circumvent that, we use t_apply with tc_resolve_uvars flag on, // so that ?u will be typechecked as soon as it is resolved, // resulting in an smt guard that will be added to the proofstate // let apply (t:T.term) : T.Tac unit = T.t_apply true false true t noextract let rec enum_tac_gen (t_cons_nil: T.term) (t_cons: T.term) (#key #repr: Type) (e: list (key * repr))
false
false
LowParse.Spec.Tac.Enum.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 enum_tac_gen (t_cons_nil t_cons: T.term) (#key #repr: Type) (e: list (key * repr)) : T.Tac unit
[ "recursion" ]
LowParse.Spec.Tac.Enum.enum_tac_gen
{ "file_name": "src/lowparse/LowParse.Spec.Tac.Enum.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
t_cons_nil: FStar.Reflection.Types.term -> t_cons: FStar.Reflection.Types.term -> e: Prims.list (key * repr) -> FStar.Tactics.Effect.Tac Prims.unit
{ "end_col": 12, "end_line": 42, "start_col": 2, "start_line": 27 }
Prims.Tot
[ { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": 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 vec_t4 (t:v_inttype) = vec_t t 4 & vec_t t 4 & vec_t t 4 & vec_t t 4
let vec_t4 (t: v_inttype) =
false
null
false
vec_t t 4 & vec_t t 4 & vec_t t 4 & vec_t t 4
{ "checked_file": "Lib.IntVector.Transpose.fsti.checked", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.IntVector.Transpose.fsti" }
[ "total" ]
[ "Lib.IntVector.v_inttype", "FStar.Pervasives.Native.tuple4", "Lib.IntVector.vec_t" ]
[]
module Lib.IntVector.Transpose open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.IntVector #set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
false
true
Lib.IntVector.Transpose.fsti
{ "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 vec_t4 : t: Lib.IntVector.v_inttype -> Type0
[]
Lib.IntVector.Transpose.vec_t4
{ "file_name": "lib/Lib.IntVector.Transpose.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
t: Lib.IntVector.v_inttype -> Type0
{ "end_col": 72, "end_line": 11, "start_col": 27, "start_line": 11 }
Prims.Tot
[ { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": 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 vec_t8 (t:v_inttype) = vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8
let vec_t8 (t: v_inttype) =
false
null
false
vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8
{ "checked_file": "Lib.IntVector.Transpose.fsti.checked", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.IntVector.Transpose.fsti" }
[ "total" ]
[ "Lib.IntVector.v_inttype", "FStar.Pervasives.Native.tuple8", "Lib.IntVector.vec_t" ]
[]
module Lib.IntVector.Transpose open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.IntVector #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction let vec_t4 (t:v_inttype) = vec_t t 4 & vec_t t 4 & vec_t t 4 & vec_t t 4
false
true
Lib.IntVector.Transpose.fsti
{ "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 vec_t8 : t: Lib.IntVector.v_inttype -> Type0
[]
Lib.IntVector.Transpose.vec_t8
{ "file_name": "lib/Lib.IntVector.Transpose.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
t: Lib.IntVector.v_inttype -> Type0
{ "end_col": 120, "end_line": 14, "start_col": 27, "start_line": 14 }
Prims.Tot
val transpose4x4_lseq (#t: v_inttype{t = U32 \/ t = U64}) (vs: lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4
[ { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": 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 transpose4x4_lseq (#t:v_inttype{t = U32 \/ t = U64}) (vs:lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4 = let (v0,v1,v2,v3) = (vs.[0],vs.[1],vs.[2],vs.[3]) in let (r0,r1,r2,r3) = transpose4x4 (v0,v1,v2,v3) in create4 r0 r1 r2 r3
val transpose4x4_lseq (#t: v_inttype{t = U32 \/ t = U64}) (vs: lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4 let transpose4x4_lseq (#t: v_inttype{t = U32 \/ t = U64}) (vs: lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4 =
false
null
false
let v0, v1, v2, v3 = (vs.[ 0 ], vs.[ 1 ], vs.[ 2 ], vs.[ 3 ]) in let r0, r1, r2, r3 = transpose4x4 (v0, v1, v2, v3) in create4 r0 r1 r2 r3
{ "checked_file": "Lib.IntVector.Transpose.fsti.checked", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.IntVector.Transpose.fsti" }
[ "total" ]
[ "Lib.IntVector.v_inttype", "Prims.l_or", "Prims.b2t", "Prims.op_Equality", "Lib.IntTypes.inttype", "Lib.IntTypes.U32", "Lib.IntTypes.U64", "Lib.Sequence.lseq", "Lib.IntVector.vec_t", "Lib.Sequence.create4", "Lib.IntVector.Transpose.vec_t4", "Lib.IntVector.Transpose.transpose4x4", "FStar.Pervasives.Native.Mktuple4", "FStar.Pervasives.Native.tuple4", "Lib.Sequence.op_String_Access" ]
[]
module Lib.IntVector.Transpose open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.IntVector #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction let vec_t4 (t:v_inttype) = vec_t t 4 & vec_t t 4 & vec_t t 4 & vec_t t 4 inline_for_extraction let vec_t8 (t:v_inttype) = vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 inline_for_extraction val transpose4x4: #t:v_inttype{t = U32 \/ t = U64} -> vec_t4 t -> vec_t4 t inline_for_extraction val transpose8x8: #t:v_inttype{t = U32} -> vec_t8 t -> vec_t8 t
false
false
Lib.IntVector.Transpose.fsti
{ "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 transpose4x4_lseq (#t: v_inttype{t = U32 \/ t = U64}) (vs: lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4
[]
Lib.IntVector.Transpose.transpose4x4_lseq
{ "file_name": "lib/Lib.IntVector.Transpose.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
vs: Lib.Sequence.lseq (Lib.IntVector.vec_t t 4) 4 -> Lib.Sequence.lseq (Lib.IntVector.vec_t t 4) 4
{ "end_col": 21, "end_line": 28, "start_col": 103, "start_line": 25 }
Prims.Tot
val transpose8x8_lseq (#t: v_inttype{t = U32}) (vs: lseq (vec_t t 8) 8) : lseq (vec_t t 8) 8
[ { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": 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 transpose8x8_lseq (#t:v_inttype{t = U32}) (vs:lseq (vec_t t 8) 8) : lseq (vec_t t 8) 8 = let (v0,v1,v2,v3,v4,v5,v6,v7) = (vs.[0],vs.[1],vs.[2],vs.[3],vs.[4],vs.[5],vs.[6],vs.[7]) in let (r0,r1,r2,r3,r4,r5,r6,r7) = transpose8x8 (v0,v1,v2,v3,v4,v5,v6,v7) in create8 r0 r1 r2 r3 r4 r5 r6 r7
val transpose8x8_lseq (#t: v_inttype{t = U32}) (vs: lseq (vec_t t 8) 8) : lseq (vec_t t 8) 8 let transpose8x8_lseq (#t: v_inttype{t = U32}) (vs: lseq (vec_t t 8) 8) : lseq (vec_t t 8) 8 =
false
null
false
let v0, v1, v2, v3, v4, v5, v6, v7 = (vs.[ 0 ], vs.[ 1 ], vs.[ 2 ], vs.[ 3 ], vs.[ 4 ], vs.[ 5 ], vs.[ 6 ], vs.[ 7 ]) in let r0, r1, r2, r3, r4, r5, r6, r7 = transpose8x8 (v0, v1, v2, v3, v4, v5, v6, v7) in create8 r0 r1 r2 r3 r4 r5 r6 r7
{ "checked_file": "Lib.IntVector.Transpose.fsti.checked", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.IntVector.Transpose.fsti" }
[ "total" ]
[ "Lib.IntVector.v_inttype", "Prims.b2t", "Prims.op_Equality", "Lib.IntTypes.inttype", "Lib.IntTypes.U32", "Lib.Sequence.lseq", "Lib.IntVector.vec_t", "Lib.Sequence.create8", "Lib.IntVector.Transpose.vec_t8", "Lib.IntVector.Transpose.transpose8x8", "FStar.Pervasives.Native.Mktuple8", "FStar.Pervasives.Native.tuple8", "Lib.Sequence.op_String_Access" ]
[]
module Lib.IntVector.Transpose open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.IntVector #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction let vec_t4 (t:v_inttype) = vec_t t 4 & vec_t t 4 & vec_t t 4 & vec_t t 4 inline_for_extraction let vec_t8 (t:v_inttype) = vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 & vec_t t 8 inline_for_extraction val transpose4x4: #t:v_inttype{t = U32 \/ t = U64} -> vec_t4 t -> vec_t4 t inline_for_extraction val transpose8x8: #t:v_inttype{t = U32} -> vec_t8 t -> vec_t8 t inline_for_extraction let transpose4x4_lseq (#t:v_inttype{t = U32 \/ t = U64}) (vs:lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4 = let (v0,v1,v2,v3) = (vs.[0],vs.[1],vs.[2],vs.[3]) in let (r0,r1,r2,r3) = transpose4x4 (v0,v1,v2,v3) in create4 r0 r1 r2 r3
false
false
Lib.IntVector.Transpose.fsti
{ "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 transpose8x8_lseq (#t: v_inttype{t = U32}) (vs: lseq (vec_t t 8) 8) : lseq (vec_t t 8) 8
[]
Lib.IntVector.Transpose.transpose8x8_lseq
{ "file_name": "lib/Lib.IntVector.Transpose.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
vs: Lib.Sequence.lseq (Lib.IntVector.vec_t t 8) 8 -> Lib.Sequence.lseq (Lib.IntVector.vec_t t 8) 8
{ "end_col": 33, "end_line": 34, "start_col": 92, "start_line": 31 }
Prims.Pure
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 fail_parser = tot_fail_parser
let fail_parser =
false
null
false
tot_fail_parser
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[]
[ "LowParse.Spec.Combinators.tot_fail_parser" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base
false
false
LowParse.Tot.Combinators.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 fail_parser : k: LowParse.Spec.Base.parser_kind -> t: Type -> Prims.Pure (LowParse.Spec.Base.tot_parser k t)
[]
LowParse.Tot.Combinators.fail_parser
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
k: LowParse.Spec.Base.parser_kind -> t: Type -> Prims.Pure (LowParse.Spec.Base.tot_parser k t)
{ "end_col": 33, "end_line": 6, "start_col": 18, "start_line": 6 }
Prims.Tot
val parse_empty:parser parse_ret_kind unit
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_empty : parser parse_ret_kind unit = parse_ret ()
val parse_empty:parser parse_ret_kind unit let parse_empty:parser parse_ret_kind unit =
false
null
false
parse_ret ()
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Tot.Combinators.parse_ret", "Prims.unit" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction
false
true
LowParse.Tot.Combinators.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 parse_empty:parser parse_ret_kind unit
[]
LowParse.Tot.Combinators.parse_empty
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
LowParse.Tot.Base.parser LowParse.Spec.Combinators.parse_ret_kind Prims.unit
{ "end_col": 14, "end_line": 13, "start_col": 2, "start_line": 13 }
Prims.Tot
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_ret = tot_parse_ret
let parse_ret =
false
null
false
tot_parse_ret
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Combinators.tot_parse_ret", "LowParse.Spec.Base.tot_parser", "LowParse.Spec.Combinators.parse_ret_kind" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser
false
false
LowParse.Tot.Combinators.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 parse_ret : v: _ -> LowParse.Spec.Base.tot_parser LowParse.Spec.Combinators.parse_ret_kind _
[]
LowParse.Tot.Combinators.parse_ret
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
v: _ -> LowParse.Spec.Base.tot_parser LowParse.Spec.Combinators.parse_ret_kind _
{ "end_col": 29, "end_line": 9, "start_col": 16, "start_line": 9 }
Prims.Tot
val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t)
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t
val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t =
false
null
false
tot_parse_tagged_union #kt #tag_t
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.tot_parse_tagged_union", "LowParse.Tot.Base.parser", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.Combinators.and_then_kind" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t)
false
false
LowParse.Tot.Combinators.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 parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t)
[]
LowParse.Tot.Combinators.parse_tagged_union
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
pt: LowParse.Tot.Base.parser kt tag_t -> tag_of_data: (_: data_t -> tag_t) -> p: (t: tag_t -> LowParse.Tot.Base.parser k (LowParse.Spec.Base.refine_with_tag tag_of_data t)) -> LowParse.Tot.Base.parser (LowParse.Spec.Combinators.and_then_kind kt k) data_t
{ "end_col": 69, "end_line": 126, "start_col": 36, "start_line": 126 }
Prims.Tot
val nondep_then (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) : Tot (parser (and_then_kind k1 k2) (t1 * t2))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 nondep_then #k1 = tot_nondep_then #k1
val nondep_then (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) : Tot (parser (and_then_kind k1 k2) (t1 * t2)) let nondep_then #k1 =
false
null
false
tot_nondep_then #k1
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.tot_nondep_then", "LowParse.Tot.Base.parser", "LowParse.Spec.Combinators.and_then_kind", "FStar.Pervasives.Native.tuple2" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t let parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) = parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end )) let parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input = parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input val serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True)) let serialize_tagged_union #kt st tag_of_data #k s = serialize_tot_tagged_union #kt st tag_of_data #k s val nondep_then (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) : Tot (parser (and_then_kind k1 k2) (t1 * t2))
false
false
LowParse.Tot.Combinators.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 nondep_then (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) : Tot (parser (and_then_kind k1 k2) (t1 * t2))
[]
LowParse.Tot.Combinators.nondep_then
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
p1: LowParse.Tot.Base.parser k1 t1 -> p2: LowParse.Tot.Base.parser k2 t2 -> LowParse.Tot.Base.parser (LowParse.Spec.Combinators.and_then_kind k1 k2) (t1 * t2)
{ "end_col": 41, "end_line": 186, "start_col": 22, "start_line": 186 }
Prims.Tot
val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t)
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t
val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t =
false
null
false
tot_parse_tagged_union_payload #tag_t #data_t
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Combinators.tot_parse_tagged_union_payload", "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Spec.Base.refine_with_tag" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t)
false
false
LowParse.Tot.Combinators.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 parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t)
[]
LowParse.Tot.Combinators.parse_tagged_union_payload
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
tag_of_data: (_: data_t -> tag_t) -> p: (t: tag_t -> LowParse.Tot.Base.parser k (LowParse.Spec.Base.refine_with_tag tag_of_data t)) -> tg: tag_t -> LowParse.Tot.Base.parser k data_t
{ "end_col": 93, "end_line": 113, "start_col": 48, "start_line": 113 }
Prims.Tot
val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2
val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 =
false
null
false
serialize_tot_synth #k #t1 #t2
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.serialize_tot_synth", "LowParse.Spec.Base.tot_parser", "LowParse.Tot.Base.serializer", "Prims.unit", "Prims.l_and", "LowParse.Spec.Combinators.synth_inverse", "LowParse.Spec.Combinators.synth_injective", "LowParse.Spec.Combinators.tot_parse_synth" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2))
false
false
LowParse.Tot.Combinators.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 serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2))
[]
LowParse.Tot.Combinators.serialize_synth
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
p1: LowParse.Spec.Base.tot_parser k t1 -> f2: (_: t1 -> t2) -> s1: LowParse.Tot.Base.serializer p1 -> g1: (_: t2 -> Prims.GTot t1) -> u30: u33: Prims.unit { LowParse.Spec.Combinators.synth_inverse f2 g1 /\ LowParse.Spec.Combinators.synth_injective f2 } -> LowParse.Tot.Base.serializer (LowParse.Spec.Combinators.tot_parse_synth p1 f2)
{ "end_col": 63, "end_line": 45, "start_col": 33, "start_line": 45 }
Prims.Pure
val serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 serialize_tagged_union #kt st tag_of_data #k s = serialize_tot_tagged_union #kt st tag_of_data #k s
val serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True)) let serialize_tagged_union #kt st tag_of_data #k s =
false
null
false
serialize_tot_tagged_union #kt st tag_of_data #k s
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Tot.Base.serializer", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.Combinators.serialize_tot_tagged_union", "LowParse.Spec.Combinators.and_then_kind", "LowParse.Tot.Combinators.parse_tagged_union" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t let parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) = parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end )) let parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input = parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input val serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True))
false
false
LowParse.Tot.Combinators.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 serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True))
[]
LowParse.Tot.Combinators.serialize_tagged_union
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
st: LowParse.Tot.Base.serializer pt -> tag_of_data: (_: data_t -> tag_t) -> s: (t: tag_t -> LowParse.Tot.Base.serializer (p t)) -> Prims.Pure (LowParse.Tot.Base.serializer (LowParse.Tot.Combinators.parse_tagged_union pt tag_of_data p))
{ "end_col": 103, "end_line": 175, "start_col": 53, "start_line": 175 }
FStar.Pervasives.Lemma
val parse_tagged_union_payload_and_then_cases_injective (#tag_t #data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t -> Tot (parser k (refine_with_tag tag_of_data t)))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) = parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p
val parse_tagged_union_payload_and_then_cases_injective (#tag_t #data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t -> Tot (parser k (refine_with_tag tag_of_data t)))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) let parse_tagged_union_payload_and_then_cases_injective (#tag_t #data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t -> Tot (parser k (refine_with_tag tag_of_data t)))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) =
false
null
true
parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "lemma" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.Combinators.parse_tagged_union_payload_and_then_cases_injective", "Prims.unit", "Prims.l_True", "Prims.squash", "LowParse.Spec.Combinators.and_then_cases_injective", "LowParse.Tot.Combinators.parse_tagged_union_payload", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t let parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma
false
false
LowParse.Tot.Combinators.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 parse_tagged_union_payload_and_then_cases_injective (#tag_t #data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t -> Tot (parser k (refine_with_tag tag_of_data t)))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p))
[]
LowParse.Tot.Combinators.parse_tagged_union_payload_and_then_cases_injective
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
tag_of_data: (_: data_t -> tag_t) -> p: (t: tag_t -> LowParse.Tot.Base.parser k (LowParse.Spec.Base.refine_with_tag tag_of_data t)) -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Combinators.and_then_cases_injective (LowParse.Tot.Combinators.parse_tagged_union_payload tag_of_data p))
{ "end_col": 70, "end_line": 136, "start_col": 2, "start_line": 136 }
Prims.Tot
val serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _
val serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) =
false
null
false
Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Tot.Base.serializer", "Prims.bool", "LowParse.Spec.Base.serialize_ext", "LowParse.Spec.Combinators.parse_filter_kind", "LowParse.Spec.Combinators.parse_filter_refine", "LowParse.Spec.Combinators.parse_filter", "LowParse.Spec.Combinators.serialize_filter", "LowParse.Tot.Combinators.parse_filter", "Prims.unit", "FStar.Classical.forall_intro", "LowParse.Bytes.bytes", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.Base.parse", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "LowParse.Tot.Combinators.parse_filter_eq" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool))
false
false
LowParse.Tot.Combinators.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 serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f))
[]
LowParse.Tot.Combinators.serialize_filter
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
s: LowParse.Tot.Base.serializer p -> f: (_: t -> Prims.bool) -> LowParse.Tot.Base.serializer (LowParse.Tot.Combinators.parse_filter p f)
{ "end_col": 42, "end_line": 84, "start_col": 2, "start_line": 83 }
Prims.Pure
val make_constant_size_parser (sz: nat) (t: Type) (f: (s: bytes{Seq.length s == sz} -> Tot (option t))) : Pure (tot_parser (constant_size_parser_kind sz) t) (requires (make_constant_size_parser_precond sz t f)) (ensures (fun _ -> True))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 make_constant_size_parser (sz: nat) (t: Type) (f: ((s: bytes {Seq.length s == sz}) -> Tot (option t))) : Pure ( tot_parser (constant_size_parser_kind sz) t ) (requires ( make_constant_size_parser_precond sz t f )) (ensures (fun _ -> True)) = tot_make_constant_size_parser sz t f
val make_constant_size_parser (sz: nat) (t: Type) (f: (s: bytes{Seq.length s == sz} -> Tot (option t))) : Pure (tot_parser (constant_size_parser_kind sz) t) (requires (make_constant_size_parser_precond sz t f)) (ensures (fun _ -> True)) let make_constant_size_parser (sz: nat) (t: Type) (f: (s: bytes{Seq.length s == sz} -> Tot (option t))) : Pure (tot_parser (constant_size_parser_kind sz) t) (requires (make_constant_size_parser_precond sz t f)) (ensures (fun _ -> True)) =
false
null
false
tot_make_constant_size_parser sz t f
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[]
[ "Prims.nat", "LowParse.Bytes.bytes", "Prims.eq2", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "FStar.Pervasives.Native.option", "LowParse.Spec.Combinators.tot_make_constant_size_parser", "LowParse.Spec.Base.tot_parser", "LowParse.Spec.Combinators.constant_size_parser_kind", "LowParse.Spec.Combinators.make_constant_size_parser_precond", "Prims.l_True" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t let parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) = parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end )) let parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input = parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input val serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True)) let serialize_tagged_union #kt st tag_of_data #k s = serialize_tot_tagged_union #kt st tag_of_data #k s val nondep_then (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) : Tot (parser (and_then_kind k1 k2) (t1 * t2)) let nondep_then #k1 = tot_nondep_then #k1 val nondep_then_eq (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (b: bytes) : Lemma (parse (nondep_then p1 p2) b == (match parse p1 b with | Some (x1, consumed1) -> let b' = Seq.slice b consumed1 (Seq.length b) in begin match parse p2 b' with | Some (x2, consumed2) -> Some ((x1, x2), consumed1 + consumed2) | _ -> None end | _ -> None )) let nondep_then_eq #k1 #t1 p1 #k2 #t2 p2 b = nondep_then_eq #k1 p1 #k2 p2 b let make_constant_size_parser (sz: nat) (t: Type) (f: ((s: bytes {Seq.length s == sz}) -> Tot (option t))) : Pure ( tot_parser (constant_size_parser_kind sz) t ) (requires ( make_constant_size_parser_precond sz t f ))
false
false
LowParse.Tot.Combinators.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 make_constant_size_parser (sz: nat) (t: Type) (f: (s: bytes{Seq.length s == sz} -> Tot (option t))) : Pure (tot_parser (constant_size_parser_kind sz) t) (requires (make_constant_size_parser_precond sz t f)) (ensures (fun _ -> True))
[]
LowParse.Tot.Combinators.make_constant_size_parser
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
sz: Prims.nat -> t: Type -> f: (s: LowParse.Bytes.bytes{FStar.Seq.Base.length s == sz} -> FStar.Pervasives.Native.option t) -> Prims.Pure (LowParse.Spec.Base.tot_parser (LowParse.Spec.Combinators.constant_size_parser_kind sz) t)
{ "end_col": 38, "end_line": 224, "start_col": 2, "start_line": 224 }
Prims.Tot
val serialize_weaken (#k: parser_kind) (#t: Type) (k': parser_kind) (#p: parser k t) (s: serializer p {k' `is_weaker_than` k}) : Tot (serializer (weaken k' p))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s
val serialize_weaken (#k: parser_kind) (#t: Type) (k': parser_kind) (#p: parser k t) (s: serializer p {k' `is_weaker_than` k}) : Tot (serializer (weaken k' p)) let serialize_weaken (#k: parser_kind) (#t: Type) (k': parser_kind) (#p: parser k t) (s: serializer p {k' `is_weaker_than` k}) : Tot (serializer (weaken k' p)) =
false
null
false
serialize_weaken #k k' s
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "total" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Tot.Base.serializer", "LowParse.Spec.Base.is_weaker_than", "LowParse.Spec.Combinators.serialize_weaken", "LowParse.Tot.Base.weaken" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k })
false
false
LowParse.Tot.Combinators.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 serialize_weaken (#k: parser_kind) (#t: Type) (k': parser_kind) (#p: parser k t) (s: serializer p {k' `is_weaker_than` k}) : Tot (serializer (weaken k' p))
[]
LowParse.Tot.Combinators.serialize_weaken
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
k': LowParse.Spec.Base.parser_kind -> s: LowParse.Tot.Base.serializer p {LowParse.Spec.Base.is_weaker_than k' k} -> LowParse.Tot.Base.serializer (LowParse.Tot.Base.weaken k' p)
{ "end_col": 26, "end_line": 54, "start_col": 2, "start_line": 54 }
FStar.Pervasives.Lemma
val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2
val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 =
false
null
true
tot_parse_synth_eq #k #t1 #t2
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "lemma" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.tot_parse_synth_eq", "LowParse.Tot.Base.parser", "LowParse.Bytes.bytes", "Prims.unit", "LowParse.Spec.Combinators.synth_injective", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.Base.parse", "LowParse.Tot.Combinators.parse_synth", "LowParse.Spec.Combinators.parse_synth'", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b))
false
false
LowParse.Tot.Combinators.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 parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b))
[]
LowParse.Tot.Combinators.parse_synth_eq
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
p1: LowParse.Tot.Base.parser k t1 -> f2: (_: t1 -> t2) -> b: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (requires LowParse.Spec.Combinators.synth_injective f2) (ensures LowParse.Spec.Base.parse (LowParse.Tot.Combinators.parse_synth p1 f2) b == LowParse.Spec.Combinators.parse_synth' p1 f2 b)
{ "end_col": 61, "end_line": 29, "start_col": 32, "start_line": 29 }
FStar.Pervasives.Lemma
val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input
val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input =
false
null
true
and_then_eq #k #t p #k' #t' p' input
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "lemma" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Bytes.bytes", "LowParse.Spec.Combinators.and_then_eq", "Prims.unit" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input))
false
false
LowParse.Tot.Combinators.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 and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input))
[]
LowParse.Tot.Combinators.and_then_eq
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
p: LowParse.Tot.Base.parser k t -> p': (_: t -> LowParse.Tot.Base.parser k' t') -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (requires LowParse.Spec.Combinators.and_then_cases_injective p') (ensures LowParse.Spec.Base.parse (LowParse.Tot.Combinators.and_then p p') input == LowParse.Spec.Combinators.and_then_bare p p' input)
{ "end_col": 79, "end_line": 101, "start_col": 43, "start_line": 101 }
FStar.Pervasives.Lemma
val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None ))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_filter_eq #k #t = tot_parse_filter_eq #k #t
val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t =
false
null
true
tot_parse_filter_eq #k #t
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "lemma" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.tot_parse_filter_eq", "LowParse.Tot.Base.parser", "Prims.bool", "LowParse.Bytes.bytes", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Combinators.parse_filter_refine", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.Base.parse", "LowParse.Tot.Combinators.parse_filter", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None ))
false
false
LowParse.Tot.Combinators.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 parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None ))
[]
LowParse.Tot.Combinators.parse_filter_eq
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
p: LowParse.Tot.Base.parser k t -> f: (_: t -> Prims.bool) -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Tot.Combinators.parse_filter p f) input == ((match LowParse.Spec.Base.parse p input with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed) -> (match f x with | true -> FStar.Pervasives.Native.Some (x, consumed) | _ -> FStar.Pervasives.Native.None) <: FStar.Pervasives.Native.option (LowParse.Spec.Combinators.parse_filter_refine f * LowParse.Spec.Base.consumed_length input)) <: FStar.Pervasives.Native.option (LowParse.Spec.Combinators.parse_filter_refine f * LowParse.Spec.Base.consumed_length input)))
{ "end_col": 53, "end_line": 74, "start_col": 28, "start_line": 74 }
FStar.Pervasives.Lemma
val nondep_then_eq (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (b: bytes) : Lemma (parse (nondep_then p1 p2) b == (match parse p1 b with | Some (x1, consumed1) -> let b' = Seq.slice b consumed1 (Seq.length b) in begin match parse p2 b' with | Some (x2, consumed2) -> Some ((x1, x2), consumed1 + consumed2) | _ -> None end | _ -> None ))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 nondep_then_eq #k1 #t1 p1 #k2 #t2 p2 b = nondep_then_eq #k1 p1 #k2 p2 b
val nondep_then_eq (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (b: bytes) : Lemma (parse (nondep_then p1 p2) b == (match parse p1 b with | Some (x1, consumed1) -> let b' = Seq.slice b consumed1 (Seq.length b) in begin match parse p2 b' with | Some (x2, consumed2) -> Some ((x1, x2), consumed1 + consumed2) | _ -> None end | _ -> None )) let nondep_then_eq #k1 #t1 p1 #k2 #t2 p2 b =
false
null
true
nondep_then_eq #k1 p1 #k2 p2 b
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "lemma" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Bytes.bytes", "LowParse.Spec.Combinators.nondep_then_eq", "Prims.unit" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t let parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) = parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end )) let parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input = parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input val serialize_tagged_union (#kt: parser_kind) (#tag_t: Type) (#pt: parser kt tag_t) (st: serializer pt) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (#p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (s: (t: tag_t) -> Tot (serializer (p t))) : Pure (serializer (parse_tagged_union pt tag_of_data p)) (requires (kt.parser_kind_subkind == Some ParserStrong)) (ensures (fun _ -> True)) let serialize_tagged_union #kt st tag_of_data #k s = serialize_tot_tagged_union #kt st tag_of_data #k s val nondep_then (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) : Tot (parser (and_then_kind k1 k2) (t1 * t2)) let nondep_then #k1 = tot_nondep_then #k1 val nondep_then_eq (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (b: bytes) : Lemma (parse (nondep_then p1 p2) b == (match parse p1 b with | Some (x1, consumed1) -> let b' = Seq.slice b consumed1 (Seq.length b) in begin match parse p2 b' with | Some (x2, consumed2) -> Some ((x1, x2), consumed1 + consumed2) | _ -> None end | _ -> None ))
false
false
LowParse.Tot.Combinators.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 nondep_then_eq (#k1: parser_kind) (#t1: Type) (p1: parser k1 t1) (#k2: parser_kind) (#t2: Type) (p2: parser k2 t2) (b: bytes) : Lemma (parse (nondep_then p1 p2) b == (match parse p1 b with | Some (x1, consumed1) -> let b' = Seq.slice b consumed1 (Seq.length b) in begin match parse p2 b' with | Some (x2, consumed2) -> Some ((x1, x2), consumed1 + consumed2) | _ -> None end | _ -> None ))
[]
LowParse.Tot.Combinators.nondep_then_eq
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
p1: LowParse.Tot.Base.parser k1 t1 -> p2: LowParse.Tot.Base.parser k2 t2 -> b: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Tot.Combinators.nondep_then p1 p2) b == ((match LowParse.Spec.Base.parse p1 b with | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x1 consumed1) -> let b' = FStar.Seq.Base.slice b consumed1 (FStar.Seq.Base.length b) in (match LowParse.Spec.Base.parse p2 b' with | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x2 consumed2) -> FStar.Pervasives.Native.Some (FStar.Pervasives.Native.Mktuple2 x1 x2, consumed1 + consumed2) | _ -> FStar.Pervasives.Native.None) <: FStar.Pervasives.Native.option ((t1 * t2) * LowParse.Spec.Base.consumed_length b) | _ -> FStar.Pervasives.Native.None) <: FStar.Pervasives.Native.option ((t1 * t2) * LowParse.Spec.Base.consumed_length b)))
{ "end_col": 32, "end_line": 209, "start_col": 2, "start_line": 209 }
FStar.Pervasives.Lemma
val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end ))
[ { "abbrev": false, "full_module": "LowParse.Tot.Base", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Tot", "short_module": null }, { "abbrev": 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 parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input = parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input
val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end )) let parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input =
false
null
true
parse_tagged_union_eq #kt #tag_t pt #data_t tag_of_data #k p input
{ "checked_file": "LowParse.Tot.Combinators.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Tot.Base.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Tot.Combinators.fst" }
[ "lemma" ]
[ "LowParse.Spec.Base.parser_kind", "LowParse.Tot.Base.parser", "LowParse.Spec.Base.refine_with_tag", "LowParse.Bytes.bytes", "LowParse.Spec.Combinators.parse_tagged_union_eq", "Prims.unit" ]
[]
module LowParse.Tot.Combinators include LowParse.Spec.Combinators include LowParse.Tot.Base inline_for_extraction let fail_parser = tot_fail_parser inline_for_extraction let parse_ret = tot_parse_ret inline_for_extraction let parse_empty : parser parse_ret_kind unit = parse_ret () inline_for_extraction let parse_synth #k #t1 #t2 = tot_parse_synth #k #t1 #t2 val parse_synth_eq (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: parser k t1) (f2: t1 -> Tot t2) (b: bytes) : Lemma (requires (synth_injective f2)) (ensures (parse (parse_synth p1 f2) b == parse_synth' #k p1 f2 b)) let parse_synth_eq #k #t1 #t2 = tot_parse_synth_eq #k #t1 #t2 val serialize_synth (#k: parser_kind) (#t1: Type) (#t2: Type) (p1: tot_parser k t1) (f2: t1 -> Tot t2) (s1: serializer p1) (g1: t2 -> GTot t1) (u: unit { synth_inverse f2 g1 /\ synth_injective f2 }) : Tot (serializer (tot_parse_synth p1 f2)) let serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2 let serialize_weaken (#k: parser_kind) (#t: Type) (k' : parser_kind) (#p: parser k t) (s: serializer p { k' `is_weaker_than` k }) : Tot (serializer (weaken k' p)) = serialize_weaken #k k' s inline_for_extraction let parse_filter #k #t = tot_parse_filter #k #t val parse_filter_eq (#k: parser_kind) (#t: Type) (p: parser k t) (f: (t -> Tot bool)) (input: bytes) : Lemma (parse (parse_filter p f) input == (match parse p input with | None -> None | Some (x, consumed) -> if f x then Some (x, consumed) else None )) let parse_filter_eq #k #t = tot_parse_filter_eq #k #t let serialize_filter (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (f: (t -> Tot bool)) : Tot (serializer (parse_filter p f)) = Classical.forall_intro (parse_filter_eq #k #t p f); serialize_ext _ (serialize_filter s f) _ inline_for_extraction let and_then #k #t = tot_and_then #k #t val and_then_eq (#k: parser_kind) (#t:Type) (p: parser k t) (#k': parser_kind) (#t':Type) (p': (t -> Tot (parser k' t'))) (input: bytes) : Lemma (requires (and_then_cases_injective p')) (ensures (parse (and_then p p') input == and_then_bare p p' input)) let and_then_eq #k #t p #k' #t' p' input = and_then_eq #k #t p #k' #t' p' input inline_for_extraction val parse_tagged_union_payload (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (tg: tag_t) : Tot (parser k data_t) let parse_tagged_union_payload #tag_t #data_t = tot_parse_tagged_union_payload #tag_t #data_t inline_for_extraction val parse_tagged_union (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Tot (parser (and_then_kind kt k) data_t) let parse_tagged_union #kt #tag_t = tot_parse_tagged_union #kt #tag_t let parse_tagged_union_payload_and_then_cases_injective (#tag_t: Type) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) : Lemma (and_then_cases_injective (parse_tagged_union_payload tag_of_data p)) = parse_tagged_union_payload_and_then_cases_injective tag_of_data #k p val parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end ))
false
false
LowParse.Tot.Combinators.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 parse_tagged_union_eq (#kt: parser_kind) (#tag_t: Type) (pt: parser kt tag_t) (#data_t: Type) (tag_of_data: (data_t -> Tot tag_t)) (#k: parser_kind) (p: (t: tag_t) -> Tot (parser k (refine_with_tag tag_of_data t))) (input: bytes) : Lemma (parse (parse_tagged_union pt tag_of_data p) input == (match parse pt input with | None -> None | Some (tg, consumed_tg) -> let input_tg = Seq.slice input consumed_tg (Seq.length input) in begin match parse (p tg) input_tg with | Some (x, consumed_x) -> Some ((x <: data_t), consumed_tg + consumed_x) | None -> None end ))
[]
LowParse.Tot.Combinators.parse_tagged_union_eq
{ "file_name": "src/lowparse/LowParse.Tot.Combinators.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
pt: LowParse.Tot.Base.parser kt tag_t -> tag_of_data: (_: data_t -> tag_t) -> p: (t: tag_t -> LowParse.Tot.Base.parser k (LowParse.Spec.Base.refine_with_tag tag_of_data t)) -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Tot.Combinators.parse_tagged_union pt tag_of_data p) input == ((match LowParse.Spec.Base.parse pt input with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ tg consumed_tg) -> let input_tg = FStar.Seq.Base.slice input consumed_tg (FStar.Seq.Base.length input) in (match LowParse.Spec.Base.parse (p tg) input_tg with | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed_x) -> FStar.Pervasives.Native.Some (x, consumed_tg + consumed_x) | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None) <: FStar.Pervasives.Native.option (data_t * LowParse.Spec.Base.consumed_length input)) <: FStar.Pervasives.Native.option (data_t * LowParse.Spec.Base.consumed_length input)))
{ "end_col": 68, "end_line": 159, "start_col": 2, "start_line": 159 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aff_point_mul = S.aff_point_mul
let aff_point_mul =
false
null
false
S.aff_point_mul
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.aff_point_mul" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
false
true
Hacl.Spec.K256.GLV.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 aff_point_mul : a: Prims.nat -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point
[]
Hacl.Spec.K256.GLV.aff_point_mul
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Prims.nat -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point
{ "end_col": 35, "end_line": 51, "start_col": 20, "start_line": 51 }
Prims.Tot
val aff_point_negate_cond (p: S.aff_point) (is_negate: bool) : S.aff_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p
val aff_point_negate_cond (p: S.aff_point) (is_negate: bool) : S.aff_point let aff_point_negate_cond (p: S.aff_point) (is_negate: bool) : S.aff_point =
false
null
false
if is_negate then S.aff_point_negate p else p
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.aff_point", "Prims.bool", "Spec.K256.PointOps.aff_point_negate" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *)
false
true
Hacl.Spec.K256.GLV.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 aff_point_negate_cond (p: S.aff_point) (is_negate: bool) : S.aff_point
[]
Hacl.Spec.K256.GLV.aff_point_negate_cond
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
p: Spec.K256.PointOps.aff_point -> is_negate: Prims.bool -> Spec.K256.PointOps.aff_point
{ "end_col": 47, "end_line": 129, "start_col": 2, "start_line": 129 }
Prims.Tot
val point_negate_cond (p: S.proj_point) (is_negate: bool) : S.proj_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let point_negate_cond (p:S.proj_point) (is_negate:bool) : S.proj_point = if is_negate then S.point_negate p else p
val point_negate_cond (p: S.proj_point) (is_negate: bool) : S.proj_point let point_negate_cond (p: S.proj_point) (is_negate: bool) : S.proj_point =
false
null
false
if is_negate then S.point_negate p else p
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.proj_point", "Prims.bool", "Spec.K256.PointOps.point_negate" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *) let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p let aff_negate_point_and_scalar_cond (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg end else k, p // https://github.com/bitcoin-core/secp256k1/blob/master/src/ecmult_impl.h // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) let aff_ecmult_endo_split (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point = let r1, r2 = scalar_split_lambda k in let lambda_p = aff_point_mul_lambda p in let r1, p1 = aff_negate_point_and_scalar_cond r1 p in let r2, p2 = aff_negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2) // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) // which can be computed as a double exponentiation ([a]P + [b]Q) let aff_point_mul_endo_split (k:S.qelem) (p:S.aff_point) : S.aff_point = let r1, p1, r2, p2 = aff_ecmult_endo_split k p in S.aff_point_add (aff_point_mul r1 p1) (aff_point_mul r2 p2) (** Fast computation of [k]P in projective coordinates *)
false
true
Hacl.Spec.K256.GLV.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_negate_cond (p: S.proj_point) (is_negate: bool) : S.proj_point
[]
Hacl.Spec.K256.GLV.point_negate_cond
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
p: Spec.K256.PointOps.proj_point -> is_negate: Prims.bool -> Spec.K256.PointOps.proj_point
{ "end_col": 43, "end_line": 160, "start_col": 2, "start_line": 160 }
Prims.Tot
val aff_point_mul_lambda (p: S.aff_point) : S.aff_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py)
val aff_point_mul_lambda (p: S.aff_point) : S.aff_point let aff_point_mul_lambda (p: S.aff_point) : S.aff_point =
false
null
false
let px, py = p in (S.(beta *% px), py)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.aff_point", "Spec.K256.PointOps.felem", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.op_Star_Percent", "Hacl.Spec.K256.GLV.beta" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul
false
true
Hacl.Spec.K256.GLV.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 aff_point_mul_lambda (p: S.aff_point) : S.aff_point
[]
Hacl.Spec.K256.GLV.aff_point_mul_lambda
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point
{ "end_col": 42, "end_line": 55, "start_col": 56, "start_line": 54 }
Prims.Tot
val aff_ecmult_endo_split (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aff_ecmult_endo_split (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point = let r1, r2 = scalar_split_lambda k in let lambda_p = aff_point_mul_lambda p in let r1, p1 = aff_negate_point_and_scalar_cond r1 p in let r2, p2 = aff_negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2)
val aff_ecmult_endo_split (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point let aff_ecmult_endo_split (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point =
false
null
false
let r1, r2 = scalar_split_lambda k in let lambda_p = aff_point_mul_lambda p in let r1, p1 = aff_negate_point_and_scalar_cond r1 p in let r2, p2 = aff_negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.aff_point", "FStar.Pervasives.Native.Mktuple4", "FStar.Pervasives.Native.tuple4", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.K256.GLV.aff_negate_point_and_scalar_cond", "Hacl.Spec.K256.GLV.aff_point_mul_lambda", "Hacl.Spec.K256.GLV.scalar_split_lambda" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *) let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p let aff_negate_point_and_scalar_cond (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg end else k, p // https://github.com/bitcoin-core/secp256k1/blob/master/src/ecmult_impl.h // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) let aff_ecmult_endo_split (k:S.qelem) (p:S.aff_point) :
false
true
Hacl.Spec.K256.GLV.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 aff_ecmult_endo_split (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point
[]
Hacl.Spec.K256.GLV.aff_ecmult_endo_split
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Spec.K256.PointOps.qelem -> p: Spec.K256.PointOps.aff_point -> ((Spec.K256.PointOps.qelem * Spec.K256.PointOps.aff_point) * Spec.K256.PointOps.qelem) * Spec.K256.PointOps.aff_point
{ "end_col": 18, "end_line": 147, "start_col": 2, "start_line": 142 }
Prims.Tot
val aff_negate_point_and_scalar_cond (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aff_negate_point_and_scalar_cond (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg end else k, p
val aff_negate_point_and_scalar_cond (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point let aff_negate_point_and_scalar_cond (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point =
false
null
false
if S.scalar_is_high k then let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg else k, p
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.aff_point", "Spec.K256.PointOps.scalar_is_high", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.aff_point_negate", "Spec.K256.PointOps.qnegate", "Prims.bool", "FStar.Pervasives.Native.tuple2" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *) let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p
false
true
Hacl.Spec.K256.GLV.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 aff_negate_point_and_scalar_cond (k: S.qelem) (p: S.aff_point) : S.qelem & S.aff_point
[]
Hacl.Spec.K256.GLV.aff_negate_point_and_scalar_cond
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Spec.K256.PointOps.qelem -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.qelem * Spec.K256.PointOps.aff_point
{ "end_col": 11, "end_line": 136, "start_col": 2, "start_line": 132 }
Prims.Tot
val aff_point_mul_endo_split (k: S.qelem) (p: S.aff_point) : S.aff_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let aff_point_mul_endo_split (k:S.qelem) (p:S.aff_point) : S.aff_point = let r1, p1, r2, p2 = aff_ecmult_endo_split k p in S.aff_point_add (aff_point_mul r1 p1) (aff_point_mul r2 p2)
val aff_point_mul_endo_split (k: S.qelem) (p: S.aff_point) : S.aff_point let aff_point_mul_endo_split (k: S.qelem) (p: S.aff_point) : S.aff_point =
false
null
false
let r1, p1, r2, p2 = aff_ecmult_endo_split k p in S.aff_point_add (aff_point_mul r1 p1) (aff_point_mul r2 p2)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.aff_point", "Spec.K256.PointOps.aff_point_add", "Hacl.Spec.K256.GLV.aff_point_mul", "FStar.Pervasives.Native.tuple4", "Hacl.Spec.K256.GLV.aff_ecmult_endo_split" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *) let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p let aff_negate_point_and_scalar_cond (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg end else k, p // https://github.com/bitcoin-core/secp256k1/blob/master/src/ecmult_impl.h // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) let aff_ecmult_endo_split (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point = let r1, r2 = scalar_split_lambda k in let lambda_p = aff_point_mul_lambda p in let r1, p1 = aff_negate_point_and_scalar_cond r1 p in let r2, p2 = aff_negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2) // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y)
false
true
Hacl.Spec.K256.GLV.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 aff_point_mul_endo_split (k: S.qelem) (p: S.aff_point) : S.aff_point
[]
Hacl.Spec.K256.GLV.aff_point_mul_endo_split
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Spec.K256.PointOps.qelem -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point
{ "end_col": 61, "end_line": 153, "start_col": 72, "start_line": 151 }
Prims.Tot
val ecmult_endo_split (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point & S.qelem & S.proj_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let ecmult_endo_split (k:S.qelem) (p:S.proj_point) : S.qelem & S.proj_point & S.qelem & S.proj_point = let r1, r2 = scalar_split_lambda k in let lambda_p = point_mul_lambda p in let r1, p1 = negate_point_and_scalar_cond r1 p in let r2, p2 = negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2)
val ecmult_endo_split (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point & S.qelem & S.proj_point let ecmult_endo_split (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point & S.qelem & S.proj_point =
false
null
false
let r1, r2 = scalar_split_lambda k in let lambda_p = point_mul_lambda p in let r1, p1 = negate_point_and_scalar_cond r1 p in let r2, p2 = negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.proj_point", "FStar.Pervasives.Native.Mktuple4", "FStar.Pervasives.Native.tuple4", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.K256.GLV.negate_point_and_scalar_cond", "Hacl.Spec.K256.GLV.point_mul_lambda", "Hacl.Spec.K256.GLV.scalar_split_lambda" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *) let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p let aff_negate_point_and_scalar_cond (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg end else k, p // https://github.com/bitcoin-core/secp256k1/blob/master/src/ecmult_impl.h // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) let aff_ecmult_endo_split (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point = let r1, r2 = scalar_split_lambda k in let lambda_p = aff_point_mul_lambda p in let r1, p1 = aff_negate_point_and_scalar_cond r1 p in let r2, p2 = aff_negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2) // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) // which can be computed as a double exponentiation ([a]P + [b]Q) let aff_point_mul_endo_split (k:S.qelem) (p:S.aff_point) : S.aff_point = let r1, p1, r2, p2 = aff_ecmult_endo_split k p in S.aff_point_add (aff_point_mul r1 p1) (aff_point_mul r2 p2) (** Fast computation of [k]P in projective coordinates *) let point_negate_cond (p:S.proj_point) (is_negate:bool) : S.proj_point = if is_negate then S.point_negate p else p let negate_point_and_scalar_cond (k:S.qelem) (p:S.proj_point) : S.qelem & S.proj_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.point_negate p in k_neg, p_neg end else k, p let ecmult_endo_split (k:S.qelem) (p:S.proj_point) :
false
true
Hacl.Spec.K256.GLV.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 ecmult_endo_split (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point & S.qelem & S.proj_point
[]
Hacl.Spec.K256.GLV.ecmult_endo_split
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Spec.K256.PointOps.qelem -> p: Spec.K256.PointOps.proj_point -> ((Spec.K256.PointOps.qelem * Spec.K256.PointOps.proj_point) * Spec.K256.PointOps.qelem) * Spec.K256.PointOps.proj_point
{ "end_col": 18, "end_line": 177, "start_col": 2, "start_line": 172 }
Prims.Tot
val point_mul_lambda (p: S.proj_point) : S.proj_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z)
val point_mul_lambda (p: S.proj_point) : S.proj_point let point_mul_lambda (p: S.proj_point) : S.proj_point =
false
null
false
let _X, _Y, _Z = p in (S.(beta *% _X), _Y, _Z)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.proj_point", "Spec.K256.PointOps.felem", "FStar.Pervasives.Native.Mktuple3", "Spec.K256.PointOps.op_Star_Percent", "Hacl.Spec.K256.GLV.beta" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py)
false
true
Hacl.Spec.K256.GLV.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_mul_lambda (p: S.proj_point) : S.proj_point
[]
Hacl.Spec.K256.GLV.point_mul_lambda
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
p: Spec.K256.PointOps.proj_point -> Spec.K256.PointOps.proj_point
{ "end_col": 50, "end_line": 59, "start_col": 54, "start_line": 58 }
Prims.Tot
val negate_point_and_scalar_cond (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let negate_point_and_scalar_cond (k:S.qelem) (p:S.proj_point) : S.qelem & S.proj_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.point_negate p in k_neg, p_neg end else k, p
val negate_point_and_scalar_cond (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point let negate_point_and_scalar_cond (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point =
false
null
false
if S.scalar_is_high k then let k_neg = S.qnegate k in let p_neg = S.point_negate p in k_neg, p_neg else k, p
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.proj_point", "Spec.K256.PointOps.scalar_is_high", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.point_negate", "Spec.K256.PointOps.qnegate", "Prims.bool", "FStar.Pervasives.Native.tuple2" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q) let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2 (** Fast computation of [k]P in affine coordinates *) let aff_point_negate_cond (p:S.aff_point) (is_negate:bool) : S.aff_point = if is_negate then S.aff_point_negate p else p let aff_negate_point_and_scalar_cond (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point = if S.scalar_is_high k then begin let k_neg = S.qnegate k in let p_neg = S.aff_point_negate p in k_neg, p_neg end else k, p // https://github.com/bitcoin-core/secp256k1/blob/master/src/ecmult_impl.h // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) let aff_ecmult_endo_split (k:S.qelem) (p:S.aff_point) : S.qelem & S.aff_point & S.qelem & S.aff_point = let r1, r2 = scalar_split_lambda k in let lambda_p = aff_point_mul_lambda p in let r1, p1 = aff_negate_point_and_scalar_cond r1 p in let r2, p2 = aff_negate_point_and_scalar_cond r2 lambda_p in (r1, p1, r2, p2) // [k]P = [r1 + r2 * lambda]P = [r1]P + [r2]([lambda]P) = [r1](x,y) + [r2](beta*x,y) // which can be computed as a double exponentiation ([a]P + [b]Q) let aff_point_mul_endo_split (k:S.qelem) (p:S.aff_point) : S.aff_point = let r1, p1, r2, p2 = aff_ecmult_endo_split k p in S.aff_point_add (aff_point_mul r1 p1) (aff_point_mul r2 p2) (** Fast computation of [k]P in projective coordinates *) let point_negate_cond (p:S.proj_point) (is_negate:bool) : S.proj_point = if is_negate then S.point_negate p else p
false
true
Hacl.Spec.K256.GLV.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 negate_point_and_scalar_cond (k: S.qelem) (p: S.proj_point) : S.qelem & S.proj_point
[]
Hacl.Spec.K256.GLV.negate_point_and_scalar_cond
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Spec.K256.PointOps.qelem -> p: Spec.K256.PointOps.proj_point -> Spec.K256.PointOps.qelem * Spec.K256.PointOps.proj_point
{ "end_col": 11, "end_line": 167, "start_col": 2, "start_line": 163 }
Prims.Tot
val beta:S.felem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
val beta:S.felem let beta:S.felem =
false
null
false
0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
false
true
Hacl.Spec.K256.GLV.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 beta:S.felem
[]
Hacl.Spec.K256.GLV.beta
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.felem
{ "end_col": 87, "end_line": 48, "start_col": 21, "start_line": 48 }
Prims.Tot
val minus_lambda:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x
val minus_lambda:S.qelem let minus_lambda:S.qelem =
false
null
false
let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Prims.op_Minus", "Hacl.Spec.K256.GLV.lambda", "Spec.K256.PointOps.q" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
false
true
Hacl.Spec.K256.GLV.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 minus_lambda:S.qelem
[]
Hacl.Spec.K256.GLV.minus_lambda
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 3, "end_line": 74, "start_col": 28, "start_line": 71 }
Prims.Tot
val lambda:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
val lambda:S.qelem let lambda:S.qelem =
false
null
false
0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *)
false
true
Hacl.Spec.K256.GLV.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 lambda:S.qelem
[]
Hacl.Spec.K256.GLV.lambda
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 89, "end_line": 46, "start_col": 23, "start_line": 46 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2)
let qmul_shift_384 a b =
false
null
false
a * b / pow2 384 + (a * b / pow2 383 % 2)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Prims.int", "Prims.op_Addition", "Prims.op_Division", "FStar.Mul.op_Star", "Prims.pow2", "Prims.op_Modulus" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x
false
true
Hacl.Spec.K256.GLV.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 qmul_shift_384 : a: Prims.int -> b: Prims.int -> Prims.int
[]
Hacl.Spec.K256.GLV.qmul_shift_384
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Prims.int -> b: Prims.int -> Prims.int
{ "end_col": 43, "end_line": 97, "start_col": 2, "start_line": 97 }
Prims.Tot
val a1:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
val a1:S.qelem let a1:S.qelem =
false
null
false
0x3086d221a7d46bcde86c90e49284eb15
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *)
false
true
Hacl.Spec.K256.GLV.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 a1:S.qelem
[]
Hacl.Spec.K256.GLV.a1
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 53, "end_line": 66, "start_col": 19, "start_line": 66 }
Prims.Tot
val minus_b2:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x
val minus_b2:S.qelem let minus_b2:S.qelem =
false
null
false
let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Prims.op_Minus", "Hacl.Spec.K256.GLV.b2", "Spec.K256.PointOps.q" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x
false
true
Hacl.Spec.K256.GLV.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 minus_b2:S.qelem
[]
Hacl.Spec.K256.GLV.minus_b2
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 3, "end_line": 84, "start_col": 24, "start_line": 81 }
Prims.Tot
val a2:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8
val a2:S.qelem let a2:S.qelem =
false
null
false
0x114ca50f7a8e2f3f657c1108d9d44cfd8
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
false
true
Hacl.Spec.K256.GLV.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 a2:S.qelem
[]
Hacl.Spec.K256.GLV.a2
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 54, "end_line": 68, "start_col": 19, "start_line": 68 }
Prims.Tot
val b1:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x
val b1:S.qelem let b1:S.qelem =
false
null
false
let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Prims.op_Minus", "Hacl.Spec.K256.GLV.minus_b1", "Spec.K256.PointOps.q" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x
false
true
Hacl.Spec.K256.GLV.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 b1:S.qelem
[]
Hacl.Spec.K256.GLV.b1
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 3, "end_line": 79, "start_col": 18, "start_line": 76 }
Prims.Tot
val minus_b1:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3
val minus_b1:S.qelem let minus_b1:S.qelem =
false
null
false
0xe4437ed6010e88286f547fa90abfe4c3
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *)
false
true
Hacl.Spec.K256.GLV.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 minus_b1:S.qelem
[]
Hacl.Spec.K256.GLV.minus_b1
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 59, "end_line": 67, "start_col": 25, "start_line": 67 }
Prims.Tot
val b2:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
val b2:S.qelem let b2:S.qelem =
false
null
false
0x3086d221a7d46bcde86c90e49284eb15
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3
false
true
Hacl.Spec.K256.GLV.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 b2:S.qelem
[]
Hacl.Spec.K256.GLV.b2
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 53, "end_line": 69, "start_col": 19, "start_line": 69 }
FStar.Pervasives.Lemma
val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q)
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q)
val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b =
false
null
true
assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q)
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "lemma" ]
[ "Spec.K256.PointOps.qelem", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_LessThan", "Prims.pow2", "Spec.K256.PointOps.q", "Prims.unit", "Prims._assert", "Prims.op_Division", "FStar.Mul.op_Star", "FStar.Math.Lemmas.lemma_div_lt_nat", "FStar.Math.Lemmas.pow2_plus", "FStar.Math.Lemmas.lemma_mult_lt_sqr" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q)
false
false
Hacl.Spec.K256.GLV.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 qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q)
[]
Hacl.Spec.K256.GLV.qmul_shift_384_lemma
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.K256.PointOps.qelem -> b: Spec.K256.PointOps.qelem -> FStar.Pervasives.Lemma (ensures Hacl.Spec.K256.GLV.qmul_shift_384 a b < Spec.K256.PointOps.q)
{ "end_col": 30, "end_line": 107, "start_col": 2, "start_line": 101 }
Prims.Tot
val g1:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x
val g1:S.qelem let g1:S.qelem =
false
null
false
let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Addition", "Prims.op_Division", "FStar.Mul.op_Star", "Prims.pow2", "Hacl.Spec.K256.GLV.b2", "Spec.K256.PointOps.q" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x
false
true
Hacl.Spec.K256.GLV.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 g1:S.qelem
[]
Hacl.Spec.K256.GLV.g1
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 3, "end_line": 89, "start_col": 18, "start_line": 86 }
Prims.Tot
val g2:S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x
val g2:S.qelem let g2:S.qelem =
false
null
false
let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.op_Division", "FStar.Mul.op_Star", "Prims.pow2", "Hacl.Spec.K256.GLV.minus_b1", "Spec.K256.PointOps.q" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x
false
true
Hacl.Spec.K256.GLV.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 g2:S.qelem
[]
Hacl.Spec.K256.GLV.g2
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.K256.PointOps.qelem
{ "end_col": 3, "end_line": 94, "start_col": 18, "start_line": 91 }
Prims.Tot
val scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem = qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1 : S.qelem = qmul_shift_384 k g1 in let c2 : S.qelem = qmul_shift_384 k g2 in let c1 = S.(c1 *^ minus_b1) in let c2 = S.(c2 *^ minus_b2) in let r2 = S.(c1 +^ c2) in let r1 = S.(k +^ r2 *^ minus_lambda) in r1, r2
val scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem let scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem =
false
null
false
qmul_shift_384_lemma k g1; qmul_shift_384_lemma k g2; let c1:S.qelem = qmul_shift_384 k g1 in let c2:S.qelem = qmul_shift_384 k g2 in let c1 = let open S in c1 *^ minus_b1 in let c2 = let open S in c2 *^ minus_b2 in let r2 = let open S in c1 +^ c2 in let r1 = let open S in k +^ r2 *^ minus_lambda in r1, r2
{ "checked_file": "Hacl.Spec.K256.GLV.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.GLV.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.op_Plus_Hat", "Spec.K256.PointOps.op_Star_Hat", "Hacl.Spec.K256.GLV.minus_lambda", "Hacl.Spec.K256.GLV.minus_b2", "Hacl.Spec.K256.GLV.minus_b1", "Hacl.Spec.K256.GLV.qmul_shift_384", "Hacl.Spec.K256.GLV.g2", "Hacl.Spec.K256.GLV.g1", "Prims.unit", "Hacl.Spec.K256.GLV.qmul_shift_384_lemma", "FStar.Pervasives.Native.tuple2" ]
[]
module Hacl.Spec.K256.GLV open FStar.Mul module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** This module implements the following two functions from libsecp256k1: secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2]. For the secp256k1 curve, we can replace the EC scalar multiplication by `lambda` with one modular multiplication by `beta`: [lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py), where `lambda` and `beta` are primitive cube roots of unity and can be fixed for the curve. The main idea is to slit a 256-bit scalar k into k1 and k2 s.t. k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers: [k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P) = [k1](px, py) + [k2](beta *% px, py). Using a double fixed-window method, we can save 128 point_double: | before | after ---------------------------------------------------------------------- point_double | 256 | 128 point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51 Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P) can be obtained via [r_small]P. [1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123 [2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618 *) (** Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates *) let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72 let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee // [a]P in affine coordinates let aff_point_mul = S.aff_point_mul // fast computation of [lambda]P in affine coordinates let aff_point_mul_lambda (p:S.aff_point) : S.aff_point = let (px, py) = p in (S.(beta *% px), py) // fast computation of [lambda]P in projective coordinates let point_mul_lambda (p:S.proj_point) : S.proj_point = let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z) (** Representing a scalar k as (r1 + r2 * lambda) mod S.q, s.t. r1 and r2 are ~128 bits long *) let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8 let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 let minus_lambda : S.qelem = let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in assert_norm (x = (- lambda) % S.q); x let b1 : S.qelem = let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in assert_norm (x = (- minus_b1) % S.q); x let minus_b2 : S.qelem = let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in assert_norm (x = (- b2) % S.q); x let g1 : S.qelem = let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in assert_norm (pow2 384 * b2 / S.q + 1 = x); x let g2 : S.qelem = let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in assert_norm (pow2 384 * minus_b1 / S.q = x); x let qmul_shift_384 a b = a * b / pow2 384 + (a * b / pow2 383 % 2) val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) let qmul_shift_384_lemma a b = assert_norm (S.q < pow2 256); Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256); Math.Lemmas.pow2_plus 256 256; assert (a * b < pow2 512); Math.Lemmas.lemma_div_lt_nat (a * b) 512 384; assert (a * b / pow2 384 < pow2 128); assert_norm (pow2 128 < S.q)
false
true
Hacl.Spec.K256.GLV.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 scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem
[]
Hacl.Spec.K256.GLV.scalar_split_lambda
{ "file_name": "code/k256/Hacl.Spec.K256.GLV.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
k: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem * Spec.K256.PointOps.qelem
{ "end_col": 8, "end_line": 121, "start_col": 2, "start_line": 111 }