file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lib.LoopCombinators.fst | Lib.LoopCombinators.unfold_repeat | val unfold_repeat:
#a:Type
-> n:nat
-> f:(a -> a)
-> acc0:a
-> i:nat{i < n}
-> Lemma (repeat #a (i + 1) f acc0 == f (repeat #a i f acc0)) | val unfold_repeat:
#a:Type
-> n:nat
-> f:(a -> a)
-> acc0:a
-> i:nat{i < n}
-> Lemma (repeat #a (i + 1) f acc0 == f (repeat #a i f acc0)) | let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 70,
"start_col": 0,
"start_line": 69
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat -> f: (_: a -> a) -> acc0: a -> i: Prims.nat{i < n}
-> FStar.Pervasives.Lemma
(ensures Lib.LoopCombinators.repeat (i + 1) f acc0 == f (Lib.LoopCombinators.repeat i f acc0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.LoopCombinators.unfold_repeati",
"Lib.LoopCombinators.fixed_i",
"Prims.unit"
] | [] | true | false | true | false | false | let unfold_repeat #a n f acc0 i =
| unfold_repeati #a n (fixed_i f) acc0 i | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.repeat_range_all_ml | val repeat_range_all_ml:
#a:Type
-> min:nat
-> max:nat{min <= max}
-> (s:nat{s >= min /\ s < max} -> a -> FStar.All.ML a)
-> a
-> FStar.All.ML a | val repeat_range_all_ml:
#a:Type
-> min:nat
-> max:nat{min <= max}
-> (s:nat{s >= min /\ s < max} -> a -> FStar.All.ML a)
-> a
-> FStar.All.ML a | let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 77,
"start_col": 0,
"start_line": 76
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
min: Prims.nat ->
max: Prims.nat{min <= max} ->
f: (s: Prims.nat{s >= min /\ s < max} -> _: a -> FStar.All.ML a) ->
x: a
-> FStar.All.ML a | FStar.All.ML | [
"ml"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_and",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"Lib.LoopCombinators.repeat_left_all_ml"
] | [] | false | true | false | false | false | let repeat_range_all_ml #a min max f x =
| repeat_left_all_ml min max (fun _ -> a) f x | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.repeat_range_inductive | val repeat_range_inductive:
#a:Type
-> min:nat
-> max:nat{min <= max}
-> pred:(i:nat{i <= max} -> a -> Type)
-> f:repeatable #a #max pred
-> x0:a{pred min x0}
-> Tot (res:a{pred max res}) (decreases (max - min)) | val repeat_range_inductive:
#a:Type
-> min:nat
-> max:nat{min <= max}
-> pred:(i:nat{i <= max} -> a -> Type)
-> f:repeatable #a #max pred
-> x0:a{pred min x0}
-> Tot (res:a{pred max res}) (decreases (max - min)) | let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 50,
"end_line": 80,
"start_col": 0,
"start_line": 79
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
min: Prims.nat ->
max: Prims.nat{min <= max} ->
pred: (i: Prims.nat{i <= max} -> _: a -> Type) ->
f: Lib.LoopCombinators.repeatable pred ->
x0: a{pred min x0}
-> Prims.Tot (res: a{pred max res}) | Prims.Tot | [
"total",
""
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.LoopCombinators.repeatable",
"Lib.LoopCombinators.repeat_left",
"Prims.l_and"
] | [] | false | false | false | false | false | let repeat_range_inductive #a min max pred f x =
| repeat_left min max (fun i -> x: a{pred i x}) f x | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.add | val add: BN.bn_add_eq_len_st t_limbs n_limbs | val add: BN.bn_add_eq_len_st t_limbs n_limbs | let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 15,
"start_col": 0,
"start_line": 14
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn_add_eq_len_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.bn_add_eq_len",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.bn_add_eq_len_st"
] | [] | false | false | false | true | false | let add:BN.bn_add_eq_len_st t_limbs n_limbs =
| BN.bn_add_eq_len n_limbs | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.nat_refine_equiv | val nat_refine_equiv (n: nat) : Lemma ((i: nat{i <= n}) == (i: nat{0 <= i /\ i <= n})) | val nat_refine_equiv (n: nat) : Lemma ((i: nat{i <= n}) == (i: nat{0 <= i /\ i <= n})) | let nat_refine_equiv (n:nat)
: Lemma ((i:nat{i <= n}) == (i:nat{0<=i /\ i<=n}))
= let b2t_prop (b:bool)
: Lemma ((b2t b) `subtype_of` unit)
= assert_norm (b2t b == squash (equals b true))
in
refine_eq nat (fun (i:nat) -> b2t_prop (i <= n); b2t (i <= n)) (fun (i:nat) -> 0 <= i /\ i <= n) () | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 103,
"end_line": 111,
"start_col": 0,
"start_line": 105
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x
let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x
let repeati_inductive #a n pred f x0 =
repeat_range_inductive #a 0 n pred f x0
let unfold_repeat_right_once
(lo:nat)
(hi:nat{lo < hi})
(a:(i:nat{lo <= i /\ i <= hi} -> Type))
(f:(i:nat{lo <= i /\ i < hi} -> a i -> a (i + 1)))
(acc:a lo)
: Lemma (repeat_right lo hi a f acc ==
f (hi - 1) (repeat_right lo (hi - 1) a f acc))
= ()
module T = FStar.Tactics
let refine_eq (a:Type) (p q:a -> prop) (x:squash (forall (i:a). p i <==> q i))
: Lemma ((i:a{p i} == i:a{q i}))
= let pext (a:Type) (p q: a -> prop) (_:squash (forall (x:a). p x <==> q x)) (x:a) : Lemma (p x == q x)
= FStar.PropositionalExtensionality.apply (p x) (q x)
in
assert (i:a{p i} == i:a{q i})
by (T.l_to_r [quote (pext a p q x)]; T.trefl()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat
-> FStar.Pervasives.Lemma (ensures i: Prims.nat{i <= n} == i: Prims.nat{0 <= i /\ i <= n}) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Lib.LoopCombinators.refine_eq",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.unit",
"Prims.prop",
"Prims.l_and",
"Prims.bool",
"Prims.l_True",
"Prims.squash",
"Prims.subtype_of",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.equals"
] | [] | false | false | true | false | false | let nat_refine_equiv (n: nat) : Lemma ((i: nat{i <= n}) == (i: nat{0 <= i /\ i <= n})) =
| let b2t_prop (b: bool) : Lemma ((b2t b) `subtype_of` unit) =
assert_norm (b2t b == squash (equals b true))
in
refine_eq nat
(fun (i: nat) ->
b2t_prop (i <= n);
b2t (i <= n))
(fun (i: nat) -> 0 <= i /\ i <= n)
() | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.refine_eq | val refine_eq (a: Type) (p q: (a -> prop)) (x: squash (forall (i: a). p i <==> q i))
: Lemma ((i: a{p i} == i: a{q i})) | val refine_eq (a: Type) (p q: (a -> prop)) (x: squash (forall (i: a). p i <==> q i))
: Lemma ((i: a{p i} == i: a{q i})) | let refine_eq (a:Type) (p q:a -> prop) (x:squash (forall (i:a). p i <==> q i))
: Lemma ((i:a{p i} == i:a{q i}))
= let pext (a:Type) (p q: a -> prop) (_:squash (forall (x:a). p x <==> q x)) (x:a) : Lemma (p x == q x)
= FStar.PropositionalExtensionality.apply (p x) (q x)
in
assert (i:a{p i} == i:a{q i})
by (T.l_to_r [quote (pext a p q x)]; T.trefl()) | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 55,
"end_line": 103,
"start_col": 0,
"start_line": 97
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x
let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x
let repeati_inductive #a n pred f x0 =
repeat_range_inductive #a 0 n pred f x0
let unfold_repeat_right_once
(lo:nat)
(hi:nat{lo < hi})
(a:(i:nat{lo <= i /\ i <= hi} -> Type))
(f:(i:nat{lo <= i /\ i < hi} -> a i -> a (i + 1)))
(acc:a lo)
: Lemma (repeat_right lo hi a f acc ==
f (hi - 1) (repeat_right lo (hi - 1) a f acc))
= ()
module T = FStar.Tactics | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
p: (_: a -> Prims.prop) ->
q: (_: a -> Prims.prop) ->
x: Prims.squash (forall (i: a). p i <==> q i)
-> FStar.Pervasives.Lemma (ensures i: a{p i} == i: a{q i}) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.prop",
"Prims.squash",
"Prims.l_Forall",
"Prims.l_iff",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"Prims.unit",
"FStar.Tactics.V1.Derived.trefl",
"FStar.Tactics.V1.Derived.l_to_r",
"Prims.list",
"FStar.Stubs.Reflection.Types.term",
"Prims.Cons",
"Prims.Nil",
"Prims.l_True",
"FStar.Pervasives.pattern",
"FStar.PropositionalExtensionality.apply"
] | [] | false | false | true | false | false | let refine_eq (a: Type) (p q: (a -> prop)) (x: squash (forall (i: a). p i <==> q i))
: Lemma ((i: a{p i} == i: a{q i})) =
| let pext
(a: Type)
(p: (a -> prop))
(q: (a -> prop))
(_: squash (forall (x: a). p x <==> q x))
(x: a)
: Lemma (p x == q x) =
FStar.PropositionalExtensionality.apply (p x) (q x)
in
FStar.Tactics.Effect.assert_by_tactic (i: a{p i} == i: a{q i})
(fun _ ->
();
(T.l_to_r [quote (pext a p q x)];
T.trefl ())) | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.sub | val sub: BN.bn_sub_eq_len_st t_limbs n_limbs | val sub: BN.bn_sub_eq_len_st t_limbs n_limbs | let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 18,
"start_col": 0,
"start_line": 17
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn_sub_eq_len_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.bn_sub_eq_len",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.bn_sub_eq_len_st"
] | [] | false | false | false | true | false | let sub:BN.bn_sub_eq_len_st t_limbs n_limbs =
| BN.bn_sub_eq_len n_limbs | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mont_check | val mont_check:BM.bn_check_modulus_st t_limbs n_limbs | val mont_check:BM.bn_check_modulus_st t_limbs n_limbs | let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 21,
"end_line": 48,
"start_col": 0,
"start_line": 47
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Montgomery.bn_check_modulus_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Montgomery.bn_check_modulus",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs"
] | [] | false | false | false | true | false | let mont_check:BM.bn_check_modulus_st t_limbs n_limbs =
| BM.bn_check_modulus | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.bn_inst | [@@ FStar.Tactics.Typeclasses.tcinstance]
val bn_inst:BN.bn t_limbs | [@@ FStar.Tactics.Typeclasses.tcinstance]
val bn_inst:BN.bn t_limbs | instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
} | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 1,
"end_line": 44,
"start_col": 0,
"start_line": 36
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn Hacl.Bignum4096_32.t_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Mkbn",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum4096_32.add",
"Hacl.Bignum4096_32.sub",
"Hacl.Bignum4096_32.add_mod",
"Hacl.Bignum4096_32.sub_mod",
"Hacl.Bignum4096_32.mul",
"Hacl.Bignum4096_32.sqr"
] | [] | false | false | false | true | false | [@@ FStar.Tactics.Typeclasses.tcinstance]
let bn_inst:BN.bn t_limbs =
| {
BN.len = n_limbs;
BN.add = add;
BN.sub = sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul = mul;
BN.sqr = sqr
} | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.precompr2 | val precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs | val precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs | let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 52,
"start_col": 0,
"start_line": 51
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Montgomery.bn_precomp_r2_mod_n_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Montgomery.bn_precomp_r2_mod_n",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst"
] | [] | false | false | false | true | false | let precompr2:BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
| BM.bn_precomp_r2_mod_n bn_inst | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.repeati_repeat_left_rewrite_type | val repeati_repeat_left_rewrite_type
(#a: Type)
(n: nat)
(pred: (i: nat{i <= n} -> a -> Type))
(f: repeatable #a #n pred)
(x0: a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 == repeat_left 0 n (a' n pred) f x0) | val repeati_repeat_left_rewrite_type
(#a: Type)
(n: nat)
(pred: (i: nat{i <= n} -> a -> Type))
(f: repeatable #a #n pred)
(x0: a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 == repeat_left 0 n (a' n pred) f x0) | let repeati_repeat_left_rewrite_type (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type))
(f:repeatable #a #n pred)
(x0:a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
= assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
by (T.norm [delta_only [`%repeati_inductive;
`%repeat_range_inductive;
`%a']];
T.l_to_r [`nat_refine_equiv];
T.trefl()) | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 126,
"start_col": 0,
"start_line": 115
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x
let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x
let repeati_inductive #a n pred f x0 =
repeat_range_inductive #a 0 n pred f x0
let unfold_repeat_right_once
(lo:nat)
(hi:nat{lo < hi})
(a:(i:nat{lo <= i /\ i <= hi} -> Type))
(f:(i:nat{lo <= i /\ i < hi} -> a i -> a (i + 1)))
(acc:a lo)
: Lemma (repeat_right lo hi a f acc ==
f (hi - 1) (repeat_right lo (hi - 1) a f acc))
= ()
module T = FStar.Tactics
let refine_eq (a:Type) (p q:a -> prop) (x:squash (forall (i:a). p i <==> q i))
: Lemma ((i:a{p i} == i:a{q i}))
= let pext (a:Type) (p q: a -> prop) (_:squash (forall (x:a). p x <==> q x)) (x:a) : Lemma (p x == q x)
= FStar.PropositionalExtensionality.apply (p x) (q x)
in
assert (i:a{p i} == i:a{q i})
by (T.l_to_r [quote (pext a p q x)]; T.trefl())
let nat_refine_equiv (n:nat)
: Lemma ((i:nat{i <= n}) == (i:nat{0<=i /\ i<=n}))
= let b2t_prop (b:bool)
: Lemma ((b2t b) `subtype_of` unit)
= assert_norm (b2t b == squash (equals b true))
in
refine_eq nat (fun (i:nat) -> b2t_prop (i <= n); b2t (i <= n)) (fun (i:nat) -> 0 <= i /\ i <= n) ()
let a' (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type)) = fun (i:nat{i<=n}) -> x:a{pred i x} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Prims.nat ->
pred: (i: Prims.nat{i <= n} -> _: a -> Type) ->
f: Lib.LoopCombinators.repeatable pred ->
x0: a{pred 0 x0}
-> FStar.Pervasives.Lemma
(ensures
Lib.LoopCombinators.repeati_inductive n pred f x0 ==
Lib.LoopCombinators.repeat_left 0 n (Lib.LoopCombinators.a' n pred) f x0) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.LoopCombinators.repeatable",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.eq2",
"Prims.l_or",
"Prims.squash",
"Lib.LoopCombinators.repeati_inductive",
"Lib.LoopCombinators.repeat_left",
"Lib.LoopCombinators.a'",
"Prims.unit",
"FStar.Tactics.V1.Derived.trefl",
"FStar.Tactics.V1.Derived.l_to_r",
"Prims.Cons",
"FStar.Stubs.Reflection.Types.term",
"Prims.Nil",
"FStar.Stubs.Tactics.V1.Builtins.norm",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta_only",
"Prims.string",
"Prims.l_True",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let repeati_repeat_left_rewrite_type
(#a: Type)
(n: nat)
(pred: (i: nat{i <= n} -> a -> Type))
(f: repeatable #a #n pred)
(x0: a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 == repeat_left 0 n (a' n pred) f x0) =
| FStar.Tactics.Effect.assert_by_tactic (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
(fun _ ->
();
(T.norm [delta_only [`%repeati_inductive; `%repeat_range_inductive; `%a']];
T.l_to_r [`nat_refine_equiv];
T.trefl ())) | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.amont_sqr | val amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs | val amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs | let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 42,
"end_line": 96,
"start_col": 0,
"start_line": 95
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.AlmostMontgomery.bn_almost_mont_sqr_st Hacl.Bignum4096_32.t_limbs
Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.AlmostMontgomery.bn_almost_mont_sqr",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst",
"Hacl.Bignum4096_32.areduction"
] | [] | false | false | false | true | false | let amont_sqr:AM.bn_almost_mont_sqr_st t_limbs n_limbs =
| AM.bn_almost_mont_sqr bn_inst areduction | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.to | val to:BM.bn_to_mont_st t_limbs n_limbs | val to:BM.bn_to_mont_st t_limbs n_limbs | let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 60,
"start_col": 0,
"start_line": 59
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Montgomery.bn_to_mont_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Montgomery.bn_to_mont",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst",
"Hacl.Bignum4096_32.reduction"
] | [] | false | false | false | true | false | let to:BM.bn_to_mont_st t_limbs n_limbs =
| BM.bn_to_mont bn_inst reduction | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.repeati_inductive' | val repeati_inductive':
#a:Type
-> n:nat
-> pred:(i:nat{i <= n} -> a -> Type0)
-> f:(i:nat{i < n} -> a -> a)
-> x0:a
-> Pure a
(requires preserves #a #n f pred /\ pred 0 x0)
(ensures fun res -> pred n res /\ res == repeati n f x0) | val repeati_inductive':
#a:Type
-> n:nat
-> pred:(i:nat{i <= n} -> a -> Type0)
-> f:(i:nat{i < n} -> a -> a)
-> x0:a
-> Pure a
(requires preserves #a #n f pred /\ pred 0 x0)
(ensures fun res -> pred n res /\ res == repeati n f x0) | let repeati_inductive' #a n pred f x0 =
let f'
(i:nat{i < n})
(x:a{pred i x /\ x == repeati i f x0})
: x':a{pred (i + 1) x' /\ x' == repeati (i + 1) f x0}
= f i x in
repeat_gen n (fun i -> x:a{pred i x /\ x == repeati i f x0}) f' x0 | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 205,
"start_col": 0,
"start_line": 199
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x
let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x
let repeati_inductive #a n pred f x0 =
repeat_range_inductive #a 0 n pred f x0
let unfold_repeat_right_once
(lo:nat)
(hi:nat{lo < hi})
(a:(i:nat{lo <= i /\ i <= hi} -> Type))
(f:(i:nat{lo <= i /\ i < hi} -> a i -> a (i + 1)))
(acc:a lo)
: Lemma (repeat_right lo hi a f acc ==
f (hi - 1) (repeat_right lo (hi - 1) a f acc))
= ()
module T = FStar.Tactics
let refine_eq (a:Type) (p q:a -> prop) (x:squash (forall (i:a). p i <==> q i))
: Lemma ((i:a{p i} == i:a{q i}))
= let pext (a:Type) (p q: a -> prop) (_:squash (forall (x:a). p x <==> q x)) (x:a) : Lemma (p x == q x)
= FStar.PropositionalExtensionality.apply (p x) (q x)
in
assert (i:a{p i} == i:a{q i})
by (T.l_to_r [quote (pext a p q x)]; T.trefl())
let nat_refine_equiv (n:nat)
: Lemma ((i:nat{i <= n}) == (i:nat{0<=i /\ i<=n}))
= let b2t_prop (b:bool)
: Lemma ((b2t b) `subtype_of` unit)
= assert_norm (b2t b == squash (equals b true))
in
refine_eq nat (fun (i:nat) -> b2t_prop (i <= n); b2t (i <= n)) (fun (i:nat) -> 0 <= i /\ i <= n) ()
let a' (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type)) = fun (i:nat{i<=n}) -> x:a{pred i x}
let repeati_repeat_left_rewrite_type (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type))
(f:repeatable #a #n pred)
(x0:a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
= assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
by (T.norm [delta_only [`%repeati_inductive;
`%repeat_range_inductive;
`%a']];
T.l_to_r [`nat_refine_equiv];
T.trefl())
(* This proof is technical, for multiple reasons.
1. It requires an extensionality lemma at the level to types to
relate the type of a dependent function and an eta expansion of
that type
2. It requires an extensionality lemma at the level of the
computation, which also introduces an eta expansion on f to
retype it
3. The retyping introduces a function type at a different by
propositional equal domain, so it requires a use of rewriting
based on propositional extensionality to prove that the retyping
is benign
The proof was simpler earlier, when F* had eta
equivalence. But the use of eta reduction in the SMT encoding which
this was relying on was a bit dodgy. In particular, the eta
reduction hid the retyping and so was silently (and
unintentionally) also enabling the use of propositional
extensionality. Now, that has to be explicit.
*)
let repeati_inductive_repeat_gen #a n pred f x0 =
let eta_a n (a:(i:nat{0 <= i /\ i <= n} -> Type)) = fun i -> a i in
let eta_f (f:repeatable #a #n pred) (i:nat{i < n}) (x:a' n pred i) : a' n pred (i + 1) = f i x in
let rec repeat_right_eta
(n:nat)
(hi:nat{hi <= n})
(a:(i:nat{0 <= i /\ i <= n} -> Type))
(f:(i:nat{0 <= i /\ i < n} -> a i -> a (i + 1)))
(acc:a 0)
: Lemma (ensures repeat_right 0 hi a f acc == repeat_right 0 hi (eta_a n a) f acc)
(decreases hi)
= if hi = 0
then ()
else (repeat_right_eta n (hi - 1) a f acc)
in
repeat_right_eta n n (a' n pred) (eta_f f) x0;
assert (repeat_gen n (fun i -> x:a{pred i x}) f x0 ==
repeat_right 0 n (fun (i:nat{i <= n}) -> x:a{pred i x}) f x0)
by (T.norm [delta_only [`%repeat_gen]];
T.trefl());
assert_norm (a' n pred == (fun (i:nat{i <= n}) -> x:a{pred i x}));
assert (repeat_right 0 n (fun (i:nat{i <= n}) -> x:a{pred i x}) f x0 ==
repeat_right 0 n (a' n pred) f x0);
let rec repeat_right_eta_f
(hi:nat{hi <= n})
(acc:a' n pred 0)
: Lemma (ensures repeat_right 0 hi (a' n pred) f acc ==
repeat_right 0 hi (a' n pred) (eta_f f) acc)
(decreases hi)
= if hi = 0
then ()
else (repeat_right_eta_f (hi - 1) acc)
in
repeati_repeat_left_rewrite_type n pred f x0;
assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0);
repeat_left_right 0 n (a' n pred) f x0;
assert (repeat_left 0 n (a' n pred) f x0 ==
repeat_right 0 n (a' n pred) f x0);
repeat_right_eta_f n x0
let repeat_gen_inductive n a pred f x0 =
let f' (i:nat{i < n})
(x:a i{pred i x /\ x == repeat_gen i a f x0})
: x':a (i + 1){pred (i + 1) x' /\ x' == repeat_gen (i + 1) a f x0}
= f i x in
repeat_gen n (fun i -> x:a i{pred i x /\ x == repeat_gen i a f x0}) f' x0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Prims.nat ->
pred: (i: Prims.nat{i <= n} -> _: a -> Type0) ->
f: (i: Prims.nat{i < n} -> _: a -> a) ->
x0: a
-> Prims.Pure a | Prims.Pure | [] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Lib.LoopCombinators.repeat_gen",
"Prims.l_and",
"Prims.eq2",
"Lib.LoopCombinators.repeati",
"Prims.op_Addition"
] | [] | false | false | false | false | false | let repeati_inductive' #a n pred f x0 =
| let f' (i: nat{i < n}) (x: a{pred i x /\ x == repeati i f x0})
: x': a{pred (i + 1) x' /\ x' == repeati (i + 1) f x0} =
f i x
in
repeat_gen n (fun i -> x: a{pred i x /\ x == repeati i f x0}) f' x0 | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.almost_mont_inst | [@@ FStar.Tactics.Typeclasses.tcinstance]
val almost_mont_inst:AM.almost_mont t_limbs | [@@ FStar.Tactics.Typeclasses.tcinstance]
val almost_mont_inst:AM.almost_mont t_limbs | instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
} | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 1,
"end_line": 108,
"start_col": 0,
"start_line": 99
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.AlmostMontgomery.almost_mont Hacl.Bignum4096_32.t_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.AlmostMontgomery.Mkalmost_mont",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst",
"Hacl.Bignum4096_32.mont_check",
"Hacl.Bignum4096_32.precompr2",
"Hacl.Bignum4096_32.areduction",
"Hacl.Bignum4096_32.to",
"Hacl.Bignum4096_32.from",
"Hacl.Bignum4096_32.amont_mul",
"Hacl.Bignum4096_32.amont_sqr"
] | [] | false | false | false | true | false | [@@ FStar.Tactics.Typeclasses.tcinstance]
let almost_mont_inst:AM.almost_mont t_limbs =
| {
AM.bn = bn_inst;
AM.mont_check = mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to = to;
AM.from = from;
AM.mul = amont_mul;
AM.sqr = amont_sqr
} | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.from | val from:BM.bn_from_mont_st t_limbs n_limbs | val from:BM.bn_from_mont_st t_limbs n_limbs | let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 64,
"start_col": 0,
"start_line": 63
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Montgomery.bn_from_mont_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Montgomery.bn_from_mont",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst",
"Hacl.Bignum4096_32.reduction"
] | [] | false | false | false | true | false | let from:BM.bn_from_mont_st t_limbs n_limbs =
| BM.bn_from_mont bn_inst reduction | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.amont_mul | val amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs | val amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs | let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 42,
"end_line": 92,
"start_col": 0,
"start_line": 91
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.AlmostMontgomery.bn_almost_mont_mul_st Hacl.Bignum4096_32.t_limbs
Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.AlmostMontgomery.bn_almost_mont_mul",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst",
"Hacl.Bignum4096_32.areduction"
] | [] | false | false | false | true | false | let amont_mul:AM.bn_almost_mont_mul_st t_limbs n_limbs =
| AM.bn_almost_mont_mul bn_inst areduction | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.repeat_gen_inductive | val repeat_gen_inductive:
n:nat
-> a:(i:nat{i <= n} -> Type)
-> pred:(i:nat{i <= n} -> a i -> Type0)
-> f:(i:nat{i < n} -> a i -> a (i + 1))
-> x0:a 0
-> Pure (a n)
(requires preserves_predicate n a f pred /\ pred 0 x0)
(ensures fun res -> pred n res /\ res == repeat_gen n a f x0) | val repeat_gen_inductive:
n:nat
-> a:(i:nat{i <= n} -> Type)
-> pred:(i:nat{i <= n} -> a i -> Type0)
-> f:(i:nat{i < n} -> a i -> a (i + 1))
-> x0:a 0
-> Pure (a n)
(requires preserves_predicate n a f pred /\ pred 0 x0)
(ensures fun res -> pred n res /\ res == repeat_gen n a f x0) | let repeat_gen_inductive n a pred f x0 =
let f' (i:nat{i < n})
(x:a i{pred i x /\ x == repeat_gen i a f x0})
: x':a (i + 1){pred (i + 1) x' /\ x' == repeat_gen (i + 1) a f x0}
= f i x in
repeat_gen n (fun i -> x:a i{pred i x /\ x == repeat_gen i a f x0}) f' x0 | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 75,
"end_line": 197,
"start_col": 0,
"start_line": 192
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x
let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x
let repeati_inductive #a n pred f x0 =
repeat_range_inductive #a 0 n pred f x0
let unfold_repeat_right_once
(lo:nat)
(hi:nat{lo < hi})
(a:(i:nat{lo <= i /\ i <= hi} -> Type))
(f:(i:nat{lo <= i /\ i < hi} -> a i -> a (i + 1)))
(acc:a lo)
: Lemma (repeat_right lo hi a f acc ==
f (hi - 1) (repeat_right lo (hi - 1) a f acc))
= ()
module T = FStar.Tactics
let refine_eq (a:Type) (p q:a -> prop) (x:squash (forall (i:a). p i <==> q i))
: Lemma ((i:a{p i} == i:a{q i}))
= let pext (a:Type) (p q: a -> prop) (_:squash (forall (x:a). p x <==> q x)) (x:a) : Lemma (p x == q x)
= FStar.PropositionalExtensionality.apply (p x) (q x)
in
assert (i:a{p i} == i:a{q i})
by (T.l_to_r [quote (pext a p q x)]; T.trefl())
let nat_refine_equiv (n:nat)
: Lemma ((i:nat{i <= n}) == (i:nat{0<=i /\ i<=n}))
= let b2t_prop (b:bool)
: Lemma ((b2t b) `subtype_of` unit)
= assert_norm (b2t b == squash (equals b true))
in
refine_eq nat (fun (i:nat) -> b2t_prop (i <= n); b2t (i <= n)) (fun (i:nat) -> 0 <= i /\ i <= n) ()
let a' (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type)) = fun (i:nat{i<=n}) -> x:a{pred i x}
let repeati_repeat_left_rewrite_type (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type))
(f:repeatable #a #n pred)
(x0:a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
= assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
by (T.norm [delta_only [`%repeati_inductive;
`%repeat_range_inductive;
`%a']];
T.l_to_r [`nat_refine_equiv];
T.trefl())
(* This proof is technical, for multiple reasons.
1. It requires an extensionality lemma at the level to types to
relate the type of a dependent function and an eta expansion of
that type
2. It requires an extensionality lemma at the level of the
computation, which also introduces an eta expansion on f to
retype it
3. The retyping introduces a function type at a different by
propositional equal domain, so it requires a use of rewriting
based on propositional extensionality to prove that the retyping
is benign
The proof was simpler earlier, when F* had eta
equivalence. But the use of eta reduction in the SMT encoding which
this was relying on was a bit dodgy. In particular, the eta
reduction hid the retyping and so was silently (and
unintentionally) also enabling the use of propositional
extensionality. Now, that has to be explicit.
*)
let repeati_inductive_repeat_gen #a n pred f x0 =
let eta_a n (a:(i:nat{0 <= i /\ i <= n} -> Type)) = fun i -> a i in
let eta_f (f:repeatable #a #n pred) (i:nat{i < n}) (x:a' n pred i) : a' n pred (i + 1) = f i x in
let rec repeat_right_eta
(n:nat)
(hi:nat{hi <= n})
(a:(i:nat{0 <= i /\ i <= n} -> Type))
(f:(i:nat{0 <= i /\ i < n} -> a i -> a (i + 1)))
(acc:a 0)
: Lemma (ensures repeat_right 0 hi a f acc == repeat_right 0 hi (eta_a n a) f acc)
(decreases hi)
= if hi = 0
then ()
else (repeat_right_eta n (hi - 1) a f acc)
in
repeat_right_eta n n (a' n pred) (eta_f f) x0;
assert (repeat_gen n (fun i -> x:a{pred i x}) f x0 ==
repeat_right 0 n (fun (i:nat{i <= n}) -> x:a{pred i x}) f x0)
by (T.norm [delta_only [`%repeat_gen]];
T.trefl());
assert_norm (a' n pred == (fun (i:nat{i <= n}) -> x:a{pred i x}));
assert (repeat_right 0 n (fun (i:nat{i <= n}) -> x:a{pred i x}) f x0 ==
repeat_right 0 n (a' n pred) f x0);
let rec repeat_right_eta_f
(hi:nat{hi <= n})
(acc:a' n pred 0)
: Lemma (ensures repeat_right 0 hi (a' n pred) f acc ==
repeat_right 0 hi (a' n pred) (eta_f f) acc)
(decreases hi)
= if hi = 0
then ()
else (repeat_right_eta_f (hi - 1) acc)
in
repeati_repeat_left_rewrite_type n pred f x0;
assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0);
repeat_left_right 0 n (a' n pred) f x0;
assert (repeat_left 0 n (a' n pred) f x0 ==
repeat_right 0 n (a' n pred) f x0);
repeat_right_eta_f n x0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Prims.nat ->
a: (i: Prims.nat{i <= n} -> Type) ->
pred: (i: Prims.nat{i <= n} -> _: a i -> Type0) ->
f: (i: Prims.nat{i < n} -> _: a i -> a (i + 1)) ->
x0: a 0
-> Prims.Pure (a n) | Prims.Pure | [] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.op_Addition",
"Lib.LoopCombinators.repeat_gen",
"Prims.l_and",
"Prims.eq2"
] | [] | false | false | false | false | false | let repeat_gen_inductive n a pred f x0 =
| let f' (i: nat{i < n}) (x: a i {pred i x /\ x == repeat_gen i a f x0})
: x': a (i + 1) {pred (i + 1) x' /\ x' == repeat_gen (i + 1) a f x0} =
f i x
in
repeat_gen n (fun i -> x: a i {pred i x /\ x == repeat_gen i a f x0}) f' x0 | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.bn_slow_precomp | val bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs | val bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs | let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 41,
"end_line": 112,
"start_col": 0,
"start_line": 111
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.ModReduction.bn_mod_slow_precomp_st Hacl.Bignum4096_32.t_limbs
Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.ModReduction.bn_mod_slow_precomp",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.almost_mont_inst"
] | [] | false | false | false | true | false | let bn_slow_precomp:BR.bn_mod_slow_precomp_st t_limbs n_limbs =
| BR.bn_mod_slow_precomp almost_mont_inst | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.major_type_t | val major_type_t:eqtype | val major_type_t:eqtype | let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 }) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 57,
"end_line": 23,
"start_col": 0,
"start_line": 23
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.t",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.UInt8.v",
"Prims.pow2"
] | [] | false | false | false | true | false | let major_type_t:eqtype =
| (x: U8.t{U8.v x < pow2 3}) | false |
Vale.Inline.X64.Fswap_inline.fsti | Vale.Inline.X64.Fswap_inline.u512 | val u512 : Type0 | let u512 = b:B.buffer UInt64.t{B.length b == 8} | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fswap_inline.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 13,
"start_col": 0,
"start_line": 13
} | module Vale.Inline.X64.Fswap_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4} | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fswap_inline.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let u512 =
| b: B.buffer UInt64.t {B.length b == 8} | false |
|
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.exp_check | val exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs | val exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs | let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 118,
"start_col": 0,
"start_line": 117
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Exponentiation.bn_check_mod_exp_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Exponentiation.bn_check_mod_exp",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs"
] | [] | false | false | false | true | false | let exp_check:BE.bn_check_mod_exp_st t_limbs n_limbs =
| BE.bn_check_mod_exp n_limbs | false |
Vale.Inline.X64.Fswap_inline.fsti | Vale.Inline.X64.Fswap_inline.u256 | val u256 : Type0 | let u256 = b:B.buffer UInt64.t{B.length b == 4} | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fswap_inline.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 11,
"start_col": 0,
"start_line": 11
} | module Vale.Inline.X64.Fswap_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fswap_inline.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let u256 =
| b: B.buffer UInt64.t {B.length b == 4} | false |
|
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.exp_consttime | val exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs | val exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs | let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 138,
"start_col": 0,
"start_line": 137
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Exponentiation.bn_mod_exp_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Exponentiation.mk_bn_mod_exp",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum4096_32.precompr2",
"Hacl.Bignum4096_32.exp_consttime_precomp"
] | [] | false | false | false | true | false | let exp_consttime:BE.bn_mod_exp_st t_limbs n_limbs =
| BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_uint64 | val cbor_major_type_uint64:major_type_t | val cbor_major_type_uint64:major_type_t | let cbor_major_type_uint64 : major_type_t = 0uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 47,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_uint64:major_type_t =
| 0uy | false |
Vale.Inline.X64.Fswap_inline.fsti | Vale.Inline.X64.Fswap_inline.u1024 | val u1024 : Type0 | let u1024 = b:B.buffer UInt64.t{B.length b == 16} | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fswap_inline.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 15,
"start_col": 0,
"start_line": 15
} | module Vale.Inline.X64.Fswap_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4}
unfold
let u512 = b:B.buffer UInt64.t{B.length b == 8} | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fswap_inline.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let u1024 =
| b: B.buffer UInt64.t {B.length b == 16} | false |
|
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_simple_value | val cbor_major_type_simple_value:major_type_t | val cbor_major_type_simple_value:major_type_t | let cbor_major_type_simple_value : major_type_t = 7uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 53,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 }) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_simple_value:major_type_t =
| 7uy | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_exp_vartime | val mod_exp_vartime: BS.bn_mod_exp_safe_st t_limbs n_limbs | val mod_exp_vartime: BS.bn_mod_exp_safe_st t_limbs n_limbs | let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 140,
"start_col": 0,
"start_line": 140
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum4096_32.exp_check",
"Hacl.Bignum4096_32.exp_vartime"
] | [] | false | false | false | true | false | let mod_exp_vartime =
| BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_text_string | val cbor_major_type_text_string:major_type_t | val cbor_major_type_text_string:major_type_t | let cbor_major_type_text_string : major_type_t = 3uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 52,
"end_line": 42,
"start_col": 0,
"start_line": 42
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction
noextract
let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 })
[@@CMacro]
let cbor_major_type_byte_string : major_type_t = 2uy | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_text_string:major_type_t =
| 3uy | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.exp_vartime | val exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs | val exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs | let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 56,
"end_line": 134,
"start_col": 0,
"start_line": 133
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Exponentiation.bn_mod_exp_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Exponentiation.mk_bn_mod_exp",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum4096_32.precompr2",
"Hacl.Bignum4096_32.exp_vartime_precomp"
] | [] | false | false | false | true | false | let exp_vartime:BE.bn_mod_exp_st t_limbs n_limbs =
| BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp | false |
Lib.LoopCombinators.fst | Lib.LoopCombinators.repeati_inductive_repeat_gen | val repeati_inductive_repeat_gen:
#a:Type
-> n:nat
-> pred:(i:nat{i <= n} -> a -> Type)
-> f:repeatable #a #n pred
-> x0:a{pred 0 x0}
-> Lemma (repeati_inductive n pred f x0 == repeat_gen n (fun i -> x:a{pred i x}) f x0) | val repeati_inductive_repeat_gen:
#a:Type
-> n:nat
-> pred:(i:nat{i <= n} -> a -> Type)
-> f:repeatable #a #n pred
-> x0:a{pred 0 x0}
-> Lemma (repeati_inductive n pred f x0 == repeat_gen n (fun i -> x:a{pred i x}) f x0) | let repeati_inductive_repeat_gen #a n pred f x0 =
let eta_a n (a:(i:nat{0 <= i /\ i <= n} -> Type)) = fun i -> a i in
let eta_f (f:repeatable #a #n pred) (i:nat{i < n}) (x:a' n pred i) : a' n pred (i + 1) = f i x in
let rec repeat_right_eta
(n:nat)
(hi:nat{hi <= n})
(a:(i:nat{0 <= i /\ i <= n} -> Type))
(f:(i:nat{0 <= i /\ i < n} -> a i -> a (i + 1)))
(acc:a 0)
: Lemma (ensures repeat_right 0 hi a f acc == repeat_right 0 hi (eta_a n a) f acc)
(decreases hi)
= if hi = 0
then ()
else (repeat_right_eta n (hi - 1) a f acc)
in
repeat_right_eta n n (a' n pred) (eta_f f) x0;
assert (repeat_gen n (fun i -> x:a{pred i x}) f x0 ==
repeat_right 0 n (fun (i:nat{i <= n}) -> x:a{pred i x}) f x0)
by (T.norm [delta_only [`%repeat_gen]];
T.trefl());
assert_norm (a' n pred == (fun (i:nat{i <= n}) -> x:a{pred i x}));
assert (repeat_right 0 n (fun (i:nat{i <= n}) -> x:a{pred i x}) f x0 ==
repeat_right 0 n (a' n pred) f x0);
let rec repeat_right_eta_f
(hi:nat{hi <= n})
(acc:a' n pred 0)
: Lemma (ensures repeat_right 0 hi (a' n pred) f acc ==
repeat_right 0 hi (a' n pred) (eta_f f) acc)
(decreases hi)
= if hi = 0
then ()
else (repeat_right_eta_f (hi - 1) acc)
in
repeati_repeat_left_rewrite_type n pred f x0;
assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0);
repeat_left_right 0 n (a' n pred) f x0;
assert (repeat_left 0 n (a' n pred) f x0 ==
repeat_right 0 n (a' n pred) f x0);
repeat_right_eta_f n x0 | {
"file_name": "lib/Lib.LoopCombinators.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 25,
"end_line": 189,
"start_col": 0,
"start_line": 150
} | module Lib.LoopCombinators
let rec repeat_left lo hi a f acc =
if lo = hi then acc
else repeat_left (lo + 1) hi a f (f lo acc)
let rec repeat_left_all_ml lo hi a f acc =
if lo = hi then acc
else repeat_left_all_ml (lo + 1) hi a f (f lo acc)
let rec repeat_right lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right lo (hi - 1) a f acc)
let rec repeat_right_all_ml lo hi a f acc =
if lo = hi then acc
else f (hi - 1) (repeat_right_all_ml lo (hi - 1) a f acc)
let rec repeat_right_plus lo mi hi a f acc =
if hi = mi then ()
else repeat_right_plus lo mi (hi - 1) a f acc
let unfold_repeat_right lo hi a f acc0 i = ()
let eq_repeat_right lo hi a f acc0 = ()
let rec repeat_left_right lo hi a f acc =
if lo = hi then ()
else
begin
repeat_right_plus lo (lo + 1) hi a f acc;
repeat_left_right (lo + 1) hi a f (f lo acc)
end
let repeat_gen n a f acc0 =
repeat_right 0 n a f acc0
let repeat_gen_all_ml n a f acc0 =
repeat_right_all_ml 0 n a f acc0
let unfold_repeat_gen n a f acc0 i = ()
(* // Proof when using [repeat_left]:
repeat_left_right 0 (i + 1) a f acc0;
repeat_left_right 0 i a f acc0
*)
let eq_repeat_gen0 n a f acc0 = ()
let repeat_gen_def n a f acc0 = ()
let repeati #a n f acc0 =
repeat_gen n (fixed_a a) f acc0
let repeati_all_ml #a n f acc0 =
repeat_gen_all_ml n (fixed_a a) f acc0
let eq_repeati0 #a n f acc0 = ()
let unfold_repeati #a n f acc0 i =
unfold_repeat_gen n (fixed_a a) f acc0 i
let repeati_def #a n f acc0 = ()
let repeat #a n f acc0 =
repeati n (fixed_i f) acc0
let eq_repeat0 #a f acc0 = ()
let unfold_repeat #a n f acc0 i =
unfold_repeati #a n (fixed_i f) acc0 i
let repeat_range #a min max f x =
repeat_left min max (fun _ -> a) f x
let repeat_range_all_ml #a min max f x =
repeat_left_all_ml min max (fun _ -> a) f x
let repeat_range_inductive #a min max pred f x =
repeat_left min max (fun i -> x:a{pred i x}) f x
let repeati_inductive #a n pred f x0 =
repeat_range_inductive #a 0 n pred f x0
let unfold_repeat_right_once
(lo:nat)
(hi:nat{lo < hi})
(a:(i:nat{lo <= i /\ i <= hi} -> Type))
(f:(i:nat{lo <= i /\ i < hi} -> a i -> a (i + 1)))
(acc:a lo)
: Lemma (repeat_right lo hi a f acc ==
f (hi - 1) (repeat_right lo (hi - 1) a f acc))
= ()
module T = FStar.Tactics
let refine_eq (a:Type) (p q:a -> prop) (x:squash (forall (i:a). p i <==> q i))
: Lemma ((i:a{p i} == i:a{q i}))
= let pext (a:Type) (p q: a -> prop) (_:squash (forall (x:a). p x <==> q x)) (x:a) : Lemma (p x == q x)
= FStar.PropositionalExtensionality.apply (p x) (q x)
in
assert (i:a{p i} == i:a{q i})
by (T.l_to_r [quote (pext a p q x)]; T.trefl())
let nat_refine_equiv (n:nat)
: Lemma ((i:nat{i <= n}) == (i:nat{0<=i /\ i<=n}))
= let b2t_prop (b:bool)
: Lemma ((b2t b) `subtype_of` unit)
= assert_norm (b2t b == squash (equals b true))
in
refine_eq nat (fun (i:nat) -> b2t_prop (i <= n); b2t (i <= n)) (fun (i:nat) -> 0 <= i /\ i <= n) ()
let a' (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type)) = fun (i:nat{i<=n}) -> x:a{pred i x}
let repeati_repeat_left_rewrite_type (#a:Type) (n:nat) (pred:(i:nat{i <= n} -> a -> Type))
(f:repeatable #a #n pred)
(x0:a{pred 0 x0})
: Lemma (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
= assert (repeati_inductive n pred f x0 ==
repeat_left 0 n (a' n pred) f x0)
by (T.norm [delta_only [`%repeati_inductive;
`%repeat_range_inductive;
`%a']];
T.l_to_r [`nat_refine_equiv];
T.trefl())
(* This proof is technical, for multiple reasons.
1. It requires an extensionality lemma at the level to types to
relate the type of a dependent function and an eta expansion of
that type
2. It requires an extensionality lemma at the level of the
computation, which also introduces an eta expansion on f to
retype it
3. The retyping introduces a function type at a different by
propositional equal domain, so it requires a use of rewriting
based on propositional extensionality to prove that the retyping
is benign
The proof was simpler earlier, when F* had eta
equivalence. But the use of eta reduction in the SMT encoding which
this was relying on was a bit dodgy. In particular, the eta
reduction hid the retyping and so was silently (and
unintentionally) also enabling the use of propositional
extensionality. Now, that has to be explicit. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.PropositionalExtensionality.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Lib.LoopCombinators.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Prims.nat ->
pred: (i: Prims.nat{i <= n} -> _: a -> Type) ->
f: Lib.LoopCombinators.repeatable pred ->
x0: a{pred 0 x0}
-> FStar.Pervasives.Lemma
(ensures
Lib.LoopCombinators.repeati_inductive n pred f x0 ==
Lib.LoopCombinators.repeat_gen n (fun i -> x: a{pred i x}) f x0) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.LoopCombinators.repeatable",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Lib.LoopCombinators.a'",
"Lib.LoopCombinators.repeat_left",
"Lib.LoopCombinators.repeat_right",
"Lib.LoopCombinators.repeat_left_right",
"Prims.l_or",
"Prims.squash",
"Lib.LoopCombinators.repeati_inductive",
"Lib.LoopCombinators.repeati_repeat_left_rewrite_type",
"Prims.l_True",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Prims.op_Subtraction",
"FStar.Pervasives.assert_norm",
"FStar.Tactics.Effect.assert_by_tactic",
"Lib.LoopCombinators.repeat_gen",
"FStar.Tactics.V1.Derived.trefl",
"FStar.Stubs.Tactics.V1.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta_only",
"Prims.string",
"Prims.l_and",
"Prims.op_LessThan",
"Prims.op_Addition"
] | [] | false | false | true | false | false | let repeati_inductive_repeat_gen #a n pred f x0 =
| let eta_a n (a: (i: nat{0 <= i /\ i <= n} -> Type)) = fun i -> a i in
let eta_f (f: repeatable #a #n pred) (i: nat{i < n}) (x: a' n pred i) : a' n pred (i + 1) = f i x in
let rec repeat_right_eta
(n: nat)
(hi: nat{hi <= n})
(a: (i: nat{0 <= i /\ i <= n} -> Type))
(f: (i: nat{0 <= i /\ i < n} -> a i -> a (i + 1)))
(acc: a 0)
: Lemma (ensures repeat_right 0 hi a f acc == repeat_right 0 hi (eta_a n a) f acc)
(decreases hi) =
if hi = 0 then () else (repeat_right_eta n (hi - 1) a f acc)
in
repeat_right_eta n n (a' n pred) (eta_f f) x0;
FStar.Tactics.Effect.assert_by_tactic (repeat_gen n (fun i -> x: a{pred i x}) f x0 ==
repeat_right 0 n (fun (i: nat{i <= n}) -> x: a{pred i x}) f x0)
(fun _ ->
();
(T.norm [delta_only [`%repeat_gen]];
T.trefl ()));
assert_norm (a' n pred == (fun (i: nat{i <= n}) -> x: a{pred i x}));
assert (repeat_right 0 n (fun (i: nat{i <= n}) -> x: a{pred i x}) f x0 ==
repeat_right 0 n (a' n pred) f x0);
let rec repeat_right_eta_f (hi: nat{hi <= n}) (acc: a' n pred 0)
: Lemma
(ensures repeat_right 0 hi (a' n pred) f acc == repeat_right 0 hi (a' n pred) (eta_f f) acc)
(decreases hi) =
if hi = 0 then () else (repeat_right_eta_f (hi - 1) acc)
in
repeati_repeat_left_rewrite_type n pred f x0;
assert (repeati_inductive n pred f x0 == repeat_left 0 n (a' n pred) f x0);
repeat_left_right 0 n (a' n pred) f x0;
assert (repeat_left 0 n (a' n pred) f x0 == repeat_right 0 n (a' n pred) f x0);
repeat_right_eta_f n x0 | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_neg_int64 | val cbor_major_type_neg_int64:major_type_t | val cbor_major_type_neg_int64:major_type_t | let cbor_major_type_neg_int64 : major_type_t = 1uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 50,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_neg_int64:major_type_t =
| 1uy | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.major_type_uint64_or_neg_int64 | val major_type_uint64_or_neg_int64:eqtype | val major_type_uint64_or_neg_int64:eqtype | let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 }) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 129,
"end_line": 36,
"start_col": 0,
"start_line": 36
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"CBOR.Spec.Constants.major_type_t",
"Prims.l_or",
"Prims.eq2",
"CBOR.Spec.Constants.cbor_major_type_uint64",
"CBOR.Spec.Constants.cbor_major_type_neg_int64"
] | [] | false | false | false | true | false | let major_type_uint64_or_neg_int64:eqtype =
| (x: major_type_t{x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64}) | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_inv_prime_vartime | val mod_inv_prime_vartime: BS.bn_mod_inv_prime_safe_st t_limbs n_limbs | val mod_inv_prime_vartime: BS.bn_mod_inv_prime_safe_st t_limbs n_limbs | let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 75,
"end_line": 144,
"start_col": 0,
"start_line": 144
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_inv_prime_safe_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.SafeAPI.mk_bn_mod_inv_prime_safe",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum4096_32.exp_vartime"
] | [] | false | false | false | true | false | let mod_inv_prime_vartime =
| BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_array | val cbor_major_type_array:major_type_t | val cbor_major_type_array:major_type_t | let cbor_major_type_array : major_type_t = 4uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 46,
"end_line": 49,
"start_col": 0,
"start_line": 49
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction
noextract
let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 })
[@@CMacro]
let cbor_major_type_byte_string : major_type_t = 2uy
[@@CMacro]
let cbor_major_type_text_string : major_type_t = 3uy
inline_for_extraction
noextract
let major_type_byte_string_or_text_string : eqtype = (x: major_type_t { x == cbor_major_type_byte_string \/ x == cbor_major_type_text_string }) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_array:major_type_t =
| 4uy | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mont_ctx_init | val mont_ctx_init: MA.bn_field_init_st t_limbs n_limbs | val mont_ctx_init: MA.bn_field_init_st t_limbs n_limbs | let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 147,
"start_col": 0,
"start_line": 146
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.MontArithmetic.bn_field_init_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"FStar.Monotonic.HyperHeap.rid",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.MontArithmetic.bn_field_init",
"Hacl.Bignum4096_32.precompr2",
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx"
] | [] | false | false | false | true | false | let mont_ctx_init r n =
| MA.bn_field_init n_limbs precompr2 r n | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.add_mod | val add_mod: BN.bn_add_mod_n_st t_limbs n_limbs | val add_mod: BN.bn_add_mod_n_st t_limbs n_limbs | let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 25,
"end_line": 21,
"start_col": 0,
"start_line": 20
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn_add_mod_n_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.bn_add_mod_n",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.bn_add_mod_n_st"
] | [] | false | false | false | true | false | let add_mod:BN.bn_add_mod_n_st t_limbs n_limbs =
| BN.bn_add_mod_n n_limbs | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_exp_consttime | val mod_exp_consttime: BS.bn_mod_exp_safe_st t_limbs n_limbs | val mod_exp_consttime: BS.bn_mod_exp_safe_st t_limbs n_limbs | let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 77,
"end_line": 142,
"start_col": 0,
"start_line": 142
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_exp_safe_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_safe",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum4096_32.exp_check",
"Hacl.Bignum4096_32.exp_consttime"
] | [] | false | false | false | true | false | let mod_exp_consttime =
| BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mont_ctx_free | val mont_ctx_free: MA.bn_field_free_st t_limbs | val mont_ctx_free: MA.bn_field_free_st t_limbs | let mont_ctx_free k =
MA.bn_field_free k | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 150,
"start_col": 0,
"start_line": 149
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.MontArithmetic.bn_field_free_st Hacl.Bignum4096_32.t_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum.MontArithmetic.bn_field_free",
"Prims.unit"
] | [] | false | false | false | true | false | let mont_ctx_free k =
| MA.bn_field_free k | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_byte_string | val cbor_major_type_byte_string:major_type_t | val cbor_major_type_byte_string:major_type_t | let cbor_major_type_byte_string : major_type_t = 2uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 52,
"end_line": 39,
"start_col": 0,
"start_line": 39
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction
noextract
let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 }) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_byte_string:major_type_t =
| 2uy | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_tagged | val cbor_major_type_tagged:major_type_t | val cbor_major_type_tagged:major_type_t | let cbor_major_type_tagged : major_type_t = 6uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 47,
"end_line": 55,
"start_col": 0,
"start_line": 55
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction
noextract
let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 })
[@@CMacro]
let cbor_major_type_byte_string : major_type_t = 2uy
[@@CMacro]
let cbor_major_type_text_string : major_type_t = 3uy
inline_for_extraction
noextract
let major_type_byte_string_or_text_string : eqtype = (x: major_type_t { x == cbor_major_type_byte_string \/ x == cbor_major_type_text_string })
[@@CMacro]
let cbor_major_type_array : major_type_t = 4uy
[@@CMacro]
let cbor_major_type_map : major_type_t = 5uy | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_tagged:major_type_t =
| 6uy | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.new_bn_from_bytes_le | val new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs | val new_bn_from_bytes_le: BS.new_bn_from_bytes_le_st t_limbs | let new_bn_from_bytes_le = BS.new_bn_from_bytes_le | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 50,
"end_line": 167,
"start_col": 0,
"start_line": 167
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.new_bn_from_bytes_le_st Hacl.Bignum4096_32.t_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.SafeAPI.new_bn_from_bytes_le",
"Hacl.Bignum4096_32.t_limbs"
] | [] | false | false | false | true | false | let new_bn_from_bytes_le =
| BS.new_bn_from_bytes_le | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.major_type_byte_string_or_text_string | val major_type_byte_string_or_text_string:eqtype | val major_type_byte_string_or_text_string:eqtype | let major_type_byte_string_or_text_string : eqtype = (x: major_type_t { x == cbor_major_type_byte_string \/ x == cbor_major_type_text_string }) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 143,
"end_line": 46,
"start_col": 0,
"start_line": 46
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction
noextract
let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 })
[@@CMacro]
let cbor_major_type_byte_string : major_type_t = 2uy
[@@CMacro]
let cbor_major_type_text_string : major_type_t = 3uy
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"CBOR.Spec.Constants.major_type_t",
"Prims.l_or",
"Prims.eq2",
"CBOR.Spec.Constants.cbor_major_type_byte_string",
"CBOR.Spec.Constants.cbor_major_type_text_string"
] | [] | false | false | false | true | false | let major_type_byte_string_or_text_string:eqtype =
| (x: major_type_t{x == cbor_major_type_byte_string \/ x == cbor_major_type_text_string}) | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.lt_mask | val lt_mask: BN.bn_lt_mask_st t_limbs n_limbs | val lt_mask: BN.bn_lt_mask_st t_limbs n_limbs | let lt_mask = BN.bn_lt_mask n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 173,
"start_col": 0,
"start_line": 173
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le
let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes
let bn_to_bytes_le = Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn_lt_mask_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.bn_lt_mask",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs"
] | [] | false | false | false | true | false | let lt_mask =
| BN.bn_lt_mask n_limbs | false |
CBOR.Spec.Constants.fst | CBOR.Spec.Constants.cbor_major_type_map | val cbor_major_type_map:major_type_t | val cbor_major_type_map:major_type_t | let cbor_major_type_map : major_type_t = 5uy | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.Constants.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 44,
"end_line": 52,
"start_col": 0,
"start_line": 52
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module CBOR.Spec.Constants
module U8 = FStar.UInt8
inline_for_extraction
noextract
let major_type_t : eqtype = (x: U8.t { U8.v x < pow2 3 })
[@@CMacro]
let cbor_major_type_simple_value : major_type_t = 7uy
[@@CMacro]
let cbor_major_type_uint64 : major_type_t = 0uy
[@@CMacro]
let cbor_major_type_neg_int64 : major_type_t = 1uy
inline_for_extraction
noextract
let major_type_uint64_or_neg_int64 : eqtype = (x: major_type_t { x == cbor_major_type_uint64 \/ x == cbor_major_type_neg_int64 })
[@@CMacro]
let cbor_major_type_byte_string : major_type_t = 2uy
[@@CMacro]
let cbor_major_type_text_string : major_type_t = 3uy
inline_for_extraction
noextract
let major_type_byte_string_or_text_string : eqtype = (x: major_type_t { x == cbor_major_type_byte_string \/ x == cbor_major_type_text_string })
[@@CMacro]
let cbor_major_type_array : major_type_t = 4uy | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.Constants.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | CBOR.Spec.Constants.major_type_t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.__uint_to_t"
] | [] | false | false | false | true | false | let cbor_major_type_map:major_type_t =
| 5uy | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.eq_mask | val eq_mask: BN.bn_eq_mask_st t_limbs n_limbs | val eq_mask: BN.bn_eq_mask_st t_limbs n_limbs | let eq_mask = BN.bn_eq_mask n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 175,
"start_col": 0,
"start_line": 175
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le
let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes
let bn_to_bytes_le = Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes
let lt_mask = BN.bn_lt_mask n_limbs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn_eq_mask_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.bn_eq_mask",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs"
] | [] | false | false | false | true | false | let eq_mask =
| BN.bn_eq_mask n_limbs | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.sub_mod | val sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs | val sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs | let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 25,
"end_line": 24,
"start_col": 0,
"start_line": 23
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.bn_sub_mod_n_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.bn_sub_mod_n",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.bn_sub_mod_n_st"
] | [] | false | false | false | true | false | let sub_mod:BN.bn_sub_mod_n_st t_limbs n_limbs =
| BN.bn_sub_mod_n n_limbs | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.new_bn_from_bytes_be | val new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs | val new_bn_from_bytes_be: BS.new_bn_from_bytes_be_st t_limbs | let new_bn_from_bytes_be = BS.new_bn_from_bytes_be | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 50,
"end_line": 165,
"start_col": 0,
"start_line": 165
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.new_bn_from_bytes_be_st Hacl.Bignum4096_32.t_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.SafeAPI.new_bn_from_bytes_be",
"Hacl.Bignum4096_32.t_limbs"
] | [] | false | false | false | true | false | let new_bn_from_bytes_be =
| BS.new_bn_from_bytes_be | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_inv_prime_vartime_precomp | val mod_inv_prime_vartime_precomp: BS.bn_mod_inv_prime_ctx_st t_limbs n_limbs | val mod_inv_prime_vartime_precomp: BS.bn_mod_inv_prime_ctx_st t_limbs n_limbs | let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 72,
"end_line": 163,
"start_col": 0,
"start_line": 161
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_inv_prime_ctx_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.SafeAPI.mk_bn_mod_inv_prime_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum.ModInv.mk_bn_mod_inv_prime_precomp",
"Hacl.Bignum4096_32.exp_vartime_precomp",
"Prims.unit"
] | [] | false | false | false | true | false | let mod_inv_prime_vartime_precomp k a res =
| BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp)
k
a
res | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.sqr | val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a | val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a | let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 31,
"start_col": 0,
"start_line": 30
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Hacl.Bignum4096_32.lbignum Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs
-> Hacl.Bignum.bn_karatsuba_sqr_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs a | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum4096_32.lbignum",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.bn_karatsuba_sqr",
"Hacl.Bignum.bn_karatsuba_sqr_st"
] | [] | false | false | false | false | false | let sqr (a: lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
| BN.bn_karatsuba_sqr n_limbs a | false |
Vale.Inline.X64.Fswap_inline.fsti | Vale.Inline.X64.Fswap_inline.as_nat | val as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat | val as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat | let as_nat (b:B.buffer UInt64.t{B.length b == 4}) (h:HS.mem) : GTot nat =
let s = B.as_seq h b in
let s0 = UInt64.v (Seq.index s 0) in
let s1 = UInt64.v (Seq.index s 1) in
let s2 = UInt64.v (Seq.index s 2) in
let s3 = UInt64.v (Seq.index s 3) in
pow2_four s0 s1 s2 s3 | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fswap_inline.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 23,
"start_col": 0,
"start_line": 17
} | module Vale.Inline.X64.Fswap_inline
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4}
unfold
let u512 = b:B.buffer UInt64.t{B.length b == 8}
unfold
let u1024 = b:B.buffer UInt64.t{B.length b == 16} | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Inline.X64.Fswap_inline.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: LowStar.Buffer.buffer FStar.UInt64.t {LowStar.Monotonic.Buffer.length b == 4} ->
h: FStar.Monotonic.HyperStack.mem
-> Prims.GTot Prims.nat | Prims.GTot | [
"sometrivial"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"FStar.Monotonic.HyperStack.mem",
"Vale.Curve25519.Fast_defs.pow2_four",
"FStar.UInt.uint_t",
"FStar.UInt64.v",
"FStar.Seq.Base.index",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"Prims.nat"
] | [] | false | false | false | false | false | let as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat =
| let s = B.as_seq h b in
let s0 = UInt64.v (Seq.index s 0) in
let s1 = UInt64.v (Seq.index s 1) in
let s2 = UInt64.v (Seq.index s 2) in
let s3 = UInt64.v (Seq.index s 3) in
pow2_four s0 s1 s2 s3 | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.reduction | val reduction:BM.bn_mont_reduction_st t_limbs n_limbs | val reduction:BM.bn_mont_reduction_st t_limbs n_limbs | let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 56,
"start_col": 0,
"start_line": 55
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Montgomery.bn_mont_reduction_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Montgomery.bn_mont_reduction",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst"
] | [] | false | false | false | true | false | let reduction:BM.bn_mont_reduction_st t_limbs n_limbs =
| BM.bn_mont_reduction bn_inst | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod | val mod: BS.bn_mod_slow_safe_st t_limbs n_limbs | val mod: BS.bn_mod_slow_safe_st t_limbs n_limbs | let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 94,
"end_line": 115,
"start_col": 0,
"start_line": 114
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_slow_safe_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.SafeAPI.mk_bn_mod_slow_safe",
"Hacl.Bignum.ModReduction.mk_bn_mod_slow",
"Hacl.Bignum4096_32.precompr2",
"Hacl.Bignum4096_32.bn_slow_precomp",
"Prims.bool"
] | [] | false | false | false | true | false | let mod n a res =
| BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mul | val mul: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_mul_st t_limbs n_limbs a | val mul: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_mul_st t_limbs n_limbs a | let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 27,
"start_col": 0,
"start_line": 26
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Hacl.Bignum4096_32.lbignum Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs
-> Hacl.Bignum.bn_karatsuba_mul_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs a | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum4096_32.lbignum",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.bn_karatsuba_mul",
"Hacl.Bignum.bn_karatsuba_mul_st"
] | [] | false | false | false | false | false | let mul (a: lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
| BN.bn_karatsuba_mul n_limbs a | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack | val inspect_pack (t:R.term_view)
: Lemma (ensures R.(inspect_ln (pack_ln t) == t))
[SMTPat R.(inspect_ln (pack_ln t))] | val inspect_pack (t:R.term_view)
: Lemma (ensures R.(inspect_ln (pack_ln t) == t))
[SMTPat R.(inspect_ln (pack_ln t))] | let inspect_pack = R.inspect_pack_inv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 35,
"start_col": 0,
"start_line": 35
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.V2.Data.term_view
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_ln (FStar.Stubs.Reflection.V2.Builtins.pack_ln t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_ln (FStar.Stubs.Reflection.V2.Builtins.pack_ln
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_inv"
] | [] | true | false | true | false | false | let inspect_pack =
| R.inspect_pack_inv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect_namedv | val pack_inspect_namedv (t:R.namedv)
: Lemma (ensures R.(pack_namedv (inspect_namedv t) == t))
[SMTPat R.(pack_namedv (inspect_namedv t))] | val pack_inspect_namedv (t:R.namedv)
: Lemma (ensures R.(pack_namedv (inspect_namedv t) == t))
[SMTPat R.(pack_namedv (inspect_namedv t))] | let pack_inspect_namedv = R.pack_inspect_namedv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 39,
"start_col": 0,
"start_line": 39
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.namedv
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_namedv (FStar.Stubs.Reflection.V2.Builtins.inspect_namedv
t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_namedv (FStar.Stubs.Reflection.V2.Builtins.inspect_namedv
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_namedv"
] | [] | true | false | true | false | false | let pack_inspect_namedv =
| R.pack_inspect_namedv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack_namedv | val inspect_pack_namedv (t:R.namedv_view)
: Lemma (ensures R.(inspect_namedv (pack_namedv t) == t))
[SMTPat R.(inspect_namedv (pack_namedv t))] | val inspect_pack_namedv (t:R.namedv_view)
: Lemma (ensures R.(inspect_namedv (pack_namedv t) == t))
[SMTPat R.(inspect_namedv (pack_namedv t))] | let inspect_pack_namedv = R.inspect_pack_namedv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 38,
"start_col": 0,
"start_line": 38
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.V2.Data.namedv_view
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_namedv (FStar.Stubs.Reflection.V2.Builtins.pack_namedv
t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_namedv (FStar.Stubs.Reflection.V2.Builtins.pack_namedv
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_namedv"
] | [] | true | false | true | false | false | let inspect_pack_namedv =
| R.inspect_pack_namedv | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.exp_vartime_precomp | val exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | val exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul) | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 124,
"start_col": 0,
"start_line": 121
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Exponentiation.bn_mod_exp_precomp_st Hacl.Bignum4096_32.t_limbs
Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Exponentiation.bn_mod_exp_vartime_precomp",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_bm_vartime_precomp",
"Hacl.Bignum4096_32.almost_mont_inst",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_fw_vartime_precomp",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | false | let exp_vartime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs =
| BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul) | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.exp_consttime_precomp | val exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | val exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs | let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul) | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 65,
"end_line": 130,
"start_col": 0,
"start_line": 127
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Exponentiation.bn_mod_exp_precomp_st Hacl.Bignum4096_32.t_limbs
Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Exponentiation.bn_mod_exp_consttime_precomp",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_bm_consttime_precomp",
"Hacl.Bignum4096_32.almost_mont_inst",
"Hacl.Bignum.Exponentiation.bn_mod_exp_amm_fw_consttime_precomp",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | false | let exp_consttime_precomp:BE.bn_mod_exp_precomp_st t_limbs n_limbs =
| BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul) | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_precomp | val mod_precomp: BS.bn_mod_slow_ctx_st t_limbs n_limbs | val mod_precomp: BS.bn_mod_slow_ctx_st t_limbs n_limbs | let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 153,
"start_col": 0,
"start_line": 152
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_slow_ctx_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum4096_32.n_limbs",
"Hacl.Bignum.SafeAPI.bn_mod_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum4096_32.bn_slow_precomp",
"Prims.unit"
] | [] | false | false | false | true | false | let mod_precomp k a res =
| BS.bn_mod_ctx n_limbs bn_slow_precomp k a res | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.areduction | val areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs | val areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs | let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 37,
"end_line": 88,
"start_col": 0,
"start_line": 87
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// } | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.AlmostMontgomery.bn_almost_mont_reduction_st Hacl.Bignum4096_32.t_limbs
Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.AlmostMontgomery.bn_almost_mont_reduction",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.bn_inst"
] | [] | false | false | false | true | false | let areduction:AM.bn_almost_mont_reduction_st t_limbs n_limbs =
| AM.bn_almost_mont_reduction bn_inst | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack_bv | val inspect_pack_bv (t:R.bv_view)
: Lemma (ensures R.(inspect_bv (pack_bv t) == t))
[SMTPat R.(inspect_bv (pack_bv t))] | val inspect_pack_bv (t:R.bv_view)
: Lemma (ensures R.(inspect_bv (pack_bv t) == t))
[SMTPat R.(inspect_bv (pack_bv t))] | let inspect_pack_bv = R.inspect_pack_bv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 41,
"start_col": 0,
"start_line": 41
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.V2.Data.bv_view
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_bv (FStar.Stubs.Reflection.V2.Builtins.pack_bv t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_bv (FStar.Stubs.Reflection.V2.Builtins.pack_bv
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_bv"
] | [] | true | false | true | false | false | let inspect_pack_bv =
| R.inspect_pack_bv | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_exp_vartime_precomp | val mod_exp_vartime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | val mod_exp_vartime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 156,
"start_col": 0,
"start_line": 155
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_exp_ctx_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum4096_32.n_limbs",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.blocks0",
"Lib.IntTypes.size",
"Lib.IntTypes.bits",
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum4096_32.exp_vartime_precomp",
"Prims.unit"
] | [] | false | false | false | true | false | let mod_exp_vartime_precomp k a bBits b res =
| BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect_binder | val pack_inspect_binder (t:R.binder)
: Lemma (ensures (R.pack_binder (R.inspect_binder t) == t))
[SMTPat (R.pack_binder (R.inspect_binder t))] | val pack_inspect_binder (t:R.binder)
: Lemma (ensures (R.pack_binder (R.inspect_binder t) == t))
[SMTPat (R.pack_binder (R.inspect_binder t))] | let pack_inspect_binder = R.pack_inspect_binder | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 45,
"start_col": 0,
"start_line": 45
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.binder
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_binder (FStar.Stubs.Reflection.V2.Builtins.inspect_binder
t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_binder (FStar.Stubs.Reflection.V2.Builtins.inspect_binder
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_binder"
] | [] | true | false | true | false | false | let pack_inspect_binder =
| R.pack_inspect_binder | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack_binder | val inspect_pack_binder (bview:R.binder_view)
: Lemma (ensures R.(R.inspect_binder (R.pack_binder bview) == bview))
[SMTPat R.(inspect_binder (pack_binder bview))] | val inspect_pack_binder (bview:R.binder_view)
: Lemma (ensures R.(R.inspect_binder (R.pack_binder bview) == bview))
[SMTPat R.(inspect_binder (pack_binder bview))] | let inspect_pack_binder = R.inspect_pack_binder | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 44,
"start_col": 0,
"start_line": 44
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | bview: FStar.Stubs.Reflection.V2.Data.binder_view
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_binder (FStar.Stubs.Reflection.V2.Builtins.pack_binder
bview) ==
bview)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_binder (FStar.Stubs.Reflection.V2.Builtins.pack_binder
bview))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_binder"
] | [] | true | false | true | false | false | let inspect_pack_binder =
| R.inspect_pack_binder | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect_comp | val pack_inspect_comp (t:R.comp)
: Lemma (ensures (R.pack_comp (R.inspect_comp t) == t))
[SMTPat (R.pack_comp (R.inspect_comp t))] | val pack_inspect_comp (t:R.comp)
: Lemma (ensures (R.pack_comp (R.inspect_comp t) == t))
[SMTPat (R.pack_comp (R.inspect_comp t))] | let pack_inspect_comp = R.pack_inspect_comp_inv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 48,
"start_col": 0,
"start_line": 48
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.comp
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_comp (FStar.Stubs.Reflection.V2.Builtins.inspect_comp
t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_comp (FStar.Stubs.Reflection.V2.Builtins.inspect_comp
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_comp_inv"
] | [] | true | false | true | false | false | let pack_inspect_comp =
| R.pack_inspect_comp_inv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect_bv | val pack_inspect_bv (t:R.bv)
: Lemma (ensures R.(pack_bv (inspect_bv t) == t))
[SMTPat R.(pack_bv (inspect_bv t))] | val pack_inspect_bv (t:R.bv)
: Lemma (ensures R.(pack_bv (inspect_bv t) == t))
[SMTPat R.(pack_bv (inspect_bv t))] | let pack_inspect_bv = R.pack_inspect_bv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 42,
"start_col": 0,
"start_line": 42
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.bv
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_bv (FStar.Stubs.Reflection.V2.Builtins.inspect_bv t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_bv (FStar.Stubs.Reflection.V2.Builtins.inspect_bv
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_bv"
] | [] | true | false | true | false | false | let pack_inspect_bv =
| R.pack_inspect_bv | false |
Pulse.Checker.Base.fsti | Pulse.Checker.Base.checker_result_inv | val checker_result_inv : g: Pulse.Typing.Env.env ->
post_hint: Pulse.Typing.post_hint_opt g ->
x: Pulse.Syntax.Base.var ->
g1: Pulse.Typing.Env.env ->
t:
FStar.Pervasives.dtuple3 Pulse.Syntax.Base.universe
(fun _ -> Pulse.Syntax.Base.term)
(fun u109 t -> Pulse.Typing.universe_of g1 t u109) ->
ctxt':
Prims.dtuple2 Pulse.Syntax.Base.vprop
(fun ctxt' -> Pulse.Typing.tot_typing g1 ctxt' Pulse.Syntax.Base.tm_vprop)
-> Prims.logical | let checker_result_inv (g:env) (post_hint:post_hint_opt g)
(x:var)
(g1:env)
(t:(u:universe & t:term & universe_of g1 t u))
(ctxt':(ctxt':vprop & tot_typing g1 ctxt' tm_vprop)) =
let (| _, t, _ |) = t in
let (| ctxt', _ |) = ctxt' in
checker_res_matches_post_hint g post_hint x t ctxt' /\
lookup g1 x == Some t | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 23,
"end_line": 148,
"start_col": 0,
"start_line": 139
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
open Pulse.Typing.Combinators
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module Metatheory = Pulse.Typing.Metatheory
val debug (g:env) (f:unit -> T.Tac string) : T.Tac unit
val format_failed_goal (g:env) (ctxt:list term) (goal:list term) : T.Tac string
val intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(iname_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
val post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g)
(RT.mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
(RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term tm_vprop)))
val intro_post_hint (g:env) (effect_annot:effect_annot) (ret_ty:option term) (post:term)
: T.Tac (h:post_hint_for_env g{h.effect_annot == effect_annot})
val post_hint_from_comp_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: post_hint_for_env g
val comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
val extend_post_hint (g:env) (p:post_hint_for_env g)
(x:var{ None? (lookup g x) }) (tx:term)
(conjunct:term) (_:tot_typing (push_binding g x ppname_default tx) conjunct tm_vprop)
: T.Tac (q:post_hint_for_env (push_binding g x ppname_default tx) {
q.post == tm_star p.post conjunct /\
q.ret_ty == p.ret_ty /\
q.u == p.u /\
q.effect_annot == p.effect_annot
})
type continuation_elaborator
(g:env) (ctxt:vprop)
(g':env { g' `env_extends` g }) (ctxt':vprop) =
post_hint:post_hint_opt g ->
st_typing_in_ctxt g' ctxt' post_hint ->
T.Tac (st_typing_in_ctxt g ctxt post_hint)
val k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
val k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
val k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2'
//
// A canonical continuation elaborator for Bind
//
val continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt))
val continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
val check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp)
let checker_res_matches_post_hint
(g:env)
(post_hint:post_hint_opt g)
(x:var) (t:term) (ctxt':vprop) =
match post_hint with
| None -> True
| Some post_hint ->
t == post_hint.ret_ty /\
ctxt' == open_term post_hint.post x | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Base.fsti"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
post_hint: Pulse.Typing.post_hint_opt g ->
x: Pulse.Syntax.Base.var ->
g1: Pulse.Typing.Env.env ->
t:
FStar.Pervasives.dtuple3 Pulse.Syntax.Base.universe
(fun _ -> Pulse.Syntax.Base.term)
(fun u109 t -> Pulse.Typing.universe_of g1 t u109) ->
ctxt':
Prims.dtuple2 Pulse.Syntax.Base.vprop
(fun ctxt' -> Pulse.Typing.tot_typing g1 ctxt' Pulse.Syntax.Base.tm_vprop)
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.post_hint_opt",
"Pulse.Syntax.Base.var",
"FStar.Pervasives.dtuple3",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.term",
"Pulse.Typing.universe_of",
"Prims.dtuple2",
"Pulse.Syntax.Base.vprop",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Prims.l_and",
"Pulse.Checker.Base.checker_res_matches_post_hint",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"FStar.Pervasives.Native.Some",
"Prims.logical"
] | [] | false | false | false | false | true | let checker_result_inv
(g: env)
(post_hint: post_hint_opt g)
(x: var)
(g1: env)
(t: (u: universe & t: term & universe_of g1 t u))
(ctxt': (ctxt': vprop & tot_typing g1 ctxt' tm_vprop))
=
| let (| _ , t , _ |) = t in
let (| ctxt' , _ |) = ctxt' in
checker_res_matches_post_hint g post_hint x t ctxt' /\ lookup g1 x == Some t | false |
|
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.mod_exp_consttime_precomp | val mod_exp_consttime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | val mod_exp_consttime_precomp: BS.bn_mod_exp_ctx_st t_limbs n_limbs | let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 159,
"start_col": 0,
"start_line": 158
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.SafeAPI.bn_mod_exp_ctx_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_limbs | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.MontArithmetic.pbn_mont_ctx",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum4096_32.n_limbs",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.blocks0",
"Lib.IntTypes.size",
"Lib.IntTypes.bits",
"Hacl.Bignum.SafeAPI.mk_bn_mod_exp_ctx",
"FStar.Ghost.hide",
"Hacl.Bignum.meta_len",
"Hacl.Bignum4096_32.exp_consttime_precomp",
"Prims.unit"
] | [] | false | false | false | true | false | let mod_exp_consttime_precomp k a bBits b res =
| BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack_comp | val inspect_pack_comp (t:R.comp_view)
: Lemma (ensures (R.inspect_comp (R.pack_comp t) == t))
[SMTPat (R.inspect_comp (R.pack_comp t))] | val inspect_pack_comp (t:R.comp_view)
: Lemma (ensures (R.inspect_comp (R.pack_comp t) == t))
[SMTPat (R.inspect_comp (R.pack_comp t))] | let inspect_pack_comp = R.inspect_pack_comp_inv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 47,
"start_col": 0,
"start_line": 47
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.V2.Data.comp_view
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_comp (FStar.Stubs.Reflection.V2.Builtins.pack_comp
t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_comp (FStar.Stubs.Reflection.V2.Builtins.pack_comp
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_comp_inv"
] | [] | true | false | true | false | false | let inspect_pack_comp =
| R.inspect_pack_comp_inv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack_fv | val inspect_pack_fv (nm:R.name)
: Lemma (ensures R.inspect_fv (R.pack_fv nm) == nm)
[SMTPat (R.inspect_fv (R.pack_fv nm))] | val inspect_pack_fv (nm:R.name)
: Lemma (ensures R.inspect_fv (R.pack_fv nm) == nm)
[SMTPat (R.inspect_fv (R.pack_fv nm))] | let inspect_pack_fv = R.inspect_pack_fv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 50,
"start_col": 0,
"start_line": 50
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | nm: FStar.Stubs.Reflection.Types.name
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_fv (FStar.Stubs.Reflection.V2.Builtins.pack_fv nm
) ==
nm)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_fv (FStar.Stubs.Reflection.V2.Builtins.pack_fv
nm))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_fv"
] | [] | true | false | true | false | false | let inspect_pack_fv =
| R.inspect_pack_fv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect_fv | val pack_inspect_fv (fv:R.fv)
: Lemma (ensures R.pack_fv (R.inspect_fv fv) == fv)
[SMTPat (R.pack_fv (R.inspect_fv fv))] | val pack_inspect_fv (fv:R.fv)
: Lemma (ensures R.pack_fv (R.inspect_fv fv) == fv)
[SMTPat (R.pack_fv (R.inspect_fv fv))] | let pack_inspect_fv = R.pack_inspect_fv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 51,
"start_col": 0,
"start_line": 51
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | fv: FStar.Stubs.Reflection.Types.fv
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_fv (FStar.Stubs.Reflection.V2.Builtins.inspect_fv fv
) ==
fv)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_fv (FStar.Stubs.Reflection.V2.Builtins.inspect_fv
fv))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_fv"
] | [] | true | false | true | false | false | let pack_inspect_fv =
| R.pack_inspect_fv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.inspect_pack_universe | val inspect_pack_universe (u:R.universe_view)
: Lemma (ensures R.inspect_universe (R.pack_universe u) == u)
[SMTPat (R.inspect_universe (R.pack_universe u))] | val inspect_pack_universe (u:R.universe_view)
: Lemma (ensures R.inspect_universe (R.pack_universe u) == u)
[SMTPat (R.inspect_universe (R.pack_universe u))] | let inspect_pack_universe = R.inspect_pack_universe | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 53,
"start_col": 0,
"start_line": 53
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | u72: FStar.Stubs.Reflection.V2.Data.universe_view
-> FStar.Pervasives.Lemma
(ensures
FStar.Stubs.Reflection.V2.Builtins.inspect_universe (FStar.Stubs.Reflection.V2.Builtins.pack_universe
u72) ==
u72)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.inspect_universe (FStar.Stubs.Reflection.V2.Builtins.pack_universe
u72))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.inspect_pack_universe"
] | [] | true | false | true | false | false | let inspect_pack_universe =
| R.inspect_pack_universe | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect | val pack_inspect (t:R.term)
: Lemma (requires ~(Tv_Unsupp? (inspect_ln t)))
(ensures R.(pack_ln (inspect_ln t) == t))
[SMTPat R.(pack_ln (inspect_ln t))] | val pack_inspect (t:R.term)
: Lemma (requires ~(Tv_Unsupp? (inspect_ln t)))
(ensures R.(pack_ln (inspect_ln t) == t))
[SMTPat R.(pack_ln (inspect_ln t))] | let pack_inspect = R.pack_inspect_inv | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 36,
"start_col": 0,
"start_line": 36
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.term
-> FStar.Pervasives.Lemma
(requires ~(Tv_Unsupp? (FStar.Stubs.Reflection.V2.Builtins.inspect_ln t)))
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_ln (FStar.Stubs.Reflection.V2.Builtins.inspect_ln t) ==
t)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_ln (FStar.Stubs.Reflection.V2.Builtins.inspect_ln
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_inv"
] | [] | true | false | true | false | false | let pack_inspect =
| R.pack_inspect_inv | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.open_term | val open_term (t:term) (v:var) : term | val open_term (t:term) (v:var) : term | let open_term (t:term) (v:var) = RTB.open_term t v | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 72,
"start_col": 0,
"start_line": 72
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.term -> v: FStar.Stubs.Reflection.V2.Data.var
-> FStar.Stubs.Reflection.Types.term | Prims.Tot | [
"total"
] | [] | [
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Reflection.Typing.Builtins.open_term"
] | [] | false | false | false | true | false | let open_term (t: term) (v: var) =
| RTB.open_term t v | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.open_with | val open_with (t:term) (v:term) : term | val open_with (t:term) (v:term) : term | let open_with (t:term) (v:term) = RTB.open_with t v | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 68,
"start_col": 0,
"start_line": 68
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.term -> v: FStar.Stubs.Reflection.Types.term
-> FStar.Stubs.Reflection.Types.term | Prims.Tot | [
"total"
] | [] | [
"FStar.Stubs.Reflection.Types.term",
"FStar.Reflection.Typing.Builtins.open_with"
] | [] | false | false | false | true | false | let open_with (t v: term) =
| RTB.open_with t v | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_term | val close_term (t:term) (v:var) : term | val close_term (t:term) (v:var) : term | let close_term (t:term) (v:var) = RTB.close_term t v | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 52,
"end_line": 76,
"start_col": 0,
"start_line": 76
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.term -> v: FStar.Stubs.Reflection.V2.Data.var
-> FStar.Stubs.Reflection.Types.term | Prims.Tot | [
"total"
] | [] | [
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Reflection.Typing.Builtins.close_term"
] | [] | false | false | false | true | false | let close_term (t: term) (v: var) =
| RTB.close_term t v | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.rename | val rename (t:term) (x y:var) : term | val rename (t:term) (x y:var) : term | let rename (t:term) (x y:var)= RTB.rename t x y | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 80,
"start_col": 0,
"start_line": 80
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
t: FStar.Stubs.Reflection.Types.term ->
x: FStar.Stubs.Reflection.V2.Data.var ->
y: FStar.Stubs.Reflection.V2.Data.var
-> FStar.Stubs.Reflection.Types.term | Prims.Tot | [
"total"
] | [] | [
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Reflection.Typing.Builtins.rename"
] | [] | false | false | false | true | false | let rename (t: term) (x y: var) =
| RTB.rename t x y | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.bn_to_bytes_be | val bn_to_bytes_be: Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs n_bytes | val bn_to_bytes_be: Hacl.Bignum.Convert.bn_to_bytes_be_st t_limbs n_bytes | let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 169,
"start_col": 0,
"start_line": 169
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Convert.bn_to_bytes_be_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_bytes | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Convert.mk_bn_to_bytes_be",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_bytes"
] | [] | false | false | false | true | false | let bn_to_bytes_be =
| Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes | false |
Hacl.Bignum4096_32.fst | Hacl.Bignum4096_32.bn_to_bytes_le | val bn_to_bytes_le: Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs n_bytes | val bn_to_bytes_le: Hacl.Bignum.Convert.bn_to_bytes_le_st t_limbs n_bytes | let bn_to_bytes_le = Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 171,
"start_col": 0,
"start_line": 171
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module AM = Hacl.Bignum.AlmostMontgomery
module BE = Hacl.Bignum.Exponentiation
module BR = Hacl.Bignum.ModReduction
module BI = Hacl.Bignum.ModInv
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
let add: BN.bn_add_eq_len_st t_limbs n_limbs =
BN.bn_add_eq_len n_limbs
let sub: BN.bn_sub_eq_len_st t_limbs n_limbs =
BN.bn_sub_eq_len n_limbs
let add_mod: BN.bn_add_mod_n_st t_limbs n_limbs =
BN.bn_add_mod_n n_limbs
let sub_mod: BN.bn_sub_mod_n_st t_limbs n_limbs =
BN.bn_sub_mod_n n_limbs
let mul (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_mul_st t_limbs n_limbs a =
BN.bn_karatsuba_mul n_limbs a
//BN.bn_mul n_limbs n_limbs a
let sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =
BN.bn_karatsuba_sqr n_limbs a
//BN.bn_sqr n_limbs a
//BN.bn_mul n_limbs n_limbs a a
inline_for_extraction noextract
instance bn_inst: BN.bn t_limbs = {
BN.len = n_limbs;
BN.add;
BN.sub;
BN.add_mod_n = add_mod;
BN.sub_mod_n = sub_mod;
BN.mul;
BN.sqr
}
[@CInline]
let mont_check: BM.bn_check_modulus_st t_limbs n_limbs =
BM.bn_check_modulus
[@CInline]
let precompr2: BM.bn_precomp_r2_mod_n_st t_limbs n_limbs =
BM.bn_precomp_r2_mod_n bn_inst
[@CInline]
let reduction: BM.bn_mont_reduction_st t_limbs n_limbs =
BM.bn_mont_reduction bn_inst
[@CInline]
let to: BM.bn_to_mont_st t_limbs n_limbs =
BM.bn_to_mont bn_inst reduction
[@CInline]
let from: BM.bn_from_mont_st t_limbs n_limbs =
BM.bn_from_mont bn_inst reduction
// [@CInline]
// let mont_mul: BM.bn_mont_mul_st t_limbs n_limbs =
// BM.bn_mont_mul bn_inst reduction
// [@CInline]
// let mont_sqr: BM.bn_mont_sqr_st t_limbs n_limbs =
// BM.bn_mont_sqr bn_inst reduction
// inline_for_extraction noextract
// instance mont_inst: BM.mont t_limbs = {
// BM.bn = bn_inst;
// BM.mont_check;
// BM.precomp = precompr2;
// BM.reduction;
// BM.to;
// BM.from;
// BM.mul = mont_mul;
// BM.sqr = mont_sqr;
// }
[@CInline]
let areduction: AM.bn_almost_mont_reduction_st t_limbs n_limbs =
AM.bn_almost_mont_reduction bn_inst
[@CInline]
let amont_mul: AM.bn_almost_mont_mul_st t_limbs n_limbs =
AM.bn_almost_mont_mul bn_inst areduction
[@CInline]
let amont_sqr: AM.bn_almost_mont_sqr_st t_limbs n_limbs =
AM.bn_almost_mont_sqr bn_inst areduction
inline_for_extraction noextract
instance almost_mont_inst: AM.almost_mont t_limbs = {
AM.bn = bn_inst;
AM.mont_check;
AM.precomp = precompr2;
AM.reduction = areduction;
AM.to;
AM.from;
AM.mul = amont_mul;
AM.sqr = amont_sqr;
}
[@CInline]
let bn_slow_precomp : BR.bn_mod_slow_precomp_st t_limbs n_limbs =
BR.bn_mod_slow_precomp almost_mont_inst
let mod n a res =
BS.mk_bn_mod_slow_safe n_limbs (BR.mk_bn_mod_slow n_limbs precompr2 bn_slow_precomp) n a res
let exp_check: BE.bn_check_mod_exp_st t_limbs n_limbs =
BE.bn_check_mod_exp n_limbs
[@CInline]
let exp_vartime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_vartime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_vartime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_vartime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_consttime_precomp: BE.bn_mod_exp_precomp_st t_limbs n_limbs =
BE.bn_mod_exp_consttime_precomp n_limbs
(BE.bn_mod_exp_amm_bm_consttime_precomp almost_mont_inst)
(BE.bn_mod_exp_amm_fw_consttime_precomp almost_mont_inst 4ul)
[@CInline]
let exp_vartime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_vartime_precomp
[@CInline]
let exp_consttime: BE.bn_mod_exp_st t_limbs n_limbs =
BE.mk_bn_mod_exp n_limbs precompr2 exp_consttime_precomp
let mod_exp_vartime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_vartime
let mod_exp_consttime = BS.mk_bn_mod_exp_safe n_limbs exp_check exp_consttime
let mod_inv_prime_vartime = BS.mk_bn_mod_inv_prime_safe n_limbs exp_vartime
let mont_ctx_init r n =
MA.bn_field_init n_limbs precompr2 r n
let mont_ctx_free k =
MA.bn_field_free k
let mod_precomp k a res =
BS.bn_mod_ctx n_limbs bn_slow_precomp k a res
let mod_exp_vartime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_vartime_precomp k a bBits b res
let mod_exp_consttime_precomp k a bBits b res =
BS.mk_bn_mod_exp_ctx n_limbs exp_consttime_precomp k a bBits b res
let mod_inv_prime_vartime_precomp k a res =
BS.mk_bn_mod_inv_prime_ctx n_limbs
(BI.mk_bn_mod_inv_prime_precomp n_limbs exp_vartime_precomp) k a res
let new_bn_from_bytes_be = BS.new_bn_from_bytes_be
let new_bn_from_bytes_le = BS.new_bn_from_bytes_le
let bn_to_bytes_be = Hacl.Bignum.Convert.mk_bn_to_bytes_be true n_bytes | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.ModReduction.fst.checked",
"Hacl.Bignum.ModInv.fst.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.AlmostMontgomery.fsti.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.Typeclasses.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": true,
"source_file": "Hacl.Bignum4096_32.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModInv",
"short_module": "BI"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.ModReduction",
"short_module": "BR"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.AlmostMontgomery",
"short_module": "AM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Convert.bn_to_bytes_le_st Hacl.Bignum4096_32.t_limbs Hacl.Bignum4096_32.n_bytes | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Convert.mk_bn_to_bytes_le",
"Hacl.Bignum4096_32.t_limbs",
"Hacl.Bignum4096_32.n_bytes"
] | [] | false | false | false | true | false | let bn_to_bytes_le =
| Hacl.Bignum.Convert.mk_bn_to_bytes_le true n_bytes | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.pack_inspect_universe | val pack_inspect_universe (u:R.universe)
: Lemma (requires ~(Uv_Unk? (inspect_universe u)))
(ensures R.pack_universe (R.inspect_universe u) == u)
[SMTPat (R.pack_universe (R.inspect_universe u))] | val pack_inspect_universe (u:R.universe)
: Lemma (requires ~(Uv_Unk? (inspect_universe u)))
(ensures R.pack_universe (R.inspect_universe u) == u)
[SMTPat (R.pack_universe (R.inspect_universe u))] | let pack_inspect_universe = R.pack_inspect_universe | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 54,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | u75: FStar.Stubs.Reflection.Types.universe
-> FStar.Pervasives.Lemma
(requires ~(Uv_Unk? (FStar.Stubs.Reflection.V2.Builtins.inspect_universe u75)))
(ensures
FStar.Stubs.Reflection.V2.Builtins.pack_universe (FStar.Stubs.Reflection.V2.Builtins.inspect_universe
u75) ==
u75)
[
SMTPat (FStar.Stubs.Reflection.V2.Builtins.pack_universe (FStar.Stubs.Reflection.V2.Builtins.inspect_universe
u75))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.V2.Builtins.pack_inspect_universe"
] | [] | true | false | true | false | false | let pack_inspect_universe =
| R.pack_inspect_universe | false |
Pulse.Checker.Base.fsti | Pulse.Checker.Base.checker_res_matches_post_hint | val checker_res_matches_post_hint : g: Pulse.Typing.Env.env ->
post_hint: Pulse.Typing.post_hint_opt g ->
x: Pulse.Syntax.Base.var ->
t: Pulse.Syntax.Base.term ->
ctxt': Pulse.Syntax.Base.vprop
-> Prims.logical | let checker_res_matches_post_hint
(g:env)
(post_hint:post_hint_opt g)
(x:var) (t:term) (ctxt':vprop) =
match post_hint with
| None -> True
| Some post_hint ->
t == post_hint.ret_ty /\
ctxt' == open_term post_hint.post x | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 39,
"end_line": 137,
"start_col": 0,
"start_line": 128
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module RT = FStar.Reflection.Typing
module R = FStar.Reflection.V2
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
open Pulse.Typing.Combinators
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module Metatheory = Pulse.Typing.Metatheory
val debug (g:env) (f:unit -> T.Tac string) : T.Tac unit
val format_failed_goal (g:env) (ctxt:list term) (goal:list term) : T.Tac string
val intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(iname_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
val post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g)
(RT.mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
(RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term tm_vprop)))
val intro_post_hint (g:env) (effect_annot:effect_annot) (ret_ty:option term) (post:term)
: T.Tac (h:post_hint_for_env g{h.effect_annot == effect_annot})
val post_hint_from_comp_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: post_hint_for_env g
val comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
val extend_post_hint (g:env) (p:post_hint_for_env g)
(x:var{ None? (lookup g x) }) (tx:term)
(conjunct:term) (_:tot_typing (push_binding g x ppname_default tx) conjunct tm_vprop)
: T.Tac (q:post_hint_for_env (push_binding g x ppname_default tx) {
q.post == tm_star p.post conjunct /\
q.ret_ty == p.ret_ty /\
q.u == p.u /\
q.effect_annot == p.effect_annot
})
type continuation_elaborator
(g:env) (ctxt:vprop)
(g':env { g' `env_extends` g }) (ctxt':vprop) =
post_hint:post_hint_opt g ->
st_typing_in_ctxt g' ctxt' post_hint ->
T.Tac (st_typing_in_ctxt g ctxt post_hint)
val k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
val k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
val k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2'
//
// A canonical continuation elaborator for Bind
//
val continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt))
val continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
val check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Base.fsti"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
post_hint: Pulse.Typing.post_hint_opt g ->
x: Pulse.Syntax.Base.var ->
t: Pulse.Syntax.Base.term ->
ctxt': Pulse.Syntax.Base.vprop
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.post_hint_opt",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.vprop",
"Prims.l_True",
"Pulse.Typing.post_hint_t",
"Prims.l_and",
"Prims.eq2",
"Pulse.Typing.__proj__Mkpost_hint_t__item__ret_ty",
"Pulse.Syntax.Naming.open_term",
"Pulse.Typing.__proj__Mkpost_hint_t__item__post",
"Prims.logical"
] | [] | false | false | false | false | true | let checker_res_matches_post_hint
(g: env)
(post_hint: post_hint_opt g)
(x: var)
(t: term)
(ctxt': vprop)
=
| match post_hint with
| None -> True
| Some post_hint -> t == post_hint.ret_ty /\ ctxt' == open_term post_hint.post x | false |
|
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.binder_offset_pattern_invariant | val binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) | val binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss)) | let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 62,
"end_line": 129,
"start_col": 0,
"start_line": 111
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: FStar.Stubs.Reflection.V2.Data.pattern -> ss: FStar.Reflection.Typing.subst
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.binder_offset_pattern p ==
FStar.Reflection.Typing.binder_offset_pattern (FStar.Reflection.Typing.subst_pattern p ss))
(decreases p) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"binder_offset_pattern_invariant",
"binder_offset_patterns_invariant"
] | [
"FStar.Stubs.Reflection.V2.Data.pattern",
"FStar.Reflection.Typing.subst",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Reflection.V2.Data.universes",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"FStar.Reflection.Typing.binder_offset_patterns_invariant",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.nat",
"FStar.Reflection.Typing.binder_offset_pattern",
"FStar.Reflection.Typing.subst_pattern",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec binder_offset_pattern_invariant (p: pattern) (ss: subst)
: Lemma (ensures binder_offset_pattern p == binder_offset_pattern (subst_pattern p ss))
(decreases p) =
| match p with
| Pat_Cons _ _ pats -> binder_offset_patterns_invariant pats ss
| _ -> () | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.binder_offset_patterns_invariant | val binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) | val binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss)) | let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 62,
"end_line": 129,
"start_col": 0,
"start_line": 111
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: Prims.list (FStar.Stubs.Reflection.V2.Data.pattern * Prims.bool) ->
ss: FStar.Reflection.Typing.subst
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.binder_offset_patterns p ==
FStar.Reflection.Typing.binder_offset_patterns (FStar.Reflection.Typing.subst_patterns p ss)
) (decreases p) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"binder_offset_pattern_invariant",
"binder_offset_patterns_invariant"
] | [
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Stubs.Reflection.V2.Data.pattern",
"Prims.bool",
"FStar.Reflection.Typing.subst",
"FStar.Reflection.Typing.binder_offset_patterns_invariant",
"FStar.Reflection.Typing.shift_subst_n",
"Prims.nat",
"FStar.Reflection.Typing.binder_offset_pattern",
"Prims.unit",
"FStar.Reflection.Typing.binder_offset_pattern_invariant",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.binder_offset_patterns",
"FStar.Reflection.Typing.subst_patterns",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec binder_offset_patterns_invariant (p: list (pattern & bool)) (ss: subst)
: Lemma (ensures binder_offset_patterns p == binder_offset_patterns (subst_patterns p ss))
(decreases p) =
| match p with
| [] -> ()
| (hd, _) :: tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss) | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.open_close_inverse | val open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e) | val open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e) | let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 352,
"start_col": 0,
"start_line": 348
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
() | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
e: FStar.Stubs.Reflection.Types.term{FStar.Reflection.Typing.ln e} ->
x: FStar.Stubs.Reflection.V2.Data.var
-> FStar.Pervasives.Lemma
(ensures FStar.Reflection.Typing.open_term (FStar.Reflection.Typing.close_term e x) x == e) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.Types.term",
"Prims.b2t",
"FStar.Reflection.Typing.ln",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Reflection.Typing.open_close_inverse'",
"Prims.unit",
"FStar.Reflection.Typing.open_term_spec",
"FStar.Reflection.Typing.close_term",
"FStar.Reflection.Typing.close_term_spec",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.open_term",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let open_close_inverse (e: R.term{ln e}) (x: var) : Lemma (open_term (close_term e x) x == e) =
| close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_open_inverse | val close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e) | val close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e) | let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 568,
"start_col": 0,
"start_line": 564
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
e: FStar.Stubs.Reflection.Types.term ->
x: FStar.Stubs.Reflection.V2.Data.var{~(FStar.Set.mem x (FStar.Reflection.Typing.freevars e))}
-> FStar.Pervasives.Lemma
(ensures FStar.Reflection.Typing.close_term (FStar.Reflection.Typing.open_term e x) x == e) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars",
"FStar.Reflection.Typing.close_open_inverse'",
"Prims.unit",
"FStar.Reflection.Typing.close_term_spec",
"FStar.Reflection.Typing.open_term",
"FStar.Reflection.Typing.open_term_spec",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.close_term",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let close_open_inverse (e: R.term) (x: var{~(x `Set.mem` (freevars e))})
: Lemma (close_term (open_term e x) x == e) =
| open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.mkif | val mkif
(g:fstar_env)
(scrutinee:term)
(then_:term)
(else_:term)
(ty:term)
(u_ty:universe)
(hyp:var { None? (lookup_bvar g hyp) /\ ~(hyp `Set.mem` (freevars then_ `Set.union` freevars else_)) })
(eff:T.tot_or_ghost)
(ty_eff:T.tot_or_ghost)
(ts : typing g scrutinee (eff, bool_ty))
(tt : typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee true_bool)) then_ (eff, ty))
(te : typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee false_bool)) else_ (eff, ty))
(tr : typing g ty (ty_eff, tm_type u_ty))
: typing g (mk_if scrutinee then_ else_) (eff, ty) | val mkif
(g:fstar_env)
(scrutinee:term)
(then_:term)
(else_:term)
(ty:term)
(u_ty:universe)
(hyp:var { None? (lookup_bvar g hyp) /\ ~(hyp `Set.mem` (freevars then_ `Set.union` freevars else_)) })
(eff:T.tot_or_ghost)
(ty_eff:T.tot_or_ghost)
(ts : typing g scrutinee (eff, bool_ty))
(tt : typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee true_bool)) then_ (eff, ty))
(te : typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee false_bool)) else_ (eff, ty))
(tr : typing g ty (ty_eff, tm_type u_ty))
: typing g (mk_if scrutinee then_ else_) (eff, ty) | let mkif
(g:fstar_env)
(scrutinee:term)
(then_:term)
(else_:term)
(ty:term)
(u_ty:universe)
(hyp:var { None? (lookup_bvar g hyp) /\ ~(hyp `Set.mem` (freevars then_ `Set.union` freevars else_)) })
(eff:T.tot_or_ghost)
(ty_eff:T.tot_or_ghost)
(ts : typing g scrutinee (eff, bool_ty))
(tt : typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee true_bool)) then_ (eff, ty))
(te : typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee false_bool)) else_ (eff, ty))
(tr : typing g ty (ty_eff, tm_type u_ty))
: typing g (mk_if scrutinee then_ else_) (eff, ty)
= let brt = (Pat_Constant C_True, then_) in
let bre = (Pat_Constant C_False, else_) in
bindings_ok_pat_constant g C_True;
bindings_ok_pat_constant g C_False;
let brty () : branches_typing g u_zero bool_ty scrutinee (eff,ty) [brt; bre] [[]; []] =
BT_S (Pat_Constant C_True, then_) []
(BO (Pat_Constant C_True) [] hyp then_ () tt)
_ _ (
BT_S (Pat_Constant C_False, else_) []
(BO (Pat_Constant C_False) [] hyp else_ () te)
_ _
BT_Nil)
in
T_Match g u_zero bool_ty scrutinee T.E_Total (T_FVar g bool_fv) eff ts [brt; bre] (eff, ty)
[[]; []]
(MC_Tok g scrutinee bool_ty _ _ (Squash.return_squash (if_complete_match g scrutinee)))
(brty ()) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 13,
"end_line": 971,
"start_col": 0,
"start_line": 940
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x
let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i
let equiv_arrow #g #e1 #e2 ty q x eq =
assume (~ (x `Set.mem` (freevars e1 `Set.union` freevars e2)));
let c1 = T.E_Total, e1 in
let c2 = T.E_Total, e2 in
Rel_arrow _ _ _ _ c1 c2 _ _ (Rel_refl _ _ _) (Relc_typ _ _ _ _ _ eq)
let equiv_abs_close #g #e1 #e2 ty q x eq =
// TODO: the following can be the preconditions?
// or derived from equiv?
assume (ln' e1 (-1));
assume (ln' e2 (-1));
// this should be a lemma
assume (~ (x `Set.mem` (freevars (subst_term e1 [ ND x 0 ]) `Set.union`
freevars (subst_term e2 [ ND x 0 ]))));
open_close_inverse' 0 e1 x;
open_close_inverse' 0 e2 x;
let eq
: equiv (extend_env g x ty)
(subst_term
(subst_term e1 [ ND x 0 ])
(open_with_var x 0))
(subst_term
(subst_term e2 [ ND x 0 ])
(open_with_var x 0)) =
eq in
Rel_abs _ _ _ _ _ _ _ (Rel_refl _ _ _) eq
let rec open_with_gt_ln e i t j
: Lemma (requires ln' e i /\ i < j)
(ensures subst_term e [ DT j t ] == e)
(decreases e) =
match inspect_ln e with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_Var _
| Tv_BVar _ -> ()
| Tv_App hd argv ->
open_with_gt_ln hd i t j;
open_with_gt_ln (fst argv) i t j
| Tv_Abs b body ->
open_with_gt_ln_binder b i t j;
open_with_gt_ln body (i + 1) t (j + 1)
| Tv_Arrow b c ->
open_with_gt_ln_binder b i t j;
open_with_gt_ln_comp c (i + 1) t (j + 1)
| Tv_Refine b f ->
open_with_gt_ln_binder b i t j;
open_with_gt_ln f (i + 1) t (j + 1)
| Tv_Uvar j c -> admit ()
| Tv_Let recf attrs b def body ->
open_with_gt_ln_terms attrs i t j;
open_with_gt_ln_binder b i t j;
(if recf
then open_with_gt_ln def (i + 1) t (j + 1)
else open_with_gt_ln def i t j);
open_with_gt_ln body (i + 1) t (j + 1)
| Tv_Match scr ret brs ->
open_with_gt_ln scr i t j;
(match ret with
| None -> ()
| Some ret -> open_with_gt_ln_match_returns ret i t j);
open_with_gt_ln_branches brs i t j
| Tv_AscribedT e t1 tac _ ->
open_with_gt_ln e i t j;
open_with_gt_ln t1 i t j;
(match tac with
| None -> ()
| Some tac -> open_with_gt_ln tac i t j)
| Tv_AscribedC e c tac _ ->
open_with_gt_ln e i t j;
open_with_gt_ln_comp c i t j;
(match tac with
| None -> ()
| Some tac -> open_with_gt_ln tac i t j)
and open_with_gt_ln_binder (b:binder) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_binder b i /\ i < j)
(ensures subst_binder b [ DT j t ] == b)
(decreases b) =
let {attrs;sort} = inspect_binder b in
open_with_gt_ln sort i t j;
open_with_gt_ln_terms attrs i t j
and open_with_gt_ln_comp (c:comp) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_comp c i /\ i < j)
(ensures subst_comp c [ DT j t ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t1
| C_GTotal t1 -> open_with_gt_ln t1 i t j
| C_Lemma pre post pats ->
open_with_gt_ln pre i t j;
open_with_gt_ln post i t j;
open_with_gt_ln pats i t j
| C_Eff _ _ res args decrs ->
open_with_gt_ln res i t j;
open_args_with_gt_ln_args args i t j;
open_with_gt_ln_terms decrs i t j
and open_with_gt_ln_terms (l:list term) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_terms l i /\ i < j)
(ensures subst_terms l [ DT j t ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
open_with_gt_ln hd i t j;
open_with_gt_ln_terms tl i t j
and open_with_gt_ln_match_returns (m:match_returns_ascription) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_match_returns m i /\ i < j)
(ensures subst_match_returns m [ DT j t ] == m)
(decreases m) =
let b, (ret, as_, _) = m in
open_with_gt_ln_binder b i t j;
(match ret with
| Inl t1 -> open_with_gt_ln t1 (i + 1) t (j + 1)
| Inr c -> open_with_gt_ln_comp c (i + 1) t (j + 1));
(match as_ with
| None -> ()
| Some t1 -> open_with_gt_ln t1 (i + 1) t (j + 1))
and open_with_gt_ln_branches (l:list branch) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_branches l i /\ i < j)
(ensures subst_branches l [ DT j t ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
open_with_gt_ln_branch hd i t j;
open_with_gt_ln_branches tl i t j
and open_args_with_gt_ln_args (l:list argv) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_args l i /\ i < j)
(ensures subst_args l [ DT j t ] == l)
(decreases l) =
match l with
| [] -> ()
| (t1, _)::tl ->
open_with_gt_ln t1 i t j;
open_args_with_gt_ln_args tl i t j
and open_with_gt_ln_branch (b:branch) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_branch b i /\ i < j)
(ensures subst_branch b [ DT j t ] == b)
(decreases b) =
let p, t1 = b in
open_with_gt_ln_pat p i t j;
let k = binder_offset_pattern p in
open_with_gt_ln t1 (i + k) t (j + k)
and open_with_gt_ln_pat (p:pattern) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_pattern p i /\ i < j)
(ensures subst_pattern p [ DT j t ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
open_with_gt_ln_pats pats i t j
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t1 -> open_with_gt_ln t1 i t j)
and open_with_gt_ln_pats (l:list (pattern & bool)) (i:nat) (t:term) (j:nat)
: Lemma (requires ln'_patterns l i /\ i < j)
(ensures subst_patterns l [ DT j t ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
open_with_gt_ln_pat (fst hd) i t j;
let k = binder_offset_pattern (fst hd) in
open_with_gt_ln_pats tl (i + k) t (j + k)
let if_complete_match (g:env) (t:term) = magic() | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: FStar.Reflection.Typing.fstar_env ->
scrutinee: FStar.Stubs.Reflection.Types.term ->
then_: FStar.Stubs.Reflection.Types.term ->
else_: FStar.Stubs.Reflection.Types.term ->
ty: FStar.Stubs.Reflection.Types.term ->
u_ty: FStar.Stubs.Reflection.Types.universe ->
hyp:
FStar.Stubs.Reflection.V2.Data.var
{ None? (FStar.Reflection.Typing.lookup_bvar g hyp) /\
~(FStar.Set.mem hyp
(FStar.Set.union (FStar.Reflection.Typing.freevars then_)
(FStar.Reflection.Typing.freevars else_))) } ->
eff: FStar.Stubs.TypeChecker.Core.tot_or_ghost ->
ty_eff: FStar.Stubs.TypeChecker.Core.tot_or_ghost ->
ts: FStar.Reflection.Typing.typing g scrutinee (eff, FStar.Reflection.Typing.bool_ty) ->
tt:
FStar.Reflection.Typing.typing (FStar.Reflection.Typing.extend_env g
hyp
(FStar.Reflection.Typing.eq2 (FStar.Stubs.Reflection.V2.Builtins.pack_universe FStar.Stubs.Reflection.V2.Data.Uv_Zero
)
FStar.Reflection.Typing.bool_ty
scrutinee
FStar.Reflection.Typing.true_bool))
then_
(eff,
ty) ->
te:
FStar.Reflection.Typing.typing (FStar.Reflection.Typing.extend_env g
hyp
(FStar.Reflection.Typing.eq2 (FStar.Stubs.Reflection.V2.Builtins.pack_universe FStar.Stubs.Reflection.V2.Data.Uv_Zero
)
FStar.Reflection.Typing.bool_ty
scrutinee
FStar.Reflection.Typing.false_bool))
else_
(eff,
ty) ->
tr: FStar.Reflection.Typing.typing g ty (ty_eff, FStar.Reflection.Typing.tm_type u_ty)
-> FStar.Reflection.Typing.typing g
(FStar.Reflection.Typing.mk_if scrutinee then_ else_)
(eff,
ty) | Prims.Tot | [
"total"
] | [] | [
"FStar.Reflection.Typing.fstar_env",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.Types.universe",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_None",
"FStar.Reflection.Typing.lookup_bvar",
"Prims.l_not",
"FStar.Set.mem",
"FStar.Set.union",
"FStar.Reflection.Typing.freevars",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Reflection.Typing.typing",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Reflection.Typing.bool_ty",
"FStar.Reflection.Typing.extend_env",
"FStar.Reflection.Typing.eq2",
"FStar.Stubs.Reflection.V2.Builtins.pack_universe",
"FStar.Stubs.Reflection.V2.Data.Uv_Zero",
"FStar.Reflection.Typing.true_bool",
"FStar.Reflection.Typing.false_bool",
"FStar.Reflection.Typing.tm_type",
"FStar.Reflection.Typing.T_Match",
"FStar.Reflection.Typing.u_zero",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Reflection.Typing.T_FVar",
"FStar.Reflection.Typing.bool_fv",
"Prims.Cons",
"FStar.Stubs.Reflection.V2.Data.branch",
"Prims.Nil",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.binding",
"FStar.Reflection.Typing.MC_Tok",
"FStar.List.Tot.Base.map",
"FStar.Stubs.Reflection.V2.Data.pattern",
"FStar.Pervasives.Native.fst",
"FStar.Squash.return_squash",
"FStar.Stubs.Tactics.V2.Builtins.match_complete_token",
"FStar.Reflection.Typing.if_complete_match",
"Prims.unit",
"FStar.Reflection.Typing.branches_typing",
"FStar.Reflection.Typing.BT_S",
"FStar.Stubs.Reflection.V2.Data.Pat_Constant",
"FStar.Stubs.Reflection.V2.Data.C_True",
"FStar.Reflection.Typing.BO",
"FStar.Stubs.Reflection.V2.Data.C_False",
"FStar.Reflection.Typing.BT_Nil",
"FStar.Reflection.Typing.bindings_ok_pat_constant",
"FStar.Pervasives.Native.tuple2",
"FStar.Reflection.Typing.mk_if"
] | [] | false | false | false | false | false | let mkif
(g: fstar_env)
(scrutinee then_ else_ ty: term)
(u_ty: universe)
(hyp:
var
{ None? (lookup_bvar g hyp) /\
~(hyp `Set.mem` ((freevars then_) `Set.union` (freevars else_))) })
(eff ty_eff: T.tot_or_ghost)
(ts: typing g scrutinee (eff, bool_ty))
(tt:
typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee true_bool))
then_
(eff, ty))
(te:
typing (extend_env g hyp (eq2 (pack_universe Uv_Zero) bool_ty scrutinee false_bool))
else_
(eff, ty))
(tr: typing g ty (ty_eff, tm_type u_ty))
: typing g (mk_if scrutinee then_ else_) (eff, ty) =
| let brt = (Pat_Constant C_True, then_) in
let bre = (Pat_Constant C_False, else_) in
bindings_ok_pat_constant g C_True;
bindings_ok_pat_constant g C_False;
let brty () : branches_typing g u_zero bool_ty scrutinee (eff, ty) [brt; bre] [[]; []] =
BT_S (Pat_Constant C_True, then_)
[]
(BO (Pat_Constant C_True) [] hyp then_ () tt)
_
_
(BT_S (Pat_Constant C_False, else_) [] (BO (Pat_Constant C_False) [] hyp else_ () te) _ _ BT_Nil
)
in
T_Match g
u_zero
bool_ty
scrutinee
T.E_Total
(T_FVar g bool_fv)
eff
ts
[brt; bre]
(eff, ty)
[[]; []]
(MC_Tok g scrutinee bool_ty _ _ (Squash.return_squash (if_complete_match g scrutinee)))
(brty ()) | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_with_not_free_var | val close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t) | val close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Stubs.Reflection.Types.term -> x: FStar.Stubs.Reflection.V2.Data.var -> i: Prims.nat
-> FStar.Pervasives.Lemma (requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars t)))
(ensures FStar.Reflection.Typing.subst_term t [FStar.Reflection.Typing.ND x i] == t)
(decreases t) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Stubs.Reflection.V2.Builtins.inspect_ln",
"FStar.Stubs.Reflection.Types.namedv",
"FStar.Stubs.Reflection.Types.bv",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Stubs.Reflection.V2.Data.universes",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Reflection.Typing.close_with_not_free_var",
"Prims.unit",
"FStar.Stubs.Reflection.Types.binder",
"Prims.op_Addition",
"FStar.Reflection.Typing.close_binder_with_not_free_var",
"FStar.Stubs.Reflection.Types.comp",
"FStar.Reflection.Typing.close_comp_with_not_free_var",
"FStar.Stubs.Reflection.Types.universe",
"FStar.Stubs.Reflection.V2.Data.simple_binder",
"FStar.Stubs.Reflection.V2.Data.vconst",
"FStar.Stubs.Reflection.Types.ctx_uvar_and_subst",
"Prims._assert",
"Prims.l_False",
"Prims.bool",
"Prims.list",
"FStar.Reflection.Typing.close_terms_with_not_free_var",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Reflection.Types.match_returns_ascription",
"FStar.Stubs.Reflection.V2.Data.branch",
"FStar.Reflection.Typing.close_branches_with_not_free_var",
"FStar.Reflection.Typing.close_match_returns_with_not_free_var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_term",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_with_not_free_var (t: R.term) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars t))) (ensures subst_term t [ND x i] == t) (decreases t) =
| match inspect_ln t with
| Tv_Var _ | Tv_BVar _ | Tv_FVar _ | Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1) else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> () | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_open_inverse'_comp | val close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c) | val close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c) | let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 561,
"start_col": 0,
"start_line": 354
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
c: FStar.Stubs.Reflection.Types.comp ->
x:
FStar.Stubs.Reflection.V2.Data.var
{~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_comp c))}
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.subst_comp (FStar.Reflection.Typing.subst_comp c
(FStar.Reflection.Typing.open_with_var x i))
[FStar.Reflection.Typing.ND x i] ==
c) (decreases c) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"close_open_inverse'",
"close_open_inverse'_comp",
"close_open_inverse'_args",
"close_open_inverse'_binder",
"close_open_inverse'_terms",
"close_open_inverse'_branches",
"close_open_inverse'_branch",
"close_open_inverse'_pattern",
"close_open_inverse'_patterns",
"close_open_inverse'_match_returns"
] | [
"Prims.nat",
"FStar.Stubs.Reflection.Types.comp",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_comp",
"FStar.Stubs.Reflection.V2.Builtins.inspect_comp",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Reflection.Typing.close_open_inverse'",
"FStar.Stubs.Reflection.Types.term",
"Prims.unit",
"FStar.Stubs.Reflection.V2.Data.universes",
"FStar.Stubs.Reflection.Types.name",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Reflection.Typing.close_open_inverse'_terms",
"FStar.Reflection.Typing.close_open_inverse'_args",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_comp",
"FStar.Reflection.Typing.open_with_var",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_open_inverse'_comp (i: nat) (c: comp) (x: var{~(x `Set.mem` (freevars_comp c))})
: Lemma (ensures subst_comp (subst_comp c (open_with_var x i)) [ND x i] == c) (decreases c) =
| match inspect_comp c with
| C_Total t | C_GTotal t -> close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_args_with_not_free_var | val close_args_with_not_free_var (l: list R.argv) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_args l)))
(ensures subst_args l [ND x i] == l)
(decreases l) | val close_args_with_not_free_var (l: list R.argv) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_args l)))
(ensures subst_args l [ND x i] == l)
(decreases l) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: Prims.list FStar.Stubs.Reflection.V2.Data.argv ->
x: FStar.Stubs.Reflection.V2.Data.var ->
i: Prims.nat
-> FStar.Pervasives.Lemma (requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_args l)))
(ensures FStar.Reflection.Typing.subst_args l [FStar.Reflection.Typing.ND x i] == l)
(decreases l) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Reflection.Typing.close_args_with_not_free_var",
"Prims.unit",
"FStar.Reflection.Typing.close_with_not_free_var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_args",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_args",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_args_with_not_free_var (l: list R.argv) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_args l)))
(ensures subst_args l [ND x i] == l)
(decreases l) =
| match l with
| [] -> ()
| (t, _) :: tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.open_close_inverse'_args | val open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts) | val open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts) | let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
() | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 6,
"end_line": 346,
"start_col": 0,
"start_line": 131
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
ts: Prims.list FStar.Stubs.Reflection.V2.Data.argv {FStar.Reflection.Typing.ln'_args ts (i - 1)} ->
x: FStar.Stubs.Reflection.V2.Data.var
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.subst_args (FStar.Reflection.Typing.subst_args ts
[FStar.Reflection.Typing.ND x i])
(FStar.Reflection.Typing.open_with_var x i) ==
ts) (decreases ts) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"open_close_inverse'",
"open_close_inverse'_binder",
"open_close_inverse'_terms",
"open_close_inverse'_comp",
"open_close_inverse'_args",
"open_close_inverse'_patterns",
"open_close_inverse'_pattern",
"open_close_inverse'_branch",
"open_close_inverse'_branches",
"open_close_inverse'_match_returns"
] | [
"Prims.nat",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"Prims.b2t",
"FStar.Reflection.Typing.ln'_args",
"Prims.op_Subtraction",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Reflection.Typing.open_close_inverse'_args",
"Prims.unit",
"FStar.Reflection.Typing.open_close_inverse'",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_args",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Reflection.Typing.open_with_var",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec open_close_inverse'_args (i: nat) (ts: list argv {ln'_args ts (i - 1)}) (x: var)
: Lemma (ensures subst_args (subst_args ts [ND x i]) (open_with_var x i) == ts) (decreases ts) =
| match ts with
| [] -> ()
| (t, q) :: ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_branch_with_not_free_var | val close_branch_with_not_free_var (br: R.branch) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_branch br)))
(ensures subst_branch br [ND x i] == br)
(decreases br) | val close_branch_with_not_free_var (br: R.branch) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_branch br)))
(ensures subst_branch br [ND x i] == br)
(decreases br) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | br: FStar.Stubs.Reflection.V2.Data.branch -> x: FStar.Stubs.Reflection.V2.Data.var -> i: Prims.nat
-> FStar.Pervasives.Lemma
(requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_branch br)))
(ensures FStar.Reflection.Typing.subst_branch br [FStar.Reflection.Typing.ND x i] == br)
(decreases br) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"FStar.Stubs.Reflection.V2.Data.branch",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Stubs.Reflection.V2.Data.pattern",
"FStar.Stubs.Reflection.Types.term",
"FStar.Reflection.Typing.close_with_not_free_var",
"Prims.op_Addition",
"FStar.Reflection.Typing.binder_offset_pattern",
"Prims.unit",
"FStar.Reflection.Typing.close_pattern_with_not_free_var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_branch",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_branch",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_branch_with_not_free_var (br: R.branch) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_branch br)))
(ensures subst_branch br [ND x i] == br)
(decreases br) =
| let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i) | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_open_inverse'_args | val close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args) | val close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args) | let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 561,
"start_col": 0,
"start_line": 354
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
args: Prims.list FStar.Stubs.Reflection.V2.Data.argv ->
x:
FStar.Stubs.Reflection.V2.Data.var
{~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_args args))}
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.subst_args (FStar.Reflection.Typing.subst_args args
(FStar.Reflection.Typing.open_with_var x i))
[FStar.Reflection.Typing.ND x i] ==
args) (decreases args) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"close_open_inverse'",
"close_open_inverse'_comp",
"close_open_inverse'_args",
"close_open_inverse'_binder",
"close_open_inverse'_terms",
"close_open_inverse'_branches",
"close_open_inverse'_branch",
"close_open_inverse'_pattern",
"close_open_inverse'_patterns",
"close_open_inverse'_match_returns"
] | [
"Prims.nat",
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_args",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Reflection.Typing.close_open_inverse'_args",
"Prims.unit",
"FStar.Reflection.Typing.close_open_inverse'",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_args",
"FStar.Reflection.Typing.open_with_var",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_open_inverse'_args
(i: nat)
(args: list argv)
(x: var{~(x `Set.mem` (freevars_args args))})
: Lemma (ensures subst_args (subst_args args (open_with_var x i)) [ND x i] == args)
(decreases args) =
| match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_branches_with_not_free_var | val close_branches_with_not_free_var (brs: list R.branch) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ND x i] == brs)
(decreases brs) | val close_branches_with_not_free_var (brs: list R.branch) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ND x i] == brs)
(decreases brs) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
brs: Prims.list FStar.Stubs.Reflection.V2.Data.branch ->
x: FStar.Stubs.Reflection.V2.Data.var ->
i: Prims.nat
-> FStar.Pervasives.Lemma
(requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_branches brs)))
(ensures FStar.Reflection.Typing.subst_branches brs [FStar.Reflection.Typing.ND x i] == brs)
(decreases brs) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"Prims.list",
"FStar.Stubs.Reflection.V2.Data.branch",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Reflection.Typing.close_branches_with_not_free_var",
"Prims.unit",
"FStar.Reflection.Typing.close_branch_with_not_free_var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_branches",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_branches",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_branches_with_not_free_var (brs: list R.branch) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ND x i] == brs)
(decreases brs) =
| match brs with
| [] -> ()
| hd :: tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_match_returns_with_not_free_var | val close_match_returns_with_not_free_var (r: match_returns_ascription) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ND x i] == r)
(decreases r) | val close_match_returns_with_not_free_var (r: match_returns_ascription) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ND x i] == r)
(decreases r) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: FStar.Stubs.Reflection.Types.match_returns_ascription ->
x: FStar.Stubs.Reflection.V2.Data.var ->
i: Prims.nat
-> FStar.Pervasives.Lemma
(requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_match_returns r)))
(ensures FStar.Reflection.Typing.subst_match_returns r [FStar.Reflection.Typing.ND x i] == r)
(decreases r) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"FStar.Stubs.Reflection.Types.match_returns_ascription",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Stubs.Reflection.Types.binder",
"FStar.Pervasives.either",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.Types.comp",
"FStar.Pervasives.Native.option",
"Prims.bool",
"FStar.Reflection.Typing.close_with_not_free_var",
"Prims.op_Addition",
"Prims.unit",
"FStar.Reflection.Typing.close_comp_with_not_free_var",
"FStar.Reflection.Typing.close_binder_with_not_free_var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_match_returns",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_match_returns",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_match_returns_with_not_free_var (r: match_returns_ascription) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ND x i] == r)
(decreases r) =
| let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1)) | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_terms_with_not_free_var | val close_terms_with_not_free_var (l: list R.term) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_terms l)))
(ensures subst_terms l [ND x i] == l)
(decreases l) | val close_terms_with_not_free_var (l: list R.term) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_terms l)))
(ensures subst_terms l [ND x i] == l)
(decreases l) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: Prims.list FStar.Stubs.Reflection.Types.term ->
x: FStar.Stubs.Reflection.V2.Data.var ->
i: Prims.nat
-> FStar.Pervasives.Lemma (requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_terms l)))
(ensures FStar.Reflection.Typing.subst_terms l [FStar.Reflection.Typing.ND x i] == l)
(decreases l) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"Prims.list",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Reflection.Typing.close_terms_with_not_free_var",
"Prims.unit",
"FStar.Reflection.Typing.close_with_not_free_var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_terms",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_terms",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_terms_with_not_free_var (l: list R.term) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_terms l)))
(ensures subst_terms l [ND x i] == l)
(decreases l) =
| match l with
| [] -> ()
| hd :: tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_binder_with_not_free_var | val close_binder_with_not_free_var (b: R.binder) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_binder b)))
(ensures subst_binder b [ND x i] == b)
(decreases b) | val close_binder_with_not_free_var (b: R.binder) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_binder b)))
(ensures subst_binder b [ND x i] == b)
(decreases b) | let rec close_with_not_free_var (t:R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars t)))
(ensures subst_term t [ ND x i ] == t)
(decreases t) =
match inspect_ln t with
| Tv_Var _
| Tv_BVar _
| Tv_FVar _
| Tv_UInst _ _ -> ()
| Tv_App hd (arg, _) ->
close_with_not_free_var hd x i;
close_with_not_free_var arg x i
| Tv_Abs b body ->
close_binder_with_not_free_var b x i;
close_with_not_free_var body x (i + 1)
| Tv_Arrow b c ->
close_binder_with_not_free_var b x i;
close_comp_with_not_free_var c x (i + 1)
| Tv_Type _ -> ()
| Tv_Refine b t ->
close_binder_with_not_free_var b x i;
close_with_not_free_var t x (i + 1)
| Tv_Const _ -> ()
| Tv_Uvar _ _ -> assert False
| Tv_Let recf attrs b e1 e2 ->
close_terms_with_not_free_var attrs x i;
close_binder_with_not_free_var b x i;
(if recf then close_with_not_free_var e1 x (i + 1)
else close_with_not_free_var e1 x i);
close_with_not_free_var e2 x (i + 1)
| Tv_Match scrutinee ret_opt brs ->
close_with_not_free_var scrutinee x i;
(match ret_opt with
| None -> ()
| Some ret -> close_match_returns_with_not_free_var ret x i);
close_branches_with_not_free_var brs x i
| Tv_AscribedT e t tacopt _ ->
close_with_not_free_var e x i;
close_with_not_free_var t x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_AscribedC e c tacopt _ ->
close_with_not_free_var e x i;
close_comp_with_not_free_var c x i;
(match tacopt with
| None -> ()
| Some tac -> close_with_not_free_var tac x i)
| Tv_Unknown -> ()
| Tv_Unsupp -> ()
and close_match_returns_with_not_free_var
(r:match_returns_ascription)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_match_returns r)))
(ensures subst_match_returns r [ ND x i ] == r)
(decreases r) =
let b, (ret, as_opt, _) = r in
close_binder_with_not_free_var b x i;
(match ret with
| Inl t -> close_with_not_free_var t x (i + 1)
| Inr c -> close_comp_with_not_free_var c x (i + 1));
(match as_opt with
| None -> ()
| Some t -> close_with_not_free_var t x (i + 1))
and close_branches_with_not_free_var
(brs:list R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branches brs)))
(ensures subst_branches brs [ ND x i ] == brs)
(decreases brs) =
match brs with
| [] -> ()
| hd::tl ->
close_branch_with_not_free_var hd x i;
close_branches_with_not_free_var tl x i
and close_branch_with_not_free_var
(br:R.branch)
(x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_branch br)))
(ensures subst_branch br [ ND x i ] == br)
(decreases br) =
let p, t = br in
close_pattern_with_not_free_var p x i;
close_with_not_free_var t x (binder_offset_pattern p + i)
and close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_pattern p)))
(ensures subst_pattern p [ ND x i ] == p)
(decreases p) =
match p with
| Pat_Constant _ -> ()
| Pat_Cons _ _ pats ->
close_patterns_with_not_free_var pats x i
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
(match topt with
| None -> ()
| Some t -> close_with_not_free_var t x i)
and close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_patterns l)))
(ensures subst_patterns l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (p, _)::tl ->
close_pattern_with_not_free_var p x i;
close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)
and close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_terms l)))
(ensures subst_terms l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| hd::tl ->
close_with_not_free_var hd x i;
close_terms_with_not_free_var tl x i
and close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_binder b)))
(ensures subst_binder b [ ND x i ] == b)
(decreases b) =
let {attrs; sort} = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i
and close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_comp c)))
(ensures subst_comp c [ ND x i ] == c)
(decreases c) =
match inspect_comp c with
| C_Total t
| C_GTotal t -> close_with_not_free_var t x i
| C_Lemma pre post pats ->
close_with_not_free_var pre x i;
close_with_not_free_var post x i;
close_with_not_free_var pats x i
| C_Eff _ _ t args decrs ->
close_with_not_free_var t x i;
close_args_with_not_free_var args x i;
close_terms_with_not_free_var decrs x i
and close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)
: Lemma
(requires ~ (Set.mem x (freevars_args l)))
(ensures subst_args l [ ND x i ] == l)
(decreases l) =
match l with
| [] -> ()
| (t, _)::tl ->
close_with_not_free_var t x i;
close_args_with_not_free_var tl x i | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 747,
"start_col": 0,
"start_line": 570
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x
let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x)
let close_open_inverse (e:R.term) (x:var {~ (x `Set.mem` freevars e) })
: Lemma (close_term (open_term e x) x == e)
= open_term_spec e x;
close_term_spec (open_term e x) x;
close_open_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Stubs.Reflection.Types.binder -> x: FStar.Stubs.Reflection.V2.Data.var -> i: Prims.nat
-> FStar.Pervasives.Lemma
(requires ~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_binder b)))
(ensures FStar.Reflection.Typing.subst_binder b [FStar.Reflection.Typing.ND x i] == b)
(decreases b) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [
"close_with_not_free_var",
"close_match_returns_with_not_free_var",
"close_branches_with_not_free_var",
"close_branch_with_not_free_var",
"close_pattern_with_not_free_var",
"close_patterns_with_not_free_var",
"close_terms_with_not_free_var",
"close_binder_with_not_free_var",
"close_comp_with_not_free_var",
"close_args_with_not_free_var"
] | [
"FStar.Stubs.Reflection.Types.binder",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.nat",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"Prims.list",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.ppname_t",
"FStar.Reflection.Typing.close_terms_with_not_free_var",
"Prims.unit",
"FStar.Reflection.Typing.close_with_not_free_var",
"FStar.Stubs.Reflection.V2.Data.binder_view",
"Prims.precedes",
"FStar.Stubs.Reflection.V2.Builtins.inspect_binder",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_binder",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_binder",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_binder_with_not_free_var (b: R.binder) (x: var) (i: nat)
: Lemma (requires ~(Set.mem x (freevars_binder b)))
(ensures subst_binder b [ND x i] == b)
(decreases b) =
| let { attrs = attrs ; sort = sort } = inspect_binder b in
close_with_not_free_var sort x i;
close_terms_with_not_free_var attrs x i | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.open_close_inverse'_patterns | val open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps) | val open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps) | let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
() | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 6,
"end_line": 346,
"start_col": 0,
"start_line": 131
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
ps:
Prims.list (FStar.Stubs.Reflection.V2.Data.pattern * Prims.bool)
{FStar.Reflection.Typing.ln'_patterns ps (i - 1)} ->
x: FStar.Stubs.Reflection.V2.Data.var
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.subst_patterns (FStar.Reflection.Typing.subst_patterns ps
[FStar.Reflection.Typing.ND x i])
(FStar.Reflection.Typing.open_with_var x i) ==
ps) (decreases ps) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"open_close_inverse'",
"open_close_inverse'_binder",
"open_close_inverse'_terms",
"open_close_inverse'_comp",
"open_close_inverse'_args",
"open_close_inverse'_patterns",
"open_close_inverse'_pattern",
"open_close_inverse'_branch",
"open_close_inverse'_branches",
"open_close_inverse'_match_returns"
] | [
"Prims.nat",
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"FStar.Stubs.Reflection.V2.Data.pattern",
"Prims.bool",
"Prims.b2t",
"FStar.Reflection.Typing.ln'_patterns",
"Prims.op_Subtraction",
"FStar.Stubs.Reflection.V2.Data.var",
"FStar.Reflection.Typing.open_close_inverse'_patterns",
"Prims.op_Addition",
"Prims.unit",
"FStar.Reflection.Typing.binder_offset_pattern_invariant",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Reflection.Typing.binder_offset_pattern",
"FStar.Reflection.Typing.open_close_inverse'_pattern",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_patterns",
"FStar.Reflection.Typing.open_with_var",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec open_close_inverse'_patterns
(i: nat)
(ps: list (pattern & bool) {ln'_patterns ps (i - 1)})
(x: var)
: Lemma (ensures subst_patterns (subst_patterns ps [ND x i]) (open_with_var x i) == ps)
(decreases ps) =
| match ps with
| [] -> ()
| (p, b) :: ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ND x i];
open_close_inverse'_patterns (i + n) ps' x | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_open_inverse'_binder | val close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b) | val close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b) | let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 561,
"start_col": 0,
"start_line": 354
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
b: FStar.Stubs.Reflection.Types.binder ->
x:
FStar.Stubs.Reflection.V2.Data.var
{~(FStar.Set.mem x (FStar.Reflection.Typing.freevars_binder b))}
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.subst_binder (FStar.Reflection.Typing.subst_binder b
(FStar.Reflection.Typing.open_with_var x i))
[FStar.Reflection.Typing.ND x i] ==
b) (decreases b) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"close_open_inverse'",
"close_open_inverse'_comp",
"close_open_inverse'_args",
"close_open_inverse'_binder",
"close_open_inverse'_terms",
"close_open_inverse'_branches",
"close_open_inverse'_branch",
"close_open_inverse'_pattern",
"close_open_inverse'_patterns",
"close_open_inverse'_match_returns"
] | [
"Prims.nat",
"FStar.Stubs.Reflection.Types.binder",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars_binder",
"FStar.Reflection.Typing.pack_inspect_binder",
"Prims.unit",
"FStar.Reflection.Typing.close_open_inverse'_terms",
"FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__attrs",
"FStar.Reflection.Typing.close_open_inverse'",
"FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__sort",
"FStar.Stubs.Reflection.V2.Data.binder_view",
"Prims.precedes",
"FStar.Stubs.Reflection.V2.Builtins.inspect_binder",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_binder",
"FStar.Reflection.Typing.open_with_var",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_open_inverse'_binder (i: nat) (b: binder) (x: var{~(x `Set.mem` (freevars_binder b))})
: Lemma (ensures subst_binder (subst_binder b (open_with_var x i)) [ND x i] == b) (decreases b) =
| let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b | false |
FStar.Reflection.Typing.fst | FStar.Reflection.Typing.close_open_inverse' | val close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t) | val close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t) | let rec close_open_inverse' (i:nat)
(t:term)
(x:var { ~(x `Set.mem` freevars t) })
: Lemma
(ensures subst_term
(subst_term t (open_with_var x i))
[ ND x i ]
== t)
(decreases t)
= match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
and close_open_inverse'_comp (i:nat)
(c:comp)
(x:var{ ~(x `Set.mem` freevars_comp c) })
: Lemma
(ensures subst_comp
(subst_comp c (open_with_var x i))
[ ND x i ]
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t ->
close_open_inverse' i t x
| C_Lemma pre post pats ->
close_open_inverse' i pre x;
close_open_inverse' i post x;
close_open_inverse' i pats x
| C_Eff us eff_name res args decrs ->
close_open_inverse' i res x;
close_open_inverse'_args i args x;
close_open_inverse'_terms i decrs x
and close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })
: Lemma
(ensures subst_args
(subst_args args (open_with_var x i))
[ ND x i]
== args)
(decreases args)
= match args with
| [] -> ()
| (a, q) :: args ->
close_open_inverse' i a x;
close_open_inverse'_args i args x
and close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })
: Lemma
(ensures subst_binder
(subst_binder b (open_with_var x i))
[ ND x i ]
== b)
(decreases b)
= let bndr = inspect_binder b in
close_open_inverse' i bndr.sort x;
close_open_inverse'_terms i bndr.attrs x;
pack_inspect_binder b
and close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })
: Lemma
(ensures subst_terms
(subst_terms ts (open_with_var x i))
[ ND x i ]
== ts)
(decreases ts)
= match ts with
| [] -> ()
| hd :: tl ->
close_open_inverse' i hd x;
close_open_inverse'_terms i tl x
and close_open_inverse'_branches (i:nat) (brs:list branch)
(x:var{ ~(x `Set.mem` freevars_branches brs) })
: Lemma
(ensures subst_branches
(subst_branches brs (open_with_var x i))
[ ND x i ]
== brs)
(decreases brs)
= match brs with
| [] -> ()
| b :: brs ->
close_open_inverse'_branch i b x;
close_open_inverse'_branches i brs x
and close_open_inverse'_branch (i:nat)
(br:branch)
(x:var{ ~(x `Set.mem` freevars_branch br) })
: Lemma
(ensures subst_branch
(subst_branch br (open_with_var x i))
[ ND x i ]
== br)
(decreases br)
= let p, t = br in
close_open_inverse'_pattern i p x;
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse' (i + binder_offset_pattern p) t x
and close_open_inverse'_pattern (i:nat)
(p:pattern)
(x:var{ ~(x `Set.mem` freevars_pattern p) })
: Lemma
(ensures subst_pattern
(subst_pattern p (open_with_var x i))
[ ND x i ]
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
close_open_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> close_open_inverse' i t x
and close_open_inverse'_patterns (i:nat)
(ps:list (pattern & bool))
(x:var {~ (x `Set.mem` freevars_patterns ps) })
: Lemma
(ensures subst_patterns
(subst_patterns ps (open_with_var x i))
[ ND x i ]
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
close_open_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p (open_with_var x i);
close_open_inverse'_patterns (i + n) ps' x
and close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)
(x:var{ ~(x `Set.mem` freevars_match_returns m) })
: Lemma
(ensures subst_match_returns
(subst_match_returns m (open_with_var x i))
[ ND x i ]
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
close_open_inverse'_binder i b x;
(match ret with
| Inl t -> close_open_inverse' (i + 1) t x
| Inr c -> close_open_inverse'_comp (i + 1) c x);
(match as_ with
| None -> ()
| Some t -> close_open_inverse' (i + 1) t x) | {
"file_name": "ulib/experimental/FStar.Reflection.Typing.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 561,
"start_col": 0,
"start_line": 354
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Typing
(** This module defines a typing judgment for (parts of) the total
fragment of F*. We are using it in the meta DSL framework as an
official specification for the F* type system.
We expect it to grow to cover more of the F* language.
IT IS HIGHLY EXPERIMENTAL AND NOT YET READY TO USE.
*)
open FStar.List.Tot
open FStar.Reflection.V2
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RTB = FStar.Reflection.Typing.Builtins
let inspect_pack = R.inspect_pack_inv
let pack_inspect = R.pack_inspect_inv
let inspect_pack_namedv = R.inspect_pack_namedv
let pack_inspect_namedv = R.pack_inspect_namedv
let inspect_pack_bv = R.inspect_pack_bv
let pack_inspect_bv = R.pack_inspect_bv
let inspect_pack_binder = R.inspect_pack_binder
let pack_inspect_binder = R.pack_inspect_binder
let inspect_pack_comp = R.inspect_pack_comp_inv
let pack_inspect_comp = R.pack_inspect_comp_inv
let inspect_pack_fv = R.inspect_pack_fv
let pack_inspect_fv = R.pack_inspect_fv
let inspect_pack_universe = R.inspect_pack_universe
let pack_inspect_universe = R.pack_inspect_universe
let lookup_bvar (e:env) (x:int) : option term = magic ()
let lookup_fvar_uinst (e:R.env) (x:R.fv) (us:list R.universe)
: option R.term = magic ()
let lookup_bvar_extend_env (g:env) (x y:var) (ty:term) = admit ()
let lookup_fvar_extend_env (g:env) (x:fv) (us:universes) (y:var) (ty:term) = admit ()
let subst_ctx_uvar_and_subst _ _ = magic ()
let open_with (t:term) (v:term) = RTB.open_with t v
let open_with_spec (t v:term) = admit ()
let open_term (t:term) (v:var) = RTB.open_term t v
let open_term_spec (t:term) (v:var) = admit ()
let close_term (t:term) (v:var) = RTB.close_term t v
let close_term_spec (t:term) (v:var) = admit ()
let rename (t:term) (x y:var)= RTB.rename t x y
let rename_spec (t:term) (x y:var) = admit ()
let bv_index_of_make_bv (n:nat) = ()
let namedv_uniq_of_make_namedv (n:nat) = ()
let bindings_ok_for_pat bnds pat = magic ()
let bindings_ok_pat_constant c = admit ()
let subtyping_token_renaming (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(y:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) y) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@(x,t)::bs0)) t0 t1) = magic ()
let subtyping_token_weakening (g:env)
(bs0:bindings)
(bs1:bindings)
(x:var { None? (lookup_bvar (extend_env_l g (bs1@bs0)) x) })
(t:term)
(t0 t1:term)
(d:T.subtyping_token (extend_env_l g (bs1@bs0)) t0 t1) = magic ()
let well_typed_terms_are_ln _ _ _ _ = admit ()
let type_correctness _ _ _ _ = admit ()
let rec binder_offset_pattern_invariant (p:pattern) (ss:subst)
: Lemma (ensures binder_offset_pattern p ==
binder_offset_pattern (subst_pattern p ss))
(decreases p)
= match p with
| Pat_Cons _ _ pats ->
binder_offset_patterns_invariant pats ss
| _ -> ()
and binder_offset_patterns_invariant (p:list (pattern & bool)) (ss:subst)
: Lemma (ensures binder_offset_patterns p ==
binder_offset_patterns (subst_patterns p ss))
(decreases p)
= match p with
| [] -> ()
| (hd, _)::tl ->
binder_offset_pattern_invariant hd ss;
let n = binder_offset_pattern hd in
binder_offset_patterns_invariant tl (shift_subst_n n ss)
let rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)
: Lemma
(ensures subst_term
(subst_term t [ ND x i ])
(open_with_var x i)
== t)
(decreases t)
= match inspect_ln t with
| Tv_UInst _ _
| Tv_FVar _
| Tv_Type _
| Tv_Const _
| Tv_Unsupp
| Tv_Unknown
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
open_close_inverse' i t1 x;
open_close_inverse' i (fst a) x
| Tv_Abs b body ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) body x
| Tv_Arrow b c ->
open_close_inverse'_binder i b x;
open_close_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
open_close_inverse'_binder i b x;
open_close_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
open_close_inverse'_terms i attrs x;
open_close_inverse'_binder i b x;
(if recf
then open_close_inverse' (i + 1) def x
else open_close_inverse' i def x);
open_close_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
open_close_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> open_close_inverse'_match_returns i m x);
open_close_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
open_close_inverse' i e x;
open_close_inverse' i t x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
| Tv_AscribedC e c tac b ->
open_close_inverse' i e x;
open_close_inverse'_comp i c x;
(match tac with
| None -> ()
| Some tac -> open_close_inverse' i tac x)
and open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)
: Lemma (ensures subst_binder
(subst_binder b [ ND x i ])
(open_with_var x i)
== b)
(decreases b)
= let bndr = inspect_binder b in
let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in
open_close_inverse' i sort x;
open_close_inverse'_terms i attrs x;
assert (subst_terms (subst_terms attrs [ ND x i ])
(open_with_var x i) == attrs);
pack_inspect_binder b;
assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)
and open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)
: Lemma (ensures subst_terms
(subst_terms ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| t::ts ->
open_close_inverse' i t x;
open_close_inverse'_terms i ts x
and open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)
: Lemma
(ensures subst_comp
(subst_comp c [ ND x i ])
(open_with_var x i)
== c)
(decreases c)
= match inspect_comp c with
| C_Total t
| C_GTotal t -> open_close_inverse' i t x
| C_Lemma pre post pats ->
open_close_inverse' i pre x;
open_close_inverse' i post x;
open_close_inverse' i pats x
| C_Eff us eff_name res args decrs ->
open_close_inverse' i res x;
open_close_inverse'_args i args x;
open_close_inverse'_terms i decrs x
and open_close_inverse'_args (i:nat)
(ts:list argv { ln'_args ts (i - 1) })
(x:var)
: Lemma
(ensures subst_args
(subst_args ts [ ND x i ])
(open_with_var x i)
== ts)
(decreases ts)
= match ts with
| [] -> ()
| (t,q)::ts ->
open_close_inverse' i t x;
open_close_inverse'_args i ts x
and open_close_inverse'_patterns (i:nat)
(ps:list (pattern & bool) { ln'_patterns ps (i - 1) })
(x:var)
: Lemma
(ensures subst_patterns
(subst_patterns ps [ ND x i ])
(open_with_var x i)
== ps)
(decreases ps)
= match ps with
| [] -> ()
| (p, b)::ps' ->
open_close_inverse'_pattern i p x;
let n = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_patterns (i + n) ps' x
and open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)
: Lemma
(ensures subst_pattern
(subst_pattern p [ ND x i ])
(open_with_var x i)
== p)
(decreases p)
= match p with
| Pat_Constant _ -> ()
| Pat_Cons fv us pats ->
open_close_inverse'_patterns i pats x
| Pat_Var bv _ -> ()
| Pat_Dot_Term topt ->
match topt with
| None -> ()
| Some t -> open_close_inverse' i t x
and open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)
: Lemma
(ensures subst_branch
(subst_branch br [ ND x i ])
(open_with_var x i)
== br)
(decreases br)
= let p, t = br in
let j = binder_offset_pattern p in
binder_offset_pattern_invariant p [ ND x i ];
open_close_inverse'_pattern i p x;
open_close_inverse' (i + j) t x
and open_close_inverse'_branches (i:nat)
(brs:list branch { ln'_branches brs (i - 1) })
(x:var)
: Lemma
(ensures subst_branches
(subst_branches brs [ ND x i ])
(open_with_var x i)
== brs)
(decreases brs)
= match brs with
| [] -> ()
| br::brs ->
open_close_inverse'_branch i br x;
open_close_inverse'_branches i brs x
and open_close_inverse'_match_returns (i:nat)
(m:match_returns_ascription { ln'_match_returns m (i - 1) })
(x:var)
: Lemma
(ensures subst_match_returns
(subst_match_returns m [ ND x i ])
(open_with_var x i)
== m)
(decreases m)
= let b, (ret, as_, eq) = m in
open_close_inverse'_binder i b x;
let ret =
match ret with
| Inl t ->
open_close_inverse' (i + 1) t x
| Inr c ->
open_close_inverse'_comp (i + 1) c x
in
let as_ =
match as_ with
| None -> ()
| Some t ->
open_close_inverse' (i + 1) t x
in
()
let open_close_inverse (e:R.term { ln e }) (x:var)
: Lemma (open_term (close_term e x) x == e)
= close_term_spec e x;
open_term_spec (close_term e x) x;
open_close_inverse' 0 e x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.Builtins.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "FStar.Reflection.Typing.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "FStar.Stubs.Reflection.V2.Data",
"short_module": "RD"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
t: FStar.Stubs.Reflection.Types.term ->
x: FStar.Stubs.Reflection.V2.Data.var{~(FStar.Set.mem x (FStar.Reflection.Typing.freevars t))}
-> FStar.Pervasives.Lemma
(ensures
FStar.Reflection.Typing.subst_term (FStar.Reflection.Typing.subst_term t
(FStar.Reflection.Typing.open_with_var x i))
[FStar.Reflection.Typing.ND x i] ==
t) (decreases t) | FStar.Pervasives.Lemma | [
"",
"lemma"
] | [
"close_open_inverse'",
"close_open_inverse'_comp",
"close_open_inverse'_args",
"close_open_inverse'_binder",
"close_open_inverse'_terms",
"close_open_inverse'_branches",
"close_open_inverse'_branch",
"close_open_inverse'_pattern",
"close_open_inverse'_patterns",
"close_open_inverse'_match_returns"
] | [
"Prims.nat",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Reflection.V2.Data.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"FStar.Reflection.Typing.freevars",
"FStar.Stubs.Reflection.V2.Builtins.inspect_ln",
"FStar.Stubs.Reflection.Types.ctx_uvar_and_subst",
"Prims._assert",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Stubs.Reflection.V2.Data.universes",
"FStar.Stubs.Reflection.Types.universe",
"FStar.Stubs.Reflection.V2.Data.vconst",
"FStar.Stubs.Reflection.Types.bv",
"FStar.Stubs.Reflection.Types.namedv",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Reflection.Typing.close_open_inverse'",
"FStar.Pervasives.Native.fst",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"Prims.unit",
"FStar.Stubs.Reflection.Types.binder",
"Prims.op_Addition",
"FStar.Reflection.Typing.close_open_inverse'_binder",
"FStar.Stubs.Reflection.Types.comp",
"FStar.Reflection.Typing.close_open_inverse'_comp",
"FStar.Stubs.Reflection.V2.Data.simple_binder",
"Prims.bool",
"Prims.list",
"FStar.Reflection.Typing.close_open_inverse'_terms",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Reflection.Types.match_returns_ascription",
"FStar.Stubs.Reflection.V2.Data.branch",
"FStar.Reflection.Typing.close_open_inverse'_branches",
"FStar.Reflection.Typing.close_open_inverse'_match_returns",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Reflection.Typing.subst_term",
"FStar.Reflection.Typing.open_with_var",
"Prims.Cons",
"FStar.Reflection.Typing.subst_elt",
"FStar.Reflection.Typing.ND",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"mutual recursion"
] | false | false | true | false | false | let rec close_open_inverse' (i: nat) (t: term) (x: var{~(x `Set.mem` (freevars t))})
: Lemma (ensures subst_term (subst_term t (open_with_var x i)) [ND x i] == t) (decreases t) =
| match inspect_ln t with
| Tv_Uvar _ _ -> assert false
| Tv_UInst _ _ | Tv_FVar _ | Tv_Type _ | Tv_Const _ | Tv_Unsupp | Tv_Unknown -> ()
| Tv_BVar _ -> ()
| Tv_Var _ -> ()
| Tv_App t1 a ->
close_open_inverse' i t1 x;
close_open_inverse' i (fst a) x
| Tv_Abs b body ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) body x
| Tv_Arrow b c ->
close_open_inverse'_binder i b x;
close_open_inverse'_comp (i + 1) c x
| Tv_Refine b f ->
close_open_inverse'_binder i b x;
close_open_inverse' (i + 1) f x
| Tv_Let recf attrs b def body ->
close_open_inverse'_terms i attrs x;
close_open_inverse'_binder i b x;
close_open_inverse' (if recf then (i + 1) else i) def x;
close_open_inverse' (i + 1) body x
| Tv_Match scr ret brs ->
close_open_inverse' i scr x;
(match ret with
| None -> ()
| Some m -> close_open_inverse'_match_returns i m x);
close_open_inverse'_branches i brs x
| Tv_AscribedT e t tac b ->
close_open_inverse' i e x;
close_open_inverse' i t x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x)
| Tv_AscribedC e c tac b ->
close_open_inverse' i e x;
close_open_inverse'_comp i c x;
(match tac with
| None -> ()
| Some t -> close_open_inverse' i t x) | false |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.